yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

davli-nvImplement SPV_EXT_fragment_invocation_density (SPV_NV_shading_rate) (#8037)83675103a

master
959 B25 linesraw
1//TEST:SIMPLE(filecheck=CHECK-SPIRV): -target spirv -stage fragment -entry main
2//TEST:SIMPLE(filecheck=CHECK-GLSL): -target glsl -stage fragment -entry main
3
4// Test for SPV_EXT_fragment_invocation_density support (SV_FragSize and SV_FragInvocationCount)
5
6struct FragmentInput
7{
8    int2 fragmentSize : SV_FragSize;
9    int invocationsPerPixel : SV_FragInvocationCount;
10}
11
12[shader("fragment")]
13float4 main(FragmentInput input) : SV_Target
14{
15    // CHECK-SPIRV: OpCapability FragmentDensityEXT
16    // CHECK-SPIRV: OpExtension "SPV_EXT_fragment_invocation_density"
17    // CHECK-SPIRV-DAG: OpDecorate {{.*}} BuiltIn FragSizeEXT
18    // CHECK-SPIRV-DAG: OpDecorate {{.*}} BuiltIn FragInvocationCountEXT
19
20    // CHECK-GLSL: #extension GL_EXT_fragment_invocation_density : require
21    // CHECK-GLSL-DAG: gl_FragSizeEXT
22    // CHECK-GLSL-DAG: gl_FragInvocationCountEXT
23
24    return float4(input.fragmentSize.x, input.fragmentSize.y, input.invocationsPerPixel, 1.0);
25}