Skip to content

Commit

Permalink
reject binding type multisampled when on a float filterable sample ty…
Browse files Browse the repository at this point in the history
…pe (#3686)
  • Loading branch information
mockersf authored Apr 13, 2023
1 parent af3b29a commit 7c25c00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ By @cwfitzgerald in [#3671](https://github.com/gfx-rs/wgpu/pull/3671).
- Make error descriptions all upper case. By @cwfitzgerald in [#3549](https://github.com/gfx-rs/wgpu/pull/3549)
- Don't include ANSI terminal color escape sequences in shader module validation error messages. By @jimblandy in [#3591](https://github.com/gfx-rs/wgpu/pull/3591)
- Report error messages from DXC compile. By @Davidster in [#3632](https://github.com/gfx-rs/wgpu/pull/3632)
- Error in native when using a filterable `TextureSampleType::Float` on a multisample `BindingType::Texture`. By @mockersf in [#3686](https://github.com/gfx-rs/wgpu/pull/3686)

#### WebGPU

Expand Down
2 changes: 2 additions & 0 deletions wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ pub enum BindGroupLayoutEntryError {
StorageTextureReadWrite,
#[error("Arrays of bindings unsupported for this type of binding")]
ArrayUnsupported,
#[error("Multisampled binding with sample type `TextureSampleType::Float` must have filterable set to false.")]
SampleTypeFloatFilterableBindingMultisampled,
#[error(transparent)]
MissingFeatures(#[from] MissingFeatures),
#[error(transparent)]
Expand Down
12 changes: 11 additions & 1 deletion wgpu-core/src/device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use hal::{CommandEncoder as _, Device as _};
use parking_lot::{Mutex, MutexGuard};
use smallvec::SmallVec;
use thiserror::Error;
use wgt::{BufferAddress, TextureFormat, TextureViewDimension};
use wgt::{BufferAddress, TextureFormat, TextureSampleType, TextureViewDimension};

use std::{borrow::Cow, iter, mem, num::NonZeroU32, ops::Range, ptr};

Expand Down Expand Up @@ -1694,6 +1694,16 @@ impl<A: HalApi> Device<A> {
Some(wgt::Features::TEXTURE_BINDING_ARRAY),
WritableStorage::No,
),
Bt::Texture {
multisampled: true,
sample_type: TextureSampleType::Float { filterable: true },
..
} => {
return Err(binding_model::CreateBindGroupLayoutError::Entry {
binding: entry.binding,
error: binding_model::BindGroupLayoutEntryError::SampleTypeFloatFilterableBindingMultisampled,
});
}
Bt::Texture { .. } => (
Some(wgt::Features::TEXTURE_BINDING_ARRAY),
WritableStorage::No,
Expand Down

0 comments on commit 7c25c00

Please sign in to comment.