Bug 256724

Summary: [WebGPU][WGSL] sampling a texture_external should expand to two samples
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-05-12 11:27:07 PDT
In WGSL if we have:

  texture_external t;
  vec4<f32> result = textureSampleBaseClampToEdge(t, sampler, normalizedCoordinates);

or:

  texture_external t;
  vec4<f32> result = textureLoad(t, pixelCoordinates, levelOfDetail);


we should expand this to:

    auto coords = t_UVRemapMatrix * normalizedCoordinates;
    auto y = t_FirstPlane.sample(sampler, coords).r;
    auto cbcr = t_SecondPlane.sample(sampler, coords).rg;
    auto ycbcr = float3(y, cbcr);
    float4 result = float4(t_ColorSpaceConversionMatrix * float4(ycbcr, 1), 1);
    

or:
   
    auto coords = t_UVRemapMatrix * pixelCoordinates;
    auto y = t_FirstPlane.read(coords, levelOfDetail).r;
    auto cbcr = t_SecondPlane.read(sampler, levelOfDetail).rg;
    auto ycbcr = float3(y, cbcr);
    float4 result = float4(t_ColorSpaceConversionMatrix * float4(ycbcr, 1), 1);
Comment 1 Radar WebKit Bug Importer 2023-05-12 11:27:32 PDT
<rdar://problem/109273173>
Comment 2 Tadeu Zagallo 2023-05-16 05:49:50 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13916
Comment 3 EWS 2023-05-17 02:52:00 PDT
Committed 264141@main (6c82c6b0b152): <https://commits.webkit.org/264141@main>

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