100.frag 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. // okay
  2. #version 100
  3. int a[3] = { 2, 3, 4, }; // ERROR (lots)
  4. #version 100
  5. int uint;
  6. attribute vec4 v[3]; // ERROR
  7. float f = 2; // ERROR
  8. uniform block { // ERROR
  9. int x;
  10. };
  11. void foo(float);
  12. void main()
  13. {
  14. foo(3); // ERROR
  15. int s = 1 << 4; // ERROR
  16. s = 16 >> 2; // ERROR
  17. if (a == a); // ERROR
  18. int b, c;
  19. b = c & 4; // ERROR
  20. b = c % 4; // ERROR
  21. b = c | 4; // ERROR
  22. b >>= 2; // ERROR
  23. b <<= 2; // ERROR
  24. b %= 3; // ERROR
  25. struct S {
  26. float f;
  27. float a[10];
  28. } s1, s2;
  29. s1 = s2; // ERROR
  30. if (s1 == s2); // ERROR
  31. if (s1 != s2); // ERROR
  32. switch(b) { // ERROR
  33. }
  34. }
  35. invariant gl_FragColor;
  36. float fa[]; // ERROR
  37. float f13;
  38. invariant f13; // ERROR
  39. struct S { int a; };
  40. invariant S; // ERROR, not an input or output
  41. invariant float fi; // ERROR
  42. varying vec4 av;
  43. invariant av; // okay in v100
  44. void foo10()
  45. {
  46. invariant f; // ERROR
  47. invariant float f2; // ERROR
  48. float f3;
  49. invariant f3; // ERROR
  50. }
  51. uniform vec2 uv2;
  52. invariant uv2; // ERROR
  53. invariant uniform vec3 uv3; // ERROR
  54. sampler2D glob2D; // ERROR
  55. void f11(sampler2D p2d)
  56. {
  57. sampler2D v2D; // ERROR
  58. }
  59. varying sampler2D vary2D; // ERROR
  60. struct sp {
  61. highp float f;
  62. in float g; // ERROR
  63. uniform float h; // ERROR
  64. invariant float i; // ERROR
  65. };
  66. uniform sampler3D s3D; // ERROR
  67. #extension GL_OES_texture_3D : enable
  68. precision highp sampler3D;
  69. uniform sampler3D s3D2;
  70. void foo234()
  71. {
  72. texture3D(s3D2, vec3(0.2), 0.2);
  73. texture3DProj(s3D2, v[1], 0.4);
  74. dFdx(v[0]); // ERROR
  75. dFdy(3.2); // ERROR
  76. fwidth(f13); // ERROR
  77. }
  78. #extension GL_OES_standard_derivatives : enable
  79. void foo236()
  80. {
  81. dFdx(v[0]);
  82. dFdy(3.2);
  83. fwidth(f13);
  84. gl_FragDepth = f13; // ERROR
  85. gl_FragDepthEXT = f13; // ERROR
  86. }
  87. #extension GL_EXT_frag_depth : enable
  88. void foo239()
  89. {
  90. gl_FragDepth = f13; // ERROR
  91. gl_FragDepthEXT = f13;
  92. }
  93. #extension GL_OES_EGL_image_external : enable
  94. uniform samplerExternalOES sExt;
  95. void foo245()
  96. {
  97. texture2D(sExt, vec2(0.2));
  98. texture2DProj(sExt, vec3(f13));
  99. texture2DProj(sExt, v[2]);
  100. }
  101. precision mediump samplerExternalOES;
  102. uniform samplerExternalOES mediumExt;
  103. uniform highp samplerExternalOES highExt;
  104. void foo246()
  105. {
  106. texture2D(mediumExt, vec2(0.2));
  107. texture2DProj(highExt, v[2]);
  108. texture3D(sExt, vec3(f13)); // ERROR
  109. texture2DProjLod(sExt, vec3(f13), f13); // ERROR
  110. int a;
  111. ~a; // ERROR
  112. a | a; // ERROR
  113. a & a; // ERROR
  114. }
  115. #extension GL_OES_EGL_image_external : disable
  116. uniform sampler2D s2Dg;
  117. int foo203940(int a, float b, float a) // ERROR, a redefined
  118. {
  119. texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2); // ERROR, extension not enabled
  120. return a;
  121. }
  122. float f123 = 4.0f; // ERROR
  123. float f124 = 5e10F; // ERROR
  124. #extension GL_EXT_shader_texture_lod : enable
  125. uniform samplerCube sCube;
  126. void foo323433()
  127. {
  128. texture2DLodEXT(s2Dg, uv2, f13);
  129. texture2DProjGradEXT(s2Dg, vec3(f13), uv2, uv2);
  130. texture2DGradEXT(s2Dg, uv2, uv2, uv2);
  131. textureCubeGradEXT(sCube, vec3(f13), vec3(f13), vec3(f13));
  132. }
  133. int fgfg(float f, mediump int i);
  134. int fgfg(float f, highp int i) { return 2; } // ERROR, precision qualifier difference
  135. int fffg(float f);
  136. int fffg(float f); // ERROR, can't have multiple prototypes
  137. int gggf(float f);
  138. int gggf(float f) { return 2; }
  139. int agggf(float f) { return 2; }
  140. int agggf(float f);
  141. int agggf(float f); // ERROR, second prototype
  142. varying struct SSS { float f; } s; // ERROR
  143. int vf(void);
  144. int vf2();
  145. int vf3(void v); // ERROR
  146. int vf4(int, void); // ERROR
  147. int vf5(int, void v); // ERROR
  148. void badswizzle()
  149. {
  150. vec3 a[5];
  151. a.y; // ERROR, no array swizzle
  152. a.zy; // ERROR, no array swizzle
  153. a.nothing; // ERROR
  154. a.length(); // ERROR, not this version
  155. a.method(); // ERROR
  156. }
  157. float fooinit();
  158. float fooinittest()
  159. {
  160. return fooinit();
  161. }
  162. // Test extra-function initializers
  163. const float fi1 = 3.0;
  164. const float fi2 = 4.0;
  165. const float fi3 = 5.0;
  166. float fooinit()
  167. {
  168. return fi1 + fi2 + fi3; // should make a constant of 12.0
  169. }
  170. int init1 = gl_FrontFacing ? 1 : 2; // ERROR, non-const initializer
  171. #ifdef GL_EXT_shader_non_constant_global_initializers
  172. #extension GL_EXT_shader_non_constant_global_initializers : enable
  173. #endif
  174. int init2 = gl_FrontFacing ? 1 : 2;
  175. #pragma STDGL invariant(all)
  176. #line 3000
  177. #error line of this error should be 3000
  178. uniform samplerExternalOES badExt; // syntax ERROR