Bug 264449 - [WebGPU] Clamp depth values to the viewport range
Summary: [WebGPU] Clamp depth values to the viewport range
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-11-08 16:13 PST by Mike Wyrzykowski
Modified: 2024-02-16 11:03 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Wyrzykowski 2023-11-08 16:13:03 PST
[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);
}
Comment 1 Radar WebKit Bug Importer 2023-11-08 16:13:20 PST
<rdar://problem/118144869>
Comment 2 Mike Wyrzykowski 2024-02-07 14:50:42 PST
Pull request: https://github.com/WebKit/WebKit/pull/24039
Comment 3 EWS 2024-02-14 15:12:12 PST
Committed 274666@main (d8d655468dab): <https://commits.webkit.org/274666@main>

Reviewed commits have been landed. Closing PR #24039 and removing active labels.
Comment 4 Mike Wyrzykowski 2024-02-15 13:07:03 PST
Reverted by https://github.com/WebKit/WebKit/pull/24536
Comment 5 Mike Wyrzykowski 2024-02-15 13:07:04 PST
Pull request: https://github.com/WebKit/WebKit/pull/24536
Comment 6 EWS 2024-02-15 14:54:32 PST
Committed 274769@main (b9e6095447e8): <https://commits.webkit.org/274769@main>

Reviewed commits have been landed. Closing PR #24536 and removing active labels.
Comment 7 Mike Wyrzykowski 2024-02-15 15:46:35 PST
Re-opening for pull request https://github.com/WebKit/WebKit/pull/24558
Comment 8 EWS 2024-02-16 11:03:49 PST
Committed 274856@main (57f26e7cc5c4): <https://commits.webkit.org/274856@main>

Reviewed commits have been landed. Closing PR #24558 and removing active labels.