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

Validate DownlevelFlags::READ_ONLY_DEPTH_STENCIL #4031

Merged
merged 3 commits into from
Aug 11, 2023
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 @@ -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 @@ -1270,8 +1270,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