From c9a2d972ad40ca325ccc1aba71767040a51c7c11 Mon Sep 17 00:00:00 2001 From: Christofer Nolander Date: Mon, 1 Jul 2024 13:10:37 +0200 Subject: [PATCH] buffer size mismatch: more detail in error message (#5858) * buffer size mismatch: more detail in error message * wrong buffer size: change name of fields --- wgpu-core/src/validation.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index bb02f279a..0df843128 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -147,8 +147,11 @@ pub enum BindingError { binding: naga::AddressSpace, shader: naga::AddressSpace, }, - #[error("Buffer structure size {0}, added to one element of an unbound array, if it's the last field, ended up greater than the given `min_binding_size`")] - WrongBufferSize(wgt::BufferSize), + #[error("Buffer structure size {buffer_size}, added to one element of an unbound array, if it's the last field, ended up greater than the given `min_binding_size`, which is {min_binding_size}")] + WrongBufferSize { + buffer_size: wgt::BufferSize, + min_binding_size: wgt::BufferSize, + }, #[error("View dimension {dim:?} (is array: {is_array}) doesn't match the binding {binding:?}")] WrongTextureViewDimension { dim: naga::ImageDimension, @@ -385,7 +388,10 @@ impl Resource { }; match min_size { Some(non_zero) if non_zero < size => { - return Err(BindingError::WrongBufferSize(size)) + return Err(BindingError::WrongBufferSize { + buffer_size: size, + min_binding_size: non_zero, + }) } _ => (), }