430.vert 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. #version 430 core
  2. layout(location = 3) vec4 v4; // ERROR
  3. layout(location = 4) uniform vec4 uv4;
  4. layout(location = 2) in inb1 { vec4 v; } b1; // ERROR
  5. layout(location = 2) out outb1 { vec4 v; } b2; // ERROR
  6. out gl_PerVertex {
  7. float gl_ClipDistance[];
  8. };
  9. void foo()
  10. {
  11. gl_ClipDistance[2] = 3.7;
  12. }
  13. struct sp {
  14. highp float f;
  15. in float g; // ERROR
  16. uniform float h; // ERROR
  17. invariant float i; // ERROR
  18. volatile float j; // ERROR
  19. layout(row_major) mat3 m3; // ERROR
  20. };
  21. void foo3(invariant vec4 v4, // ERROR
  22. volatile vec3 v3,
  23. layout(location = 3) vec2 v2, // ERROR
  24. centroid vec3 cv3) // ERROR
  25. {
  26. }
  27. struct S {
  28. mat3x2 m[7]; // needs 7*3 locations
  29. float f; // needs 1 location
  30. }; // needs 22 locations
  31. layout(location = 10) out S cs[2]; // 10 through 10 + 2 * 22 - 1 = 53
  32. layout(location = 54) out float cf;
  33. layout(location = 53) out float cg; // ERROR, collision at 31
  34. layout(location = 10) in vec4 alias1;
  35. layout(location = 10) in vec4 alias2; // okay for vertex input on desktop
  36. out float gl_ClipDistance[17]; // ERROR, size too big
  37. // enhanced_layouts (most tests are in 440.*)
  38. layout(location = start*start - 2 - 4) in vec4 v6e; // ERROR
  39. layout(location = 28) in inblock2e {
  40. layout(location = 25) float f2; // ERROR
  41. } ininst2e;
  42. in ublock4e {
  43. layout(location = 50) float f1; // ERROR
  44. layout(location = 51) float f2; // ERROR
  45. } in4e;
  46. layout(align=16, std140) uniform ubl4e { int a; } inst4e;// ERROR
  47. layout(align=32) uniform ubl9e { // ERROR
  48. layout(offset=12, align=4) float f; // ERROR
  49. layout(offset=20) float g; // ERROR
  50. } inst9e;
  51. layout(std140) uniform blocke {
  52. vec4 a;
  53. layout(offset = 32) vec3 b; // ERROR
  54. } spinste;
  55. int aconste[gl_MaxTransformFeedbackBuffers]; // ERROR
  56. int bconste[gl_MaxTransformFeedbackInterleavedComponents]; // ERROR
  57. out bblck2 {
  58. layout(xfb_offset=64) vec4 bbv; // ERROR
  59. } bbinst2;
  60. layout(xfb_buffer = 3, xfb_stride = 64) out; // ERROR
  61. layout(xfb_buffer=2, xfb_offset=48, xfb_stride=80) out vec4 bge; // ERROR
  62. layout( xfb_offset=32, xfb_stride=64) out vec4 bhe; // ERROR
  63. layout(xfb_stride=80, xfb_buffer=2, xfb_offset=16) out bblck4e { // ERROR
  64. vec4 bbv1;
  65. vec4 bbv2;
  66. } bbinst4e;
  67. out bblck5e {
  68. layout(xfb_offset=0) vec4 bbv1; // ERROR
  69. layout(xfb_stride=64, xfb_buffer=3, xfb_offset=48) vec4 bbv2; // ERROR
  70. } bbinst5e;
  71. #extension GL_ARB_enhanced_layouts : enable
  72. layout(align=16, std140) uniform ubl4 { int a; } inst4;
  73. layout(std430) uniform;
  74. layout(align=32) uniform ubl9 {
  75. layout(offset=12, align=4) float f;
  76. layout(offset=20) float g;
  77. } inst9;
  78. layout(std140) uniform block {
  79. vec4 a; // a takes offsets 0-15
  80. layout(offset = 32) vec3 b; // b takes offsets 32-43
  81. } spinst;
  82. int aconst[gl_MaxTransformFeedbackBuffers];
  83. int bconst[gl_MaxTransformFeedbackInterleavedComponents];
  84. const int start2 = 5;
  85. layout(location = start2 * start2 - 2 - 4) in vec4 v6;
  86. layout(location = 28) in inblock2 { // ERROR, input block in vertex shader, other errors are valid checks still...
  87. bool b1;
  88. float f1;
  89. layout(location = 25) float f2;
  90. } ininst2;
  91. in ublock4 { // ERROR, input block in vertex shader, other errors are valid checks still...
  92. layout(location = 50) float f1;
  93. layout(location = 51) float f2;
  94. } in4;
  95. out bblck2g {
  96. layout(xfb_offset=64) vec4 bbv;
  97. } bbinst2g;
  98. layout(xfb_buffer = 1, xfb_stride = 80) out; // default buffer is 3
  99. layout(xfb_buffer=1, xfb_offset=48, xfb_stride=80) out vec4 bg;
  100. layout( xfb_offset=32, xfb_stride=80) out vec4 bh;
  101. layout(xfb_stride=80, xfb_buffer=1, xfb_offset=16) out bblck4 {
  102. vec4 bbv1;
  103. } bbinst4;
  104. out bblck5 {
  105. layout(xfb_offset=0) vec4 bbv1;
  106. layout(xfb_stride=80, xfb_buffer=1, xfb_offset=64) vec4 bbv2;
  107. } bbinst5;
  108. shared vec4 sharedv; // ERROR
  109. void fooBarrier()
  110. {
  111. barrier(); // ERROR
  112. memoryBarrier();
  113. memoryBarrierAtomicCounter();
  114. memoryBarrierBuffer();
  115. memoryBarrierShared(); // ERROR
  116. memoryBarrierImage();
  117. groupMemoryBarrier(); // ERROR
  118. }
  119. buffer vec4 v; // ERROR
  120. uniform sampler2DMS s2dms;
  121. uniform usampler2DMSArray us2dmsa;
  122. layout(rgba32i) uniform iimage2DMS ii2dms;
  123. layout(rgba32f) uniform image2DMSArray i2dmsa;
  124. void fooq()
  125. {
  126. int s = textureSamples(s2dms); // ERROR
  127. s += textureSamples(us2dmsa); // ERROR
  128. s += imageSamples(ii2dms); // ERROR
  129. s += imageSamples(i2dmsa); // ERROR
  130. }
  131. #extension GL_ARB_shader_texture_image_samples : enable
  132. void fooq2()
  133. {
  134. int s = textureSamples(s2dms);
  135. s += textureSamples(us2dmsa);
  136. s += imageSamples(ii2dms);
  137. s += imageSamples(i2dmsa);
  138. }
  139. uniform sampler1D samp1D;
  140. uniform usampler2D usamp2D;
  141. uniform isampler3D isamp3D;
  142. uniform isamplerCube isampCube;
  143. uniform isampler1DArray isamp1DA;
  144. uniform sampler2DArray samp2DA;
  145. uniform usamplerCubeArray usampCubeA;
  146. uniform sampler1DShadow samp1Ds;
  147. uniform sampler2DShadow samp2Ds;
  148. uniform samplerCubeShadow sampCubes;
  149. uniform sampler1DArrayShadow samp1DAs;
  150. uniform sampler2DArrayShadow samp2DAs;
  151. uniform samplerCubeArrayShadow sampCubeAs;
  152. uniform samplerBuffer sampBuf;
  153. uniform sampler2DRect sampRect;
  154. void qlod()
  155. {
  156. int levels;
  157. levels = textureQueryLevels(samp1D);
  158. levels = textureQueryLevels(usamp2D);
  159. levels = textureQueryLevels(isamp3D);
  160. levels = textureQueryLevels(isampCube);
  161. levels = textureQueryLevels(isamp1DA);
  162. levels = textureQueryLevels(samp2DA);
  163. levels = textureQueryLevels(usampCubeA);
  164. levels = textureQueryLevels(samp1Ds);
  165. levels = textureQueryLevels(samp2Ds);
  166. levels = textureQueryLevels(sampCubes);
  167. levels = textureQueryLevels(samp1DAs);
  168. levels = textureQueryLevels(samp2DAs);
  169. levels = textureQueryLevels(sampCubeAs);
  170. levels = textureQueryLevels(sampBuf); // ERROR
  171. levels = textureQueryLevels(sampRect); // ERROR
  172. }