400.frag 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. #version 400 core
  2. in vec2 c2D;
  3. flat in int i;
  4. out vec4 outp;
  5. uniform sampler2D arrayedSampler[5];
  6. uniform usampler2DRect samp2dr;
  7. uniform isampler2DArray isamp2DA;
  8. void main()
  9. {
  10. vec4 v;
  11. v = texture(arrayedSampler[i], c2D);
  12. outp.x = gl_ClipDistance[1];
  13. ivec2 offsets[4];
  14. const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
  15. uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, offsets not constant
  16. uv4 = textureGatherOffsets(samp2dr, c2D, constOffsets, 2);
  17. vec4 v4 = textureGather(arrayedSampler[0], c2D);
  18. ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
  19. iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
  20. iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
  21. iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
  22. iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
  23. vec4 c = gl_FragCoord;
  24. }
  25. layout(location = 4) in vec4 vl; // ERROR, not supported
  26. #ifdef GL_ARB_separate_shader_objects
  27. #extension GL_ARB_separate_shader_objects : enable
  28. #endif
  29. layout(location = 6) in vec4 vl2;
  30. layout(location = 3) uniform vec3 uv3;
  31. layout(location = 5) in vec4 gl_Color; // ERROR, layout
  32. noperspective in float gl_ClipDistance[4]; // ERROR, can't change qualifier
  33. layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
  34. uniform sampler2DRectShadow u2drs;
  35. void foo23()
  36. {
  37. const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
  38. textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
  39. textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[1]);
  40. textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
  41. textureProjGradOffset(u2drs, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
  42. }
  43. patch in vec4 patchIn; // ERROR
  44. patch out vec4 patchOut; // ERROR
  45. void foo24()
  46. {
  47. dvec3 df, di;
  48. df = modf(dvec3(outp.xyz), di);
  49. }
  50. in float in1;
  51. in vec2 in2;
  52. in vec3 in3;
  53. in vec4 in4;
  54. void foodc1()
  55. {
  56. vec2 v2 = dFdxFine(in2); // ERROR
  57. vec3 v3 = dFdyCoarse(in3); // ERROR
  58. vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4); // ERROR
  59. }
  60. #extension GL_ARB_derivative_control : enable
  61. void foodc2()
  62. {
  63. vec2 v2 = dFdxFine(in2);
  64. vec3 v3 = dFdyCoarse(in3);
  65. vec4 v4 = fwidthCoarse(in4) + fwidthFine(in4);
  66. uint u1;
  67. ivec3 i3;
  68. ivec2 i2;
  69. v2 = frexp(v2, i2);
  70. v3 = ldexp(v3, i3);
  71. u1 = packUnorm4x8(v4);
  72. u1 = packSnorm4x8(v4);
  73. v4 = unpackUnorm4x8(u1);
  74. v4 = unpackSnorm4x8(u1);
  75. double d;
  76. uvec2 u2;
  77. d = packDouble2x32(u2);
  78. u2 = unpackDouble2x32(d);
  79. }
  80. sample in vec4 colorSampIn;
  81. sample out vec4 colorSampleBad; // ERROR
  82. noperspective in vec4 colorfsi;
  83. sample in vec3 sampInArray[4];
  84. smooth in float scalarIn;
  85. flat centroid in vec2 colorfc;
  86. struct S {
  87. float x;
  88. };
  89. in S s1;
  90. sample S s2;
  91. void interp()
  92. {
  93. interpolateAtCentroid(colorfc);
  94. interpolateAtCentroid(colorSampIn);
  95. interpolateAtCentroid(colorfsi);
  96. interpolateAtCentroid(scalarIn);
  97. interpolateAtCentroid(sampInArray); // ERROR
  98. interpolateAtCentroid(sampInArray[2]);
  99. interpolateAtCentroid(sampInArray[2].xy); // ERROR
  100. interpolateAtSample(sampInArray, 1); // ERROR
  101. interpolateAtSample(sampInArray[i], 0);
  102. interpolateAtSample(s1.x, 2);
  103. interpolateAtSample(scalarIn, 1);
  104. interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
  105. interpolateAtOffset(sampInArray[2], vec2(0.2));
  106. interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
  107. interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
  108. interpolateAtOffset(s2.x, vec2(0.2)); // ERROR
  109. float f;
  110. interpolateAtCentroid(f); // ERROR, not interpolant
  111. interpolateAtSample(outp, 0); // ERROR, not interpolant
  112. }
  113. uniform sampler1D samp1D;
  114. uniform isampler2D isamp2D;
  115. uniform usampler3D usamp3D;
  116. uniform samplerCube sampCube;
  117. uniform isampler1DArray isamp1DA;
  118. uniform usampler2DArray usamp2DA;
  119. uniform isamplerCubeArray isampCubeA;
  120. uniform sampler1DShadow samp1Ds;
  121. uniform sampler2DShadow samp2Ds;
  122. uniform samplerCubeShadow sampCubes;
  123. uniform sampler1DArrayShadow samp1DAs;
  124. uniform sampler2DArrayShadow samp2DAs;
  125. uniform samplerCubeArrayShadow sampCubeAs;
  126. uniform samplerBuffer sampBuf;
  127. uniform sampler2DRect sampRect;
  128. void qlod()
  129. {
  130. vec2 lod;
  131. float pf;
  132. vec2 pf2;
  133. vec3 pf3;
  134. lod = textureQueryLod(samp1D, pf);
  135. lod = textureQueryLod(isamp2D, pf2);
  136. lod = textureQueryLod(usamp3D, pf3);
  137. lod = textureQueryLod(sampCube, pf3);
  138. lod = textureQueryLod(isamp1DA, pf);
  139. lod = textureQueryLod(usamp2DA, pf2);
  140. lod = textureQueryLod(isampCubeA, pf3);
  141. lod = textureQueryLod(samp1Ds, pf);
  142. lod = textureQueryLod(samp2Ds, pf2);
  143. lod = textureQueryLod(sampCubes, pf3);
  144. lod = textureQueryLod(samp1DAs, pf);
  145. lod = textureQueryLod(samp2DAs, pf2);
  146. lod = textureQueryLod(sampCubeAs, pf3);
  147. lod = textureQueryLod(sampBuf, pf); // ERROR
  148. lod = textureQueryLod(sampRect, pf2); // ERROR
  149. }
  150. uniform uint uu;
  151. out uint iout;
  152. void bitwiseConv()
  153. {
  154. iout = uu & i;
  155. iout += uu ^ i;
  156. iout += i | uu;
  157. }
  158. subroutine(subT1, subT2);
  159. subroutine float subT1() { return 1.0; }
  160. subroutine float subT2() { return 1.0; }
  161. struct SKeyMem { int precise; } KeyMem; // ERROR, keyword can't be a member