From e59fb7d423997447bc5c2ceff14a015c901ee186 Mon Sep 17 00:00:00 2001 From: Andy Leiserson Date: Thu, 12 Feb 2026 05:29:56 -0800 Subject: [PATCH] fix(core): Calculate total number of bindings correctly (#8997) --- CHANGELOG.md | 1 + cts_runner/fail.lst | 4 ++-- cts_runner/test.lst | 8 ++++++++ wgpu-core/src/binding_model.rs | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ff1b0050..f269e2215 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -125,6 +125,7 @@ By @cwfitzgerald in [#8999](https://github.com/gfx-rs/wgpu/pull/8999). - Check that depth bias is not used with non-triangle topologies. By @andyleiserson in [#8856](https://github.com/gfx-rs/wgpu/pull/8856). - Check that if the shader outputs `frag_depth`, then the pipeline must have a depth attachment. By @andyleiserson in [#8856](https://github.com/gfx-rs/wgpu/pull/8856). - Fix incorrect acceptance of some swizzle selectors that are not valid for their operand, e.g. `const v = vec2(); let r = v.xyz`. By @andyleiserson in [#8949](https://github.com/gfx-rs/wgpu/pull/8949). +- Fixed calculation of the total number of bindings in a pipeline layout when validating against device limits. By @andyleiserson in [#8997](https://github.com/gfx-rs/wgpu/pull/8997). #### GLES diff --git a/cts_runner/fail.lst b/cts_runner/fail.lst index cae12c090..a7e3c93f7 100644 --- a/cts_runner/fail.lst +++ b/cts_runner/fail.lst @@ -22,8 +22,8 @@ webgpu:api,validation,createBindGroup:buffer,resource_state:* // 0%, https://git webgpu:api,validation,createBindGroup:external_texture,* // 0%, no external external texture in deno webgpu:api,validation,createBindGroup:texture,resource_state:* // crash, https://github.com/gfx-rs/wgpu/issues/7881 webgpu:api,validation,createBindGroupLayout:max_dynamic_buffers:* // fails on vulkan -webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:* -webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:* // 0%, using max() instead of += +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_bind_group_layout:* // https://github.com/gfx-rs/wgpu/issues/8748 +webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:* // metal, https://github.com/gfx-rs/wgpu/issues/8173 webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_buffer_type:* // 25%, writable storage buffers not allowed in VERTEX webgpu:api,validation,createBindGroupLayout:visibility,VERTEX_shader_stage_storage_texture_access:* // 25%, write-access storage textures not allowed in VERTEX webgpu:api,validation,createBindGroupLayout:visibility:* // 25%, missing per-stage storage limits diff --git a/cts_runner/test.lst b/cts_runner/test.lst index 6b72f4de2..7110af3b3 100644 --- a/cts_runner/test.lst +++ b/cts_runner/test.lst @@ -94,6 +94,14 @@ webgpu:api,validation,createBindGroup:texture_must_have_correct_component_type:* webgpu:api,validation,createBindGroup:texture_must_have_correct_dimension:* webgpu:api,validation,createBindGroupLayout:duplicate_bindings:* fails-if(vulkan) webgpu:api,validation,createBindGroupLayout:max_dynamic_buffers:* +fails-if(vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"sampler":{"type":"comparison"}} +fails-if(vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"sampler":{"type":"filtering"}} +fails-if(vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"sampler":{"type":"non-filtering"}} +fails-if(dx12,vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"storageTexture":{"access":"read-only","format":"r32float"}} +fails-if(dx12,vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"storageTexture":{"access":"read-write","format":"r32float"}} +fails-if(dx12,vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"storageTexture":{"access":"write-only","format":"r32float"}} +fails-if(dx12,vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"texture":{"multisampled":false,"sampleType":"unfilterable-float"}} +fails-if(dx12,vulkan) webgpu:api,validation,createBindGroupLayout:max_resources_per_stage,in_pipeline_layout:maxedEntry={"texture":{"multisampled":true,"sampleType":"unfilterable-float"}} webgpu:api,validation,createBindGroupLayout:maximum_binding_limit:* webgpu:api,validation,createBindGroupLayout:multisampled_validation:* webgpu:api,validation,createBindGroupLayout:storage_texture,formats:* diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index f1508be85..ee009935e 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -398,9 +398,9 @@ impl PerStageBindingTypeCounter { } pub(crate) fn merge(&mut self, other: &Self) { - self.vertex = self.vertex.max(other.vertex); - self.fragment = self.fragment.max(other.fragment); - self.compute = self.compute.max(other.compute); + self.vertex += other.vertex; + self.fragment += other.fragment; + self.compute += other.compute; } pub(crate) fn validate(