From 5fb5719cdcfbf3adfcb3b3b49076823d9f62bf79 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 12 Nov 2024 10:22:00 -0500 Subject: [PATCH] diag: add `CreateBindGroupError::InvalidTextureSampleType::view_sample_type` --- CHANGELOG.md | 1 + tests/tests/float32_filterable.rs | 6 +++++- wgpu-core/src/binding_model.rs | 9 ++++++++- wgpu-core/src/device/resource.rs | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85e81fe9b..36f88095f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -113,6 +113,7 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148] #### General - 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 diff --git a/tests/tests/float32_filterable.rs b/tests/tests/float32_filterable.rs index cc1ccd5a2..574c07c93 100644 --- a/tests/tests/float32_filterable.rs +++ b/tests/tests/float32_filterable.rs @@ -63,7 +63,11 @@ static FLOAT32_FILTERABLE_WITHOUT_FEATURE: GpuTestConfiguration = GpuTestConfigu || { 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 })" + )), ); }); diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index 8906b5875..f1acb9b6f 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -142,11 +142,18 @@ pub enum CreateBindGroupError { layout_multisampled: bool, 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 { binding: u32, layout_sample_type: wgt::TextureSampleType, 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:?}")] InvalidTextureDimension { diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index afbf73bc0..2c511baa5 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -2519,6 +2519,7 @@ impl Device { binding, layout_sample_type: sample_type, view_format: view.desc.format, + view_sample_type: compat_sample_type, }) } }