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

Web: handle None for depth_ops and stencil_ops #3660

Merged
merged 3 commits into from Apr 10, 2023

Conversation

niklaskorz
Copy link
Contributor

@niklaskorz niklaskorz commented Apr 8, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories

There's no corresponding issue yet (should I create one?).

More or less depends on #3657 (at least to see the result), here's a branch merging both fixes for testing: https://github.com/niklaskorz/wgpu/tree/dynamic-dispatch-depth-fix

Description
Describe what problem this is solving, and how it's solved.

When using a DepthStencilState with a texture that only includes depth but not stencil data (e.g., TextureFormat::Depth32Float instead of TextureFormat::Depth24PlusStencil8), and then specifying stencil_ops: None in the RenderPassDepthStencilAttachment, Chrome Beta 113 reports the following:

stencilLoadOp is (LoadOp::Load) and stencilStoreOp is (StoreOp::Store) when stencilReadOnly (0) or the attachment ([TextureView of Texture "depth_texture"]) has no stencil aspect.
 - While validating depthStencilAttachment.
 - While encoding [CommandEncoder "encoder"].BeginRenderPass([RenderPassDescriptor "rpass"]).

This is fixed by not defining any stencil parameters on the web_sys::GpuRenderPassDepthStencilAttachment when stencil_ops is None.

Testing
Explain how this change is tested.

Tested on my project https://github.com/niklaskorz/linon using Chrome Beta 113 (see branch dynamic-dispatch-workaround, deployed on https://niklaskorz.github.io/linon/).

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the PR!

@teoxoy teoxoy merged commit 2c37608 into gfx-rs:trunk Apr 10, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants