| Summary: | [WebGPU] Clamp depth values to the viewport range | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Mike Wyrzykowski <mwyrzykowski> |
| Component: | WebGPU | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Pull request: https://github.com/WebKit/WebKit/pull/24039 Committed 274666@main (d8d655468dab): <https://commits.webkit.org/274666@main> Reviewed commits have been landed. Closing PR #24039 and removing active labels. Reverted by https://github.com/WebKit/WebKit/pull/24536 Pull request: https://github.com/WebKit/WebKit/pull/24536 Committed 274769@main (b9e6095447e8): <https://commits.webkit.org/274769@main> Reviewed commits have been landed. Closing PR #24536 and removing active labels. Re-opening for pull request https://github.com/WebKit/WebKit/pull/24558 Committed 274856@main (57f26e7cc5c4): <https://commits.webkit.org/274856@main> Reviewed commits have been landed. Closing PR #24558 and removing active labels. |
[WGSL] Emit code gen for clamping depth to the viewport This only impacts when frag_depth / ([[depth(any)]] ) is used in the shader. Something like this I think would work: struct FragOutput { ... float depthValue [[depth(any)]]; }; void fragmentShader(const constant unsigned* __DynamicOffsets [[buffer(4)]]) { FragOutput o; ... float minDepth = as_type<float>(__DynamicOffsets[maxDynamicOffsetIndex + 1]); float maxDepth = as_type<float>(__DynamicOffsets[maxDynamicOffsetIndex + 2]); o.depthValue = clamp(o.depthValue, minDepth, maxDepth); }