diag: add CreateBindGroupError::InvalidTextureSampleType::view_sample_type

This commit is contained in:
Erich Gubler 2024-11-12 10:22:00 -05:00
parent ae6c6fbea4
commit 5fb5719cdc
4 changed files with 15 additions and 2 deletions

View File

@ -113,6 +113,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148]
#### General #### General
- Make `Surface::as_hal` take an immutable reference to the surface. By @jerzywilczek in [#9999](https://github.com/gfx-rs/wgpu/pull/9999) - Make `Surface::as_hal` take an immutable reference to the surface. By @jerzywilczek in [#9999](https://github.com/gfx-rs/wgpu/pull/9999)
- Add actual sample type to `CreateBindGroupError::InvalidTextureSampleType` error message. By @ErichDonGubler in [#6530](https://github.com/gfx-rs/wgpu/pull/6530).
#### HAL #### HAL

View File

@ -63,7 +63,11 @@ static FLOAT32_FILTERABLE_WITHOUT_FEATURE: GpuTestConfiguration = GpuTestConfigu
|| { || {
create_texture_binding(device, wgpu::TextureFormat::R32Float, true); create_texture_binding(device, wgpu::TextureFormat::R32Float, true);
}, },
Some("texture binding 0 expects sample type = float { filterable: true }, but given a view with format = r32float"), Some(concat!(
"texture binding 0 expects sample type = float { filterable: true }, ",
"but given a view with format = r32float ",
"(sample type = float { filterable: false })"
)),
); );
}); });

View File

@ -142,11 +142,18 @@ pub enum CreateBindGroupError {
layout_multisampled: bool, layout_multisampled: bool,
view_samples: u32, view_samples: u32,
}, },
#[error("Texture binding {binding} expects sample type = {layout_sample_type:?}, but given a view with format = {view_format:?}")] #[error(
"Texture binding {} expects sample type = {:?}, but given a view with format = {:?} (sample type = {:?})",
binding,
layout_sample_type,
view_format,
view_sample_type
)]
InvalidTextureSampleType { InvalidTextureSampleType {
binding: u32, binding: u32,
layout_sample_type: wgt::TextureSampleType, layout_sample_type: wgt::TextureSampleType,
view_format: wgt::TextureFormat, view_format: wgt::TextureFormat,
view_sample_type: wgt::TextureSampleType,
}, },
#[error("Texture binding {binding} expects dimension = {layout_dimension:?}, but given a view with dimension = {view_dimension:?}")] #[error("Texture binding {binding} expects dimension = {layout_dimension:?}, but given a view with dimension = {view_dimension:?}")]
InvalidTextureDimension { InvalidTextureDimension {

View File

@ -2519,6 +2519,7 @@ impl Device {
binding, binding,
layout_sample_type: sample_type, layout_sample_type: sample_type,
view_format: view.desc.format, view_format: view.desc.format,
view_sample_type: compat_sample_type,
}) })
} }
} }