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