Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add actual sample type to CreateBindGroupError::InvalidTextureSampleType output #6530

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,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 was 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 was 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