Merge pull request #2891 from dneto0/hlsl-namespace
[platform/upstream/glslang.git] / Test / spv.computeShaderDerivatives.comp
1 #version 450
2 #extension GL_NV_compute_shader_derivatives : require
3
4 layout (local_size_x = 2, local_size_y = 4) in;
5 layout(derivative_group_quadsNV) in;
6
7 buffer block {
8   float fDerivativeX;
9   float fDerivativeY;
10   float fDerivativeWidth;
11   float fCoarseDerivativeX;
12   float fCoarseDerivativeY;
13   float fCoarseDerivativeWidth;
14   float fFineDerivativeX;
15   float fFineDerivativeY;
16   float fFineDerivativeWidth;
17   
18   float fX;
19   float fY;
20   
21   
22   vec2 v2DerivativeX;
23   vec2 v2DerivativeY;
24   vec2 v2DerivativeWidth;
25   vec2 v2CoarseDerivativeX;
26   vec2 v2CoarseDerivativeY;
27   vec2 v2CoarseDerivativeWidth;
28   vec2 v2FineDerivativeX;
29   vec2 v2FineDerivativeY;
30   vec2 v2FineDerivativeWidth;
31   
32   vec2 v2X;
33   vec2 v2Y;
34   
35   
36   vec3 v3DerivativeX;
37   vec3 v3DerivativeY;
38   vec3 v3DerivativeWidth;
39   vec3 v3CoarseDerivativeX;
40   vec3 v3CoarseDerivativeY;
41   vec3 v3CoarseDerivativeWidth;
42   vec3 v3FineDerivativeX;
43   vec3 v3FineDerivativeY;
44   vec3 v3FineDerivativeWidth;
45   
46   vec3 v3X;
47   vec3 v3Y;
48   
49   
50   vec4 v4DerivativeX;
51   vec4 v4DerivativeY;
52   vec4 v4DerivativeWidth;
53   vec4 v4CoarseDerivativeX;
54   vec4 v4CoarseDerivativeY;
55   vec4 v4CoarseDerivativeWidth;
56   vec4 v4FineDerivativeX;
57   vec4 v4FineDerivativeY;
58   vec4 v4FineDerivativeWidth;
59   
60   vec4 v4X;
61   vec4 v4Y;
62 };
63
64 void main(){
65     fDerivativeX = dFdx(fX);
66     fDerivativeY = dFdy(fY);
67     fDerivativeWidth = fwidth(fX);
68     fCoarseDerivativeX = dFdxCoarse(fX);
69     fCoarseDerivativeY = dFdyCoarse(fY);
70     fCoarseDerivativeWidth = fwidthCoarse(fX);
71     fFineDerivativeX = dFdxFine(fX);
72     fFineDerivativeY = dFdyFine(fY);
73     fFineDerivativeWidth = fwidthFine(fX);
74
75     v2DerivativeX = dFdx(v2X);
76     v2DerivativeY = dFdy(v2Y);
77     v2DerivativeWidth = fwidth(v2X);
78     v2CoarseDerivativeX = dFdxCoarse(v2X);
79     v2CoarseDerivativeY = dFdyCoarse(v2Y);
80     v2CoarseDerivativeWidth = fwidthCoarse(v2X);
81     v2FineDerivativeX = dFdxFine(v2X);
82     v2FineDerivativeY = dFdyFine(v2Y);
83     v2FineDerivativeWidth = fwidthFine(v2X);
84
85
86     v3DerivativeX = dFdx(v3X);
87     v3DerivativeY = dFdy(v3Y);
88     v3DerivativeWidth = fwidth(v3X);
89     v3CoarseDerivativeX = dFdxCoarse(v3X);
90     v3CoarseDerivativeY = dFdyCoarse(v3Y);
91     v3CoarseDerivativeWidth = fwidthCoarse(v3X);
92     v3FineDerivativeX = dFdxFine(v3X);
93     v3FineDerivativeY = dFdyFine(v3Y);
94     v3FineDerivativeWidth = fwidthFine(v3X);
95
96
97     v4DerivativeX = dFdx(v4X);
98     v4DerivativeY = dFdy(v4Y);
99     v4DerivativeWidth = fwidth(v4X);
100     v4CoarseDerivativeX = dFdxCoarse(v4X);
101     v4CoarseDerivativeY = dFdyCoarse(v4Y);
102     v4CoarseDerivativeWidth = fwidthCoarse(v4X);
103     v4FineDerivativeX = dFdxFine(v4X);
104     v4FineDerivativeY = dFdyFine(v4Y);
105     v4FineDerivativeWidth = fwidthFine(v4X);
106 }