320.vert 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. #version 320 es
  2. out outbname {
  3. int a;
  4. out vec4 v;
  5. highp sampler2D s; // ERROR, opaque type
  6. } outbinst;
  7. out outbname2 {
  8. layout(location = 12) int aAnon;
  9. layout(location = 13) vec4 vAnon;
  10. };
  11. layout(location = 12) out highp int aliased; // ERROR, aliasing location
  12. in inbname { int a; } inbinst; // ERROR, no in block in vertex shader
  13. out gl_PerVertex { // ERROR, has extra member
  14. highp vec4 gl_Position;
  15. highp vec4 t;
  16. };
  17. void main()
  18. {
  19. int sum = gl_VertexID +
  20. gl_InstanceID;
  21. gl_Position = vec4(1.0);
  22. gl_PointSize = 2.0; // ERROR, removed by redeclaration
  23. }
  24. out gl_PerVertex { // ERROR, already used and already redeclared
  25. highp vec4 gl_Position;
  26. highp vec4 t;
  27. };
  28. smooth out smo { // ERROR, no smooth on a block
  29. int i;
  30. } smon;
  31. flat out fmo { // ERROR, no flat on a block
  32. int i;
  33. } fmon;
  34. centroid out cmo { // ERROR, no centroid on a block
  35. int i;
  36. } cmon;
  37. invariant out imo { // ERROR, no invariant on a block
  38. int i;
  39. } imon;
  40. in vec2 inf, ing;
  41. uniform ivec2 offsets[4];
  42. uniform sampler2D sArray[4];
  43. uniform int sIndex;
  44. layout(binding = 0) uniform atomic_uint auArray[2];
  45. uniform ubName { int i; } ubInst[4];
  46. buffer bbName { int i; } bbInst[4];
  47. highp uniform writeonly image2D iArray[5];
  48. const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
  49. void pfoo()
  50. {
  51. precise vec2 h;
  52. h = fma(inf, ing, h);
  53. sArray[sIndex + 1];
  54. ubInst[sIndex + 1];
  55. bbInst[sIndex - 2]; // ERROR, still not supported
  56. iArray[2];
  57. iArray[sIndex - 2];
  58. textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
  59. textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
  60. textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
  61. }
  62. uniform samplerBuffer noPreSamp1; // ERROR, no default precision
  63. uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
  64. uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
  65. uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
  66. uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
  67. uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
  68. precision highp samplerBuffer;
  69. precision highp isamplerBuffer;
  70. precision highp usamplerBuffer;
  71. precision highp imageBuffer;
  72. precision highp iimageBuffer;
  73. precision highp uimageBuffer;
  74. #ifdef GL_OES_texture_buffer
  75. uniform samplerBuffer bufSamp1;
  76. uniform isamplerBuffer bufSamp2;
  77. uniform usamplerBuffer bufSamp3;
  78. #endif
  79. #ifdef GL_EXT_texture_buffer
  80. uniform writeonly imageBuffer bufSamp4;
  81. uniform writeonly iimageBuffer bufSamp5;
  82. uniform writeonly uimageBuffer bufSamp6;
  83. #endif
  84. void bufferT()
  85. {
  86. highp int s1 = textureSize(bufSamp1);
  87. highp int s2 = textureSize(bufSamp2);
  88. highp int s3 = textureSize(bufSamp3);
  89. highp int s4 = imageSize(bufSamp4);
  90. highp int s5 = imageSize(bufSamp5);
  91. highp int s6 = imageSize(bufSamp6);
  92. highp vec4 f1 = texelFetch(bufSamp1, s1);
  93. highp ivec4 f2 = texelFetch(bufSamp2, s2);
  94. highp uvec4 f3 = texelFetch(bufSamp3, s3);
  95. }
  96. uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision
  97. uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision
  98. uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision
  99. uniform samplerCubeArray noPreCA4; // ERROR, no default precision
  100. uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision
  101. uniform isamplerCubeArray noPreCA6; // ERROR, no default precision
  102. uniform usamplerCubeArray noPreCA7; // ERROR, no default precision
  103. precision highp imageCubeArray ;
  104. precision highp iimageCubeArray ;
  105. precision highp uimageCubeArray ;
  106. precision highp samplerCubeArray ;
  107. precision highp samplerCubeArrayShadow;
  108. precision highp isamplerCubeArray ;
  109. precision highp usamplerCubeArray ;
  110. uniform writeonly imageCubeArray CA1;
  111. uniform writeonly iimageCubeArray CA2;
  112. uniform writeonly uimageCubeArray CA3;
  113. layout(rgba16f) uniform readonly imageCubeArray rCA1;
  114. layout(rgba32i) uniform readonly iimageCubeArray rCA2;
  115. layout(r32ui) uniform readonly uimageCubeArray rCA3;
  116. #ifdef GL_OES_texture_cube_map_array
  117. uniform samplerCubeArray CA4;
  118. uniform samplerCubeArrayShadow CA5;
  119. uniform isamplerCubeArray CA6;
  120. uniform usamplerCubeArray CA7;
  121. #endif
  122. void CAT()
  123. {
  124. highp ivec3 s4 = textureSize(CA4, 1);
  125. highp ivec3 s5 = textureSize(CA5, 1);
  126. highp ivec3 s6 = textureSize(CA6, 1);
  127. highp ivec3 s7 = textureSize(CA7, 1);
  128. highp vec4 t4 = texture(CA4, vec4(0.5));
  129. highp float t5 = texture(CA5, vec4(0.5), 3.0);
  130. highp ivec4 t6 = texture(CA6, vec4(0.5));
  131. highp uvec4 t7 = texture(CA7, vec4(0.5));
  132. highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
  133. highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
  134. highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
  135. highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
  136. highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
  137. highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
  138. highp vec4 gath4 = textureGather(CA4, vec4(0.5));
  139. highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
  140. highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
  141. highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
  142. highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
  143. highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
  144. highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
  145. highp ivec3 s1 = imageSize(CA1);
  146. highp ivec3 s2 = imageSize(CA2);
  147. highp ivec3 s3 = imageSize(CA3);
  148. imageStore(CA1, s3, vec4(1));
  149. imageStore(CA2, s3, ivec4(1));
  150. imageStore(CA3, s3, uvec4(1));
  151. highp vec4 cl1 = imageLoad(rCA1, s3);
  152. highp ivec4 cl2 = imageLoad(rCA2, s3);
  153. highp uvec4 cl3 = imageLoad(rCA3, s3);
  154. }
  155. uniform sampler2DMSArray noPrec2DMS; // ERROR, no default
  156. uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default
  157. uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default
  158. precision highp sampler2DMSArray;
  159. precision highp isampler2DMSArray;
  160. precision highp usampler2DMSArray;
  161. uniform sampler2DMSArray samp2DMSA;
  162. uniform isampler2DMSArray samp2DMSAi;
  163. uniform usampler2DMSArray samp2DMSAu;
  164. void MSA()
  165. {
  166. vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
  167. ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
  168. uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
  169. ivec3 tfs = textureSize(samp2DMSA);
  170. ivec3 tfsi = textureSize(samp2DMSAi);
  171. ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod
  172. ivec3 tfsu = textureSize(samp2DMSAu);
  173. }
  174. uniform layout(r32f) highp image2D im2Df;
  175. uniform layout(r32ui) highp uimage2D im2Du;
  176. uniform layout(r32i) highp iimage2D im2Di;
  177. uniform ivec2 P;
  178. void goodImageAtom()
  179. {
  180. float datf;
  181. int dati;
  182. uint datu;
  183. imageAtomicAdd( im2Di, P, dati);
  184. imageAtomicAdd( im2Du, P, datu);
  185. imageAtomicMin( im2Di, P, dati);
  186. imageAtomicMin( im2Du, P, datu);
  187. imageAtomicMax( im2Di, P, dati);
  188. imageAtomicMax( im2Du, P, datu);
  189. imageAtomicAnd( im2Di, P, dati);
  190. imageAtomicAnd( im2Du, P, datu);
  191. imageAtomicOr( im2Di, P, dati);
  192. imageAtomicOr( im2Du, P, datu);
  193. imageAtomicXor( im2Di, P, dati);
  194. imageAtomicXor( im2Du, P, datu);
  195. imageAtomicExchange(im2Di, P, dati);
  196. imageAtomicExchange(im2Du, P, datu);
  197. imageAtomicExchange(im2Df, P, datf);
  198. imageAtomicCompSwap(im2Di, P, 3, dati);
  199. imageAtomicCompSwap(im2Du, P, 5u, datu);
  200. }
  201. sample out vec4 colorSample;
  202. flat sample out vec4 colorfsi;
  203. sample out vec3 sampInArray[4];
  204. in vec4 inv4;
  205. void badInterp()
  206. {
  207. interpolateAtCentroid(inv4); // ERROR, wrong stage
  208. interpolateAtSample(inv4, 1); // ERROR, need extension
  209. interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
  210. }