Bug 263393

Summary: [WGSL] frag_depth on return value does not generate depth(any) attribution
Product: WebKit Reporter: Mike Wyrzykowski <mwyrzykowski>
Component: WebGPUAssignee: Tadeu Zagallo <tzagallo>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Mike Wyrzykowski 2023-10-19 13:04:14 PDT
Given the following shader:

            @group(0) @binding(0) var inputTexture: texture_2d<f32>;
            @fragment fn main(@builtin(position) fragcoord : vec4<f32>) ->
              @builtin(frag_depth) f32 {
              var depthValue : vec4<f32> = textureLoad(inputTexture, vec2<i32>(fragcoord.xy), 0);
              return depthValue.x;
            }

@builtin(frag_depth) appears to be ignored when the metal code is generated:


[[fragment]] float function0(vec<float, 4> parameter0 [[position]], constant __ArgumentBufferT_0& __ArgumentBuffer_0 [[buffer(0)]])
{
    texture2d<float, access::sample> global0 = __ArgumentBuffer_0.global0;
    vec<float, 4> local0 = global0.read(uint2(vec<int, 2>(parameter0.xy)), 0);
    return local0.x;
}
Comment 1 Radar WebKit Bug Importer 2023-10-19 13:04:37 PDT
<rdar://problem/117221582>
Comment 2 Tadeu Zagallo 2023-10-27 06:05:20 PDT
Pull request: https://github.com/WebKit/WebKit/pull/19635
Comment 3 EWS 2023-10-30 09:42:20 PDT
Committed 269950@main (fbd53e5fa81a): <https://commits.webkit.org/269950@main>

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