Skip to content

Commit

Permalink
diag: add `CreateBindGroupError::InvalidTextureSampleType::view_sampl…
Browse files Browse the repository at this point in the history
…e_type`
  • Loading branch information
ErichDonGubler committed Nov 13, 2024
1 parent ae6c6fb commit 5fb5719
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion tests/tests/float32_filterable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })"
)),
);
});

Expand Down
9 changes: 8 additions & 1 deletion wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2519,6 +2519,7 @@ impl Device {
binding,
layout_sample_type: sample_type,
view_format: view.desc.format,
view_sample_type: compat_sample_type,
})
}
}
Expand Down

0 comments on commit 5fb5719

Please sign in to comment.