Merge pull request #2976 from jeremy-lunarg/hayes-fix-2975
[platform/upstream/glslang.git] / Test / samplerlessTextureFunctions.frag
1 #version 450 core
2
3 layout(binding = 1) uniform texture2D tex2D;
4 layout(binding = 1) uniform texture2DMS texMS;
5 layout(binding = 0) uniform textureBuffer buf;
6
7 void testBad()
8 {
9     vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0);
10     vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0);
11
12     // Allowed by KHR_vulkan_glsl without the extension. All others should
13     // error.
14     vec4 bufFetch = texelFetch(buf, 0);
15
16     vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0));
17
18     ivec2 tex2DSize = textureSize(tex2D, 0);
19     ivec2 texMSSize = textureSize(texMS);
20     int bufSize = textureSize(buf);
21
22     int tex2DLevels = textureQueryLevels(tex2D);
23
24     int texMSSamples = textureSamples(texMS);
25 }
26
27 #extension GL_EXT_samplerless_texture_functions : enable
28
29 void main()
30 {
31     // These should all succeed.
32
33     vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0);
34     vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0);
35     vec4 bufFetch = texelFetch(buf, 0);
36
37     vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0));
38
39     ivec2 tex2DSize = textureSize(tex2D, 0);
40     ivec2 texMSSize = textureSize(texMS);
41     int bufSize = textureSize(buf);
42
43     int tex2DLevels = textureQueryLevels(tex2D);
44
45     int texMSSamples = textureSamples(texMS);
46 }