summaryrefslogtreecommitdiffstats
path: root/tests/pipeline/rasterization/fragment-shader-interlock-child-function.slang
blob: 65dc39bdcd2af8c71214ba92bf48b36a19492639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment

RasterizerOrderedTexture2D<float4> texture;

//
// Tests that an interlock region place at a non-entry point function will properly apply the SPIRV execution mode
// to the entry point function and not the child function.
//

// CHECK: OpEntryPoint
// CHECK: OpExecutionMode %main PixelInterlockOrderedEXT

float4 foo(float4 coords)
{
    float4 result;

    beginInvocationInterlock();
    {
        result = texture[uint2(coords.xy)];
        texture[uint2(coords.xy)] = result + coords;
    }
    endInvocationInterlock();

    return result;
}

[shader("fragment")]
float4 main(float4 coords : COORDS) : SV_Target
{
    return foo(coords);
}