320.frag 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. #version 320 es
  2. out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
  3. in inbname {
  4. int a;
  5. vec4 v;
  6. struct { int b; } s; // ERROR, nested struct definition
  7. } inbinst;
  8. in inbname2 {
  9. layout(location = 12) int aAnon;
  10. layout(location = 13) centroid in vec4 vAnon;
  11. };
  12. in layout(location = 13) vec4 aliased; // ERROR, aliased
  13. in inbname2 { // ERROR, reuse of block name
  14. int aAnon;
  15. centroid in vec4 vAnon;
  16. };
  17. in badmember { // ERROR, aAnon already in global scope
  18. int aAnon;
  19. };
  20. int inbname; // ERROR, redefinition of block name
  21. vec4 vAnon; // ERROR, anon in global scope; redefinition
  22. in arrayed {
  23. float f;
  24. } arrayedInst[4];
  25. uniform int i;
  26. void fooIO()
  27. {
  28. vec4 v = inbinst.v + vAnon;
  29. v *= arrayedInst[2].f;
  30. v *= arrayedInst[i].f;
  31. }
  32. in vec4 gl_FragCoord;
  33. layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
  34. layout(early_fragment_tests) in;
  35. out float gl_FragDepth;
  36. layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
  37. void main()
  38. {
  39. gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
  40. bool f = gl_FrontFacing;
  41. }
  42. out float gl_FragDepth;
  43. void foo_GS()
  44. {
  45. highp int l = gl_Layer;
  46. highp int p = gl_PrimitiveID;
  47. }
  48. in vec2 inf, ing;
  49. uniform ivec2 offsets[4];
  50. uniform sampler2D sArray[4];
  51. uniform int sIndex;
  52. layout(binding = 0) uniform atomic_uint auArray[2];
  53. uniform ubName { int i; } ubInst[4];
  54. buffer bbName { int i; } bbInst[4];
  55. highp uniform writeonly image2D iArray[5];
  56. const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
  57. void pfoo()
  58. {
  59. precise vec2 h;
  60. h = fma(inf, ing, h);
  61. textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
  62. textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
  63. textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
  64. }
  65. precision highp imageCubeArray ;
  66. precision highp iimageCubeArray ;
  67. precision highp uimageCubeArray ;
  68. precision highp samplerCubeArray ;
  69. precision highp samplerCubeArrayShadow;
  70. precision highp isamplerCubeArray ;
  71. precision highp usamplerCubeArray ;
  72. uniform writeonly imageCubeArray CA1;
  73. uniform writeonly iimageCubeArray CA2;
  74. uniform writeonly uimageCubeArray CA3;
  75. #ifdef GL_EXT_texture_cube_map_array
  76. uniform samplerCubeArray CA4;
  77. uniform samplerCubeArrayShadow CA5;
  78. uniform isamplerCubeArray CA6;
  79. uniform usamplerCubeArray CA7;
  80. #endif
  81. void CAT()
  82. {
  83. highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
  84. highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
  85. highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
  86. }
  87. void goodSample()
  88. {
  89. lowp int a1 = gl_SampleID;
  90. mediump vec2 a2 = gl_SamplePosition;
  91. highp int a3 = gl_SampleMaskIn[0];
  92. gl_SampleMask[0] = a3;
  93. mediump int n1 = gl_MaxSamples;
  94. mediump int n2 = gl_NumSamples;
  95. }
  96. uniform layout(r32f) highp image2D im2Df;
  97. uniform layout(r32ui) highp uimage2D im2Du;
  98. uniform layout(r32i) highp iimage2D im2Di;
  99. uniform ivec2 P;
  100. uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
  101. uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
  102. uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
  103. void goodImageAtom()
  104. {
  105. float datf;
  106. int dati;
  107. uint datu;
  108. imageAtomicAdd( im2Di, P, dati);
  109. imageAtomicAdd( im2Du, P, datu);
  110. imageAtomicMin( im2Di, P, dati);
  111. imageAtomicMin( im2Du, P, datu);
  112. imageAtomicMax( im2Di, P, dati);
  113. imageAtomicMax( im2Du, P, datu);
  114. imageAtomicAnd( im2Di, P, dati);
  115. imageAtomicAnd( im2Du, P, datu);
  116. imageAtomicOr( im2Di, P, dati);
  117. imageAtomicOr( im2Du, P, datu);
  118. imageAtomicXor( im2Di, P, dati);
  119. imageAtomicXor( im2Du, P, datu);
  120. imageAtomicExchange(im2Di, P, dati);
  121. imageAtomicExchange(im2Du, P, datu);
  122. imageAtomicExchange(im2Df, P, datf);
  123. imageAtomicCompSwap(im2Di, P, 3, dati);
  124. imageAtomicCompSwap(im2Du, P, 5u, datu);
  125. imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
  126. imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
  127. imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
  128. }
  129. centroid out vec4 colorCentroidBad; // ERROR
  130. flat out vec4 colorBadFlat; // ERROR
  131. smooth out vec4 colorBadSmooth; // ERROR
  132. noperspective out vec4 colorBadNo; // ERROR
  133. flat centroid in vec2 colorfc;
  134. in float scalarIn;
  135. sample in vec4 colorSampIn;
  136. sample out vec4 colorSampleBad; // ERROR
  137. flat sample in vec4 colorfsi;
  138. sample in vec3 sampInArray[4];
  139. void interp()
  140. {
  141. float res;
  142. vec2 res2;
  143. vec3 res3;
  144. vec4 res4;
  145. res2 = interpolateAtCentroid(colorfc);
  146. res4 = interpolateAtCentroid(colorSampIn);
  147. res4 = interpolateAtCentroid(colorfsi);
  148. res = interpolateAtCentroid(scalarIn);
  149. res3 = interpolateAtCentroid(sampInArray); // ERROR
  150. res3 = interpolateAtCentroid(sampInArray[2]);
  151. res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
  152. res3 = interpolateAtSample(sampInArray, 1); // ERROR
  153. res3 = interpolateAtSample(sampInArray[i], 0);
  154. res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
  155. res = interpolateAtSample(scalarIn, 1);
  156. res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
  157. res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
  158. res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
  159. res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
  160. res = interpolateAtOffset(scalarIn, vec2(0.2));
  161. float f;
  162. res = interpolateAtCentroid(f); // ERROR, not interpolant
  163. res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
  164. }
  165. layout(blend_support_multiply) out;
  166. layout(blend_support_screen) out;
  167. layout(blend_support_overlay) out;
  168. layout(blend_support_darken, blend_support_lighten) out;
  169. layout(blend_support_colordodge) layout(blend_support_colorburn) out;
  170. layout(blend_support_hardlight) out;
  171. layout(blend_support_softlight) out;
  172. layout(blend_support_difference) out;
  173. layout(blend_support_exclusion) out;
  174. layout(blend_support_hsl_hue) out;
  175. layout(blend_support_hsl_saturation) out;
  176. layout(blend_support_hsl_color) out;
  177. layout(blend_support_hsl_luminosity) out;
  178. layout(blend_support_all_equations) out;
  179. layout(blend_support_hsl_luminosity) out; // okay to repeat
  180. layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
  181. layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
  182. layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
  183. layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
  184. layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
  185. void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
  186. layout(blend_support_flizbit) out; // ERROR, no flizbit
  187. out vec4 outAA[2][2]; // ERROR