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

Implement depth-clip-control using depthClamp #3892

Merged
merged 1 commit into from
Jun 29, 2023

Conversation

AlbinBernhardssonARM
Copy link
Contributor

@AlbinBernhardssonARM AlbinBernhardssonARM commented Jun 28, 2023

Checklist

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

Description
In Vulkan, use depthClamp instead of VK_EXT_depth_clip_enable to implement depth-clip-control (unclipped_depth). depthClamp implicitly disables clipping in addition to enabling clamping (27.4. Primitive Clipping in Vulkan spec). Enabling clamping is fine as clamping depth should always be done according to WebGPU spec (23.3.6. Fragment Processing).

depthClamp is more widely supported than VK_EXT_depth_clip_enable (85.94% vs. 38.42% according to vulkan.gpuinfo.org) so this enables depth-clip-control on more devices.

Testing
Ran shadow example.
Ran DepthClamping unit test in https://github.com/Chainsawkitten/HymnToBeauty/ (requires gfx-rs/wgpu-native#270).

Use depthClamp instead of VK_EXT_depth_clip_enable to implement
depth-clip-control (unclipped_depth). depthClamp implicitly disables
clipping and is more widely supported.
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Good stuff!

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.

2 participants