samplerlessTextureFunctions.frag 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #version 450 core
  2. layout(binding = 1) uniform texture2D tex2D;
  3. layout(binding = 1) uniform texture2DMS texMS;
  4. layout(binding = 0) uniform textureBuffer buf;
  5. void testBad()
  6. {
  7. vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0);
  8. vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0);
  9. // Allowed by KHR_vulkan_glsl without the extension. All others should
  10. // error.
  11. vec4 bufFetch = texelFetch(buf, 0);
  12. vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0));
  13. ivec2 tex2DSize = textureSize(tex2D, 0);
  14. ivec2 texMSSize = textureSize(texMS);
  15. int bufSize = textureSize(buf);
  16. int tex2DLevels = textureQueryLevels(tex2D);
  17. int texMSSamples = textureSamples(texMS);
  18. }
  19. #extension GL_EXT_samplerless_texture_functions : enable
  20. void main()
  21. {
  22. // These should all succeed.
  23. vec4 tex2DFetch = texelFetch(tex2D, ivec2(0, 0), 0);
  24. vec4 texMSFetch = texelFetch(texMS, ivec2(0, 0), 0);
  25. vec4 bufFetch = texelFetch(buf, 0);
  26. vec4 tex2DFetchOffset = texelFetchOffset(tex2D, ivec2(0, 0), 0, ivec2(0, 0));
  27. ivec2 tex2DSize = textureSize(tex2D, 0);
  28. ivec2 texMSSize = textureSize(texMS);
  29. int bufSize = textureSize(buf);
  30. int tex2DLevels = textureQueryLevels(tex2D);
  31. int texMSSamples = textureSamples(texMS);
  32. }