Skip to content

Commit 65e834c

Browse files
committed
Use crevice std140_size_static everywhere (#3168)
# Objective - Use `std140_size_static()` everywhere instead of manual sizes as the crevice rewrite appears to have fixed all the problems as it claimed to do. I've tested `3d_scene_pipelined`, `bevymark_pipelined`, and `load_gltf_pipelined` and all three look fine.
1 parent 900acc6 commit 65e834c

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

pipelined/bevy_pbr2/src/render/light.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ use bevy_render2::{
2525
render_resource::*,
2626
renderer::{RenderContext, RenderDevice, RenderQueue},
2727
texture::*,
28-
view::{ExtractedView, ViewUniformOffset, ViewUniforms, VisibleEntities, VisibleEntity},
28+
view::{
29+
ExtractedView, ViewUniform, ViewUniformOffset, ViewUniforms, VisibleEntities, VisibleEntity,
30+
},
2931
};
3032
use bevy_transform::components::GlobalTransform;
3133
use crevice::std140::AsStd140;
@@ -155,9 +157,7 @@ impl FromWorld for ShadowPipeline {
155157
ty: BindingType::Buffer {
156158
ty: BufferBindingType::Uniform,
157159
has_dynamic_offset: true,
158-
// TODO: change this to ViewUniform::std140_size_static once crevice fixes this!
159-
// Context: https://github.com/LPGhatguy/crevice/issues/29
160-
min_binding_size: BufferSize::new(144),
160+
min_binding_size: BufferSize::new(ViewUniform::std140_size_static() as u64),
161161
},
162162
count: None,
163163
},

pipelined/bevy_pbr2/src/render/mesh.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
2-
LightMeta, NotShadowCaster, NotShadowReceiver, ShadowPipeline, ViewLightsUniformOffset,
3-
ViewShadowBindings,
2+
GpuLights, LightMeta, NotShadowCaster, NotShadowReceiver, ShadowPipeline,
3+
ViewLightsUniformOffset, ViewShadowBindings,
44
};
55
use bevy_app::Plugin;
66
use bevy_asset::{Assets, Handle, HandleUntyped};
@@ -18,7 +18,7 @@ use bevy_render2::{
1818
render_resource::*,
1919
renderer::{RenderDevice, RenderQueue},
2020
texture::{BevyDefault, GpuImage, Image, TextureFormatPixelInfo},
21-
view::{ComputedVisibility, ViewUniformOffset, ViewUniforms},
21+
view::{ComputedVisibility, ViewUniform, ViewUniformOffset, ViewUniforms},
2222
RenderApp, RenderStage,
2323
};
2424
use bevy_transform::components::GlobalTransform;
@@ -180,9 +180,7 @@ impl FromWorld for MeshPipeline {
180180
ty: BindingType::Buffer {
181181
ty: BufferBindingType::Uniform,
182182
has_dynamic_offset: true,
183-
// TODO: change this to ViewUniform::std140_size_static once crevice fixes this!
184-
// Context: https://github.com/LPGhatguy/crevice/issues/29
185-
min_binding_size: BufferSize::new(144),
183+
min_binding_size: BufferSize::new(ViewUniform::std140_size_static() as u64),
186184
},
187185
count: None,
188186
},
@@ -193,9 +191,7 @@ impl FromWorld for MeshPipeline {
193191
ty: BindingType::Buffer {
194192
ty: BufferBindingType::Uniform,
195193
has_dynamic_offset: true,
196-
// TODO: change this to GpuLights::std140_size_static once crevice fixes this!
197-
// Context: https://github.com/LPGhatguy/crevice/issues/29
198-
min_binding_size: BufferSize::new(1424),
194+
min_binding_size: BufferSize::new(GpuLights::std140_size_static() as u64),
199195
},
200196
count: None,
201197
},
@@ -252,9 +248,7 @@ impl FromWorld for MeshPipeline {
252248
ty: BindingType::Buffer {
253249
ty: BufferBindingType::Uniform,
254250
has_dynamic_offset: true,
255-
// TODO: change this to MeshUniform::std140_size_static once crevice fixes this!
256-
// Context: https://github.com/LPGhatguy/crevice/issues/29
257-
min_binding_size: BufferSize::new(144),
251+
min_binding_size: BufferSize::new(MeshUniform::std140_size_static() as u64),
258252
},
259253
count: None,
260254
}],

pipelined/bevy_sprite2/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ bevy_utils = { path = "../../crates/bevy_utils", version = "0.5.0" }
3030

3131
# other
3232
bytemuck = { version = "1.5", features = ["derive"] }
33+
crevice = { path = "../../crates/crevice", version = "0.8.0", features = ["glam"] }
3334
guillotiere = "0.6.0"
3435
thiserror = "1.0"
3536
rectangle-pack = "0.4"

pipelined/bevy_sprite2/src/render/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ use bevy_render2::{
1919
render_resource::*,
2020
renderer::{RenderDevice, RenderQueue},
2121
texture::{BevyDefault, Image},
22-
view::{ComputedVisibility, ViewUniformOffset, ViewUniforms},
22+
view::{ComputedVisibility, ViewUniform, ViewUniformOffset, ViewUniforms},
2323
RenderWorld,
2424
};
2525
use bevy_transform::components::GlobalTransform;
2626
use bevy_utils::HashMap;
2727
use bytemuck::{Pod, Zeroable};
28+
use crevice::std140::AsStd140;
2829

2930
pub struct SpritePipeline {
3031
view_layout: BindGroupLayout,
@@ -43,9 +44,7 @@ impl FromWorld for SpritePipeline {
4344
ty: BindingType::Buffer {
4445
ty: BufferBindingType::Uniform,
4546
has_dynamic_offset: true,
46-
// TODO: change this to ViewUniform::std140_size_static once crevice fixes this!
47-
// Context: https://github.com/LPGhatguy/crevice/issues/29
48-
min_binding_size: BufferSize::new(144),
47+
min_binding_size: BufferSize::new(ViewUniform::std140_size_static() as u64),
4948
},
5049
count: None,
5150
}],

0 commit comments

Comments
 (0)