State every binding size, so nothing is left for wgpu to check per draw
The window uniform and the mask array were still `None`, which is what puts a binding on wgpu-core's late-sized list: `check_late_buffer_bindings` runs from `is_ready` on every draw and compares each such binding's bound size against the naga-derived minimum for the shader global. Stating the size filters the binding out of that list, and moves the same comparison to bind group and pipeline creation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
444a2cd138
commit
c0fcc0345c
1 file changed
+6
-5
@@ -295,7 +295,7 @@ impl UiRenderNode {
|
|||||||
ty: BindingType::Buffer {
|
ty: BindingType::Buffer {
|
||||||
ty: BufferBindingType::Uniform,
|
ty: BufferBindingType::Uniform,
|
||||||
has_dynamic_offset: false,
|
has_dynamic_offset: false,
|
||||||
min_binding_size: None,
|
min_binding_size: BufferSize::new(size_of::<WindowUniform>() as u64),
|
||||||
},
|
},
|
||||||
count: None,
|
count: None,
|
||||||
},
|
},
|
||||||
@@ -305,7 +305,7 @@ impl UiRenderNode {
|
|||||||
ty: BindingType::Buffer {
|
ty: BindingType::Buffer {
|
||||||
ty: BufferBindingType::Storage { read_only: true },
|
ty: BufferBindingType::Storage { read_only: true },
|
||||||
has_dynamic_offset: false,
|
has_dynamic_offset: false,
|
||||||
min_binding_size: None,
|
min_binding_size: BufferSize::new(size_of::<Mask>() as u64),
|
||||||
},
|
},
|
||||||
count: None,
|
count: None,
|
||||||
},
|
},
|
||||||
@@ -362,8 +362,9 @@ impl UiRenderNode {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Layout for a list of one primitive's data. Stating the size rather than
|
/// Layout for a list of one primitive's data. Every size in the ui is
|
||||||
/// leaving it `None` is what moves the check off every draw.
|
/// stated, so "is the buffer big enough for one entry?" is answered when
|
||||||
|
/// the bind group is made; a `None` size is wgpu's to check on every draw.
|
||||||
fn data_layout(device: &Device, stride: u64) -> BindGroupLayout {
|
fn data_layout(device: &Device, stride: u64) -> BindGroupLayout {
|
||||||
device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||||
entries: &[BindGroupLayoutEntry {
|
entries: &[BindGroupLayoutEntry {
|
||||||
@@ -372,7 +373,7 @@ impl UiRenderNode {
|
|||||||
ty: BindingType::Buffer {
|
ty: BindingType::Buffer {
|
||||||
ty: BufferBindingType::Storage { read_only: true },
|
ty: BufferBindingType::Storage { read_only: true },
|
||||||
has_dynamic_offset: false,
|
has_dynamic_offset: false,
|
||||||
min_binding_size: std::num::NonZero::new(stride),
|
min_binding_size: BufferSize::new(stride),
|
||||||
},
|
},
|
||||||
count: None,
|
count: None,
|
||||||
}],
|
}],
|
||||||
|
|||||||
Reference in new issue
Block a user