From b1bf444b7a331353cc4703c474c3ce6fd1ecdae8 Mon Sep 17 00:00:00 2001 From: Lisitsa Nikita Date: Sat, 9 Aug 2025 18:48:11 +0300 Subject: [PATCH] Fix error message when render pipeline vertex attribute location is greater or equal to the maximum number of vertex attributes (fixes #8064) (#8065) --- wgpu-core/src/device/resource.rs | 2 +- wgpu-core/src/pipeline.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index eed295bdf..a7cacea59 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -3697,7 +3697,7 @@ impl Device { if attribute.shader_location >= self.limits.max_vertex_attributes { return Err( - pipeline::CreateRenderPipelineError::TooManyVertexAttributes { + pipeline::CreateRenderPipelineError::VertexAttributeLocationTooLarge { given: attribute.shader_location, limit: self.limits.max_vertex_attributes, }, diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index f67cc65e2..580fdc4d9 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -624,6 +624,8 @@ pub enum CreateRenderPipelineError { TooManyVertexBuffers { given: u32, limit: u32 }, #[error("The total number of vertex attributes {given} exceeds the limit {limit}")] TooManyVertexAttributes { given: u32, limit: u32 }, + #[error("Vertex attribute location {given} must be less than limit {limit}")] + VertexAttributeLocationTooLarge { given: u32, limit: u32 }, #[error("Vertex buffer {index} stride {given} exceeds the limit {limit}")] VertexStrideTooLarge { index: u32, given: u32, limit: u32 }, #[error("Vertex attribute at location {location} stride {given} exceeds the limit {limit}")] @@ -708,6 +710,7 @@ impl WebGpuError for CreateRenderPipelineError { | Self::InvalidSampleCount(_) | Self::TooManyVertexBuffers { .. } | Self::TooManyVertexAttributes { .. } + | Self::VertexAttributeLocationTooLarge { .. } | Self::VertexStrideTooLarge { .. } | Self::UnalignedVertexStride { .. } | Self::InvalidVertexAttributeOffset { .. }