EndStreamPrimitive not supported when there is #extension GL_ARB_gpu_shader5
[platform/upstream/glslang.git] / Test / spv.sparseTextureClamp.frag
1 #version 450\r
2 #extension GL_ARB_sparse_texture_clamp: enable\r
3 \r
4 uniform sampler2D               s2D;\r
5 uniform sampler3D               s3D;\r
6 uniform sampler2DShadow         s2DShadow;\r
7 uniform samplerCubeShadow       sCubeShadow;\r
8 uniform sampler2DArrayShadow    s2DArrayShadow;\r
9 uniform sampler2DRectShadow     s2DRectShadow;\r
10 uniform samplerCubeArrayShadow  sCubeArrayShadow;\r
11 \r
12 uniform isamplerCube            isCube;\r
13 uniform isampler2DArray         is2DArray;\r
14 \r
15 uniform usamplerCubeArray       usCubeArray;\r
16 uniform usampler2DRect          us2DRect;\r
17 \r
18 in vec2 c2;\r
19 in vec3 c3;\r
20 in vec4 c4;\r
21 \r
22 in float lodClamp;\r
23 \r
24 out vec4 outColor;\r
25 \r
26 void main()\r
27 {\r
28     int   resident = 0;\r
29     vec4  texel  = vec4(0.0);\r
30     ivec4 itexel = ivec4(0);\r
31     uvec4 utexel = uvec4(0);\r
32 \r
33     resident |= sparseTextureClampARB(s2D, c2, lodClamp, texel);\r
34     resident |= sparseTextureClampARB(s3D, c3, lodClamp, texel, 2.0);\r
35     resident |= sparseTextureClampARB(isCube, c3, lodClamp, itexel);\r
36     resident |= sparseTextureClampARB(s2DShadow, c3, lodClamp, texel.x);\r
37     resident |= sparseTextureClampARB(sCubeArrayShadow, c4, 1.0, lodClamp, texel.x);\r
38 \r
39     texel   += textureClampARB(s2D, c2, lodClamp);\r
40     texel   += textureClampARB(s3D, c3, lodClamp, 2.0);\r
41     itexel  += textureClampARB(isCube, c3, lodClamp);\r
42     texel.x += textureClampARB(s2DShadow, c3, lodClamp);\r
43     texel.x += textureClampARB(sCubeArrayShadow, c4, 1.0, lodClamp);\r
44 \r
45     resident |= sparseTextureOffsetClampARB(s3D, c3, ivec3(2), lodClamp, texel, 2.0);\r
46     resident |= sparseTextureOffsetClampARB(us2DRect, c2, ivec2(3), lodClamp, utexel);\r
47     resident |= sparseTextureOffsetClampARB(s2DArrayShadow, c4, ivec2(5), lodClamp, texel.z);\r
48 \r
49     texel   += textureOffsetClampARB(s3D, c3, ivec3(2), lodClamp, 2.0);\r
50     utexel  += textureOffsetClampARB(us2DRect, c2, ivec2(3), lodClamp);\r
51     texel.z += textureOffsetClampARB(s2DArrayShadow, c4, ivec2(5), lodClamp);\r
52 \r
53     resident |= sparseTextureGradClampARB(s3D, c3, c3, c3, lodClamp, texel);\r
54     resident |= sparseTextureGradClampARB(sCubeShadow, c4, c3, c3, lodClamp, texel.y);\r
55     resident |= sparseTextureGradClampARB(usCubeArray, c4, c3, c3, lodClamp, utexel);\r
56 \r
57     texel   += textureGradClampARB(s3D, c3, c3, c3, lodClamp);\r
58     texel.y += textureGradClampARB(sCubeShadow, c4, c3, c3, lodClamp);\r
59     utexel  += textureGradClampARB(usCubeArray, c4, c3, c3, lodClamp);\r
60 \r
61     resident |= sparseTextureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp, texel);\r
62     resident |= sparseTextureGradOffsetClampARB(s2DRectShadow, c3, c2, c2, ivec2(6), lodClamp, texel.w);\r
63     resident |= sparseTextureGradOffsetClampARB(is2DArray, c3, c2, c2, ivec2(2), lodClamp, itexel);\r
64 \r
65     texel   += textureGradOffsetClampARB(s2D, c2, c2, c2, ivec2(5), lodClamp);\r
66     texel.w += textureGradOffsetClampARB(s2DRectShadow, c3, c2, c2, ivec2(6), lodClamp);\r
67     itexel  += textureGradOffsetClampARB(is2DArray, c3, c2, c2, ivec2(2), lodClamp);\r
68 \r
69     outColor = sparseTexelsResidentARB(resident) ? texel : vec4(itexel) + vec4(utexel);\r
70 }