buffer size mismatch: more detail in error message (#5858)

* buffer size mismatch: more detail in error message

* wrong buffer size: change name of fields
This commit is contained in:
Christofer Nolander 2024-07-01 13:10:37 +02:00 committed by GitHub
parent 9d12a0a122
commit c9a2d972ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -147,8 +147,11 @@ pub enum BindingError {
binding: naga::AddressSpace, binding: naga::AddressSpace,
shader: 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`")] #[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(wgt::BufferSize), WrongBufferSize {
buffer_size: wgt::BufferSize,
min_binding_size: wgt::BufferSize,
},
#[error("View dimension {dim:?} (is array: {is_array}) doesn't match the binding {binding:?}")] #[error("View dimension {dim:?} (is array: {is_array}) doesn't match the binding {binding:?}")]
WrongTextureViewDimension { WrongTextureViewDimension {
dim: naga::ImageDimension, dim: naga::ImageDimension,
@ -385,7 +388,10 @@ impl Resource {
}; };
match min_size { match min_size {
Some(non_zero) if non_zero < 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,
})
} }
_ => (), _ => (),
} }