Skip to content

Implement depth-clip-control using depthClamp#3892

Merged
cwfitzgerald merged 1 commit intogfx-rs:trunkfrom
AlbinBernhardssonARM:depth-clip-control
Jun 29, 2023
Merged

Implement depth-clip-control using depthClamp#3892
cwfitzgerald merged 1 commit intogfx-rs:trunkfrom
AlbinBernhardssonARM:depth-clip-control

Conversation

@AlbinBernhardssonARM
Copy link
Copy Markdown
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
Copy Markdown
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