summaryrefslogtreecommitdiffstats
path: root/tests/spirv/fragment-invocation-density.slang
blob: f26b403ec232974eb7ed1829d295830125bf9b73 (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
//TEST:SIMPLE(filecheck=CHECK-SPIRV): -target spirv -stage fragment -entry main
//TEST:SIMPLE(filecheck=CHECK-GLSL): -target glsl -stage fragment -entry main

// Test for SPV_EXT_fragment_invocation_density support (SV_FragSize and SV_FragInvocationCount)

struct FragmentInput
{
    int2 fragmentSize : SV_FragSize;
    int invocationsPerPixel : SV_FragInvocationCount;
}

[shader("fragment")]
float4 main(FragmentInput input) : SV_Target
{
    // CHECK-SPIRV: OpCapability FragmentDensityEXT
    // CHECK-SPIRV: OpExtension "SPV_EXT_fragment_invocation_density"
    // CHECK-SPIRV-DAG: OpDecorate {{.*}} BuiltIn FragSizeEXT
    // CHECK-SPIRV-DAG: OpDecorate {{.*}} BuiltIn FragInvocationCountEXT

    // CHECK-GLSL: #extension GL_EXT_fragment_invocation_density : require
    // CHECK-GLSL-DAG: gl_FragSizeEXT
    // CHECK-GLSL-DAG: gl_FragInvocationCountEXT

    return float4(input.fragmentSize.x, input.fragmentSize.y, input.invocationsPerPixel, 1.0);
}