From c0fcc0345c127af533a77121d9553bcf18bb1455 Mon Sep 17 00:00:00 2001 From: iris <2+iris@noreply.localhost> Date: Sun, 13 Sep 2026 17:26:59 -0400 Subject: [PATCH] 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 --- core/src/render/mod.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/render/mod.rs b/core/src/render/mod.rs index a5e985c..b2f425b 100644 --- a/core/src/render/mod.rs +++ b/core/src/render/mod.rs @@ -295,7 +295,7 @@ impl UiRenderNode { ty: BindingType::Buffer { ty: BufferBindingType::Uniform, has_dynamic_offset: false, - min_binding_size: None, + min_binding_size: BufferSize::new(size_of::() as u64), }, count: None, }, @@ -305,7 +305,7 @@ impl UiRenderNode { ty: BindingType::Buffer { ty: BufferBindingType::Storage { read_only: true }, has_dynamic_offset: false, - min_binding_size: None, + min_binding_size: BufferSize::new(size_of::() as u64), }, count: None, }, @@ -362,8 +362,9 @@ impl UiRenderNode { }) } - /// Layout for a list of one primitive's data. Stating the size rather than - /// leaving it `None` is what moves the check off every draw. + /// Layout for a list of one primitive's data. Every size in the ui is + /// 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 { device.create_bind_group_layout(&BindGroupLayoutDescriptor { entries: &[BindGroupLayoutEntry { @@ -372,7 +373,7 @@ impl UiRenderNode { ty: BindingType::Buffer { ty: BufferBindingType::Storage { read_only: true }, has_dynamic_offset: false, - min_binding_size: std::num::NonZero::new(stride), + min_binding_size: BufferSize::new(stride), }, count: None, }],