Skip to content

Commit

Permalink
Validate DownlevelFlags::READ_ONLY_DEPTH_STENCIL (#4031)
Browse files Browse the repository at this point in the history
  • Loading branch information
teoxoy authored Aug 11, 2023
1 parent 0d233b4 commit c7da76a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ By @Valaphee in [#3402](https://github.com/gfx-rs/wgpu/pull/3402)
### Changes

- Omit texture store bound checks since they are no-ops if out of bounds on all APIs. By @teoxoy in [#3975](https://github.com/gfx-rs/wgpu/pull/3975)
- Validate `DownlevelFlags::READ_ONLY_DEPTH_STENCIL`. By @teoxoy in [#4031](https://github.com/gfx-rs/wgpu/pull/4031)

### Bug Fixes

Expand Down
8 changes: 7 additions & 1 deletion wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,13 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> {

(is_depth_read_only, is_stencil_read_only) = at.depth_stencil_read_only(ds_aspects)?;

let usage = if is_depth_read_only && is_stencil_read_only {
let usage = if is_depth_read_only
&& is_stencil_read_only
&& device
.downlevel
.flags
.contains(wgt::DownlevelFlags::READ_ONLY_DEPTH_STENCIL)
{
hal::TextureUses::DEPTH_STENCIL_READ | hal::TextureUses::RESOURCE
} else {
hal::TextureUses::DEPTH_STENCIL_WRITE
Expand Down
4 changes: 2 additions & 2 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1269,8 +1269,8 @@ bitflags::bitflags! {
const INDIRECT_EXECUTION = 1 << 2;
/// Supports non-zero `base_vertex` parameter to indexed draw calls.
const BASE_VERTEX = 1 << 3;
/// Supports reading from a depth/stencil buffer while using as a read-only depth/stencil
/// attachment.
/// Supports reading from a depth/stencil texture while using it as a read-only
/// depth/stencil attachment.
///
/// The WebGL2 and GLES backends do not support RODS.
const READ_ONLY_DEPTH_STENCIL = 1 << 4;
Expand Down

0 comments on commit c7da76a

Please sign in to comment.