Home | History | Annotate | Download | only in Test
      1 #version 310 es
      2 
      3 shared vec4 s;   // ERROR
      4 layout(local_size_x = 2) out;  // ERROR
      5 buffer vec4 v;  // ERROR
      6 in int ini;
      7 layout(location = 2) uniform mat4 x;
      8 layout(location = 3) uniform mat4 y;
      9 layout(location = 2) out mat4 xi;
     10 layout(location = 3) out mat4 yi;  // ERROR, locations conflict with xi
     11 
     12 void main()
     13 {
     14     uvec2 u2;
     15     u2 = uaddCarry(u2, u2, u2);
     16     uint u1;
     17     u1 = usubBorrow(u1, u1, u1);
     18     uvec4 u4;
     19     umulExtended(u4, u4, u4, u4);
     20     ivec4 i4;
     21     imulExtended(i4, i4, i4, i4);
     22     int i1;
     23     i1 = bitfieldExtract(i1, 4, 5);
     24     uvec3 u3;
     25     u3 = bitfieldExtract(u3, 4, 5);
     26     ivec3 i3;
     27     i3 = bitfieldInsert(i3, i3, 4, 5);
     28     u1 = bitfieldInsert(u1, u1, 4, 5);
     29     ivec2 i2;
     30     i2 = bitfieldReverse(i2);
     31     u4 = bitfieldReverse(u4);
     32     i1 = bitCount(i1);
     33     i3 = bitCount(u3);
     34     i2 = findLSB(i2);
     35     i4 = findLSB(u4);
     36     i1 = findMSB(i1);
     37     i2 = findMSB(u2);
     38 
     39     vec3 v3;
     40     v3 = frexp(v3, i3);
     41     vec2 v2;
     42     v2 = ldexp(v2, i2);
     43 
     44     mediump vec4 v4;
     45     u1 = packUnorm4x8(v4);
     46     u1 = packSnorm4x8(v4);
     47     v4 = unpackUnorm4x8(u1);
     48     v4 = unpackSnorm4x8(u1);
     49 }
     50 
     51 precision highp sampler2DMS;
     52 precision highp isampler2DMS;
     53 precision highp usampler2DMS;
     54 
     55 uniform sampler2DMS s2dms;
     56 uniform isampler2DMS is2dms;
     57 uniform usampler2DMS us2dms;
     58 uniform usampler2DMSArray us2dmsa;   // ERROR
     59 
     60 void foo()
     61 {
     62     ivec2 v2;
     63     v2 = textureSize(s2dms);
     64     v2 = textureSize(us2dms);
     65     vec4 v4 = texelFetch(s2dms, v2, 2);
     66     ivec4 iv4 = texelFetch(is2dms, v2, 2);
     67     textureSamples(s2dms);   // ERROR
     68     float f;
     69     frexp(f, ini);     // ERROR, i not writable
     70 }
     71 
     72 out bool outb;         // ERROR
     73 out sampler2D outo;    // ERROR
     74 out float outa[4];
     75 out float outaa[4][2]; // ERROR
     76 struct S { float f; };
     77 out S outs;
     78 out S[4] outasa;       // ERROR
     79 out S outsa[4];        // ERROR
     80 struct SA { float f[4]; };
     81 out SA outSA;          // ERROR
     82 struct SS { float f; S s; };
     83 out SS outSS;          // ERROR
     84 
     85 layout(std430) uniform U430 { int a; } U430i;    // ERROR
     86 layout(std430) buffer B430 { int a; } B430i;
     87 
     88 #ifndef GL_OES_shader_io_blocks
     89 #error GL_OES_shader_io_blocks not defined
     90 #endif
     91 
     92 #extension GL_OES_shader_io_blocks : enable
     93 
     94 out outbname {
     95     int a;
     96     out vec4 v;
     97     highp sampler2D s;   // ERROR, opaque type
     98 } outbinst;
     99 
    100 out outbname2 {
    101     layout(location = 12) int aAnon;
    102     layout(location = 13) vec4 vAnon;
    103 };
    104 
    105 layout(location = 12) out highp int aliased;  // ERROR, aliasing location
    106 
    107 in inbname { int a; } inbinst;  // ERROR, no in block in vertex shader
    108 
    109 out gl_PerVertex {              // ERROR, has extra member
    110     highp vec4 gl_Position;
    111     highp vec4 t;
    112 };
    113 
    114 void foo_IO()
    115 {
    116     int sum  = gl_VertexID +
    117                gl_InstanceID;
    118     gl_Position = vec4(1.0);
    119     gl_PointSize = 2.0;         // ERROR, removed by redeclaration
    120 }
    121 
    122 out gl_PerVertex {              // ERROR, already used and already redeclared
    123     highp vec4 gl_Position;
    124     highp vec4 t;
    125 };
    126 
    127 smooth out smo {                // ERROR, no smooth on a block
    128     int i;
    129 } smon;
    130 
    131 flat out fmo {                  // ERROR, no flat on a block
    132     int i;
    133 } fmon;
    134 
    135 centroid out cmo {              // ERROR, no centroid on a block
    136     int i;
    137 } cmon;
    138 
    139 invariant out imo {             // ERROR, no invariant on a block
    140     int i;
    141 } imon;
    142 
    143 in vec2 inf, ing;
    144 uniform ivec2 offsets[4];
    145 uniform sampler2D sArray[4];
    146 uniform int sIndex;
    147 layout(binding = 0) uniform atomic_uint auArray[2];
    148 uniform ubName { int i; } ubInst[4];
    149 buffer bbName { int i; } bbInst[4];
    150 highp uniform writeonly image2D iArray[5];
    151 const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
    152 
    153 void pfooBad()
    154 {
    155     precise vec2 h;          // ERROR reserved
    156     h = fma(inf, ing, h);    // ERROR, not available
    157     sArray[sIndex + 1];      // ERRRO, not supported
    158     auArray[sIndex + 1];
    159     ubInst[1];
    160     bbInst[2];
    161     ubInst[sIndex + 1];      // ERROR, not supported
    162     bbInst[sIndex];          // ERROR, not supported
    163     iArray[2];
    164     iArray[sIndex * 2];      // ERROR, not supported
    165     textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));     // ERROR, offset not constant
    166     textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);  // ERROR, not available
    167 }
    168 
    169 #extension GL_OES_gpu_shader5 : enable
    170 
    171 void pfoo()
    172 {
    173     precise vec2 h;
    174     h = fma(inf, ing, h);
    175     sArray[sIndex + 1];
    176     ubInst[sIndex + 1];
    177     bbInst[sIndex - 2];      // ERROR, still not supported
    178     iArray[2];
    179     iArray[sIndex - 2];
    180     textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
    181     textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
    182     textureGatherOffsets(sArray[0], vec2(0.1), offsets);   // ERROR, offset not constant
    183 }
    184 
    185 uniform samplerBuffer  badSamp1;             // ERROR, reserved
    186 uniform isamplerBuffer badSamp2;             // ERROR, reserved
    187 uniform usamplerBuffer badSamp3;             // ERROR, reserved
    188 uniform writeonly imageBuffer    badSamp4;   // ERROR, reserved
    189 uniform writeonly iimageBuffer   badSamp5;   // ERROR, reserved
    190 uniform writeonly uimageBuffer   badSamp6;   // ERROR, reserved
    191 
    192 #extension GL_OES_texture_buffer : enable
    193 #extension GL_EXT_texture_buffer : enable
    194 
    195 uniform samplerBuffer  noPreSamp1;            // ERROR, no default precision
    196 uniform isamplerBuffer noPreSamp2;            // ERROR, no default precision
    197 uniform usamplerBuffer noPreSamp3;            // ERROR, no default precision
    198 uniform writeonly imageBuffer    noPreSamp4;  // ERROR, no default precision
    199 uniform writeonly iimageBuffer   noPreSamp5;  // ERROR, no default precision
    200 uniform writeonly uimageBuffer   noPreSamp6;  // ERROR, no default precision
    201 
    202 precision highp samplerBuffer; 
    203 precision highp isamplerBuffer;
    204 precision highp usamplerBuffer;
    205 precision highp imageBuffer;   
    206 precision highp iimageBuffer;  
    207 precision highp uimageBuffer;  
    208 
    209 #ifdef GL_OES_texture_buffer
    210 uniform samplerBuffer  bufSamp1;          
    211 uniform isamplerBuffer bufSamp2;          
    212 uniform usamplerBuffer bufSamp3;          
    213 #endif
    214 #ifdef GL_EXT_texture_buffer
    215 uniform writeonly imageBuffer    bufSamp4;
    216 uniform writeonly iimageBuffer   bufSamp5;
    217 uniform writeonly uimageBuffer   bufSamp6;
    218 #endif
    219 
    220 void bufferT()
    221 {
    222     highp int s1 = textureSize(bufSamp1);
    223     highp int s2 = textureSize(bufSamp2);
    224     highp int s3 = textureSize(bufSamp3);
    225 
    226     highp int s4 = imageSize(bufSamp4);
    227     highp int s5 = imageSize(bufSamp5);
    228     highp int s6 = imageSize(bufSamp6);
    229     
    230     highp vec4 f1 = texelFetch(bufSamp1, s1);
    231     highp ivec4 f2 = texelFetch(bufSamp2, s2);
    232     highp uvec4 f3 = texelFetch(bufSamp3, s3);
    233 }
    234 
    235 uniform writeonly imageCubeArray  badCA1;  // ERROR, reserved
    236 uniform writeonly iimageCubeArray badCA2;  // ERROR, reserved
    237 uniform writeonly uimageCubeArray badCA3;  // ERROR, reserved
    238 
    239 uniform samplerCubeArray          badCA4;  // ERROR, reserved
    240 uniform samplerCubeArrayShadow    badCA5;  // ERROR, reserved
    241 uniform isamplerCubeArray         badCA6;  // ERROR, reserved
    242 uniform usamplerCubeArray         badCA7;  // ERROR, reserved
    243 
    244 #extension GL_OES_texture_cube_map_array : enable
    245 
    246 uniform writeonly imageCubeArray  noPreCA1;   // ERROR, no default precision
    247 uniform writeonly iimageCubeArray noPreCA2;   // ERROR, no default precision
    248 uniform writeonly uimageCubeArray noPreCA3;   // ERROR, no default precision
    249 
    250 uniform samplerCubeArray          noPreCA4;   // ERROR, no default precision
    251 uniform samplerCubeArrayShadow    noPreCA5;   // ERROR, no default precision
    252 uniform isamplerCubeArray         noPreCA6;   // ERROR, no default precision
    253 uniform usamplerCubeArray         noPreCA7;   // ERROR, no default precision
    254 
    255 precision highp imageCubeArray        ;
    256 precision highp iimageCubeArray       ;
    257 precision highp uimageCubeArray       ;
    258 
    259 precision highp samplerCubeArray      ;
    260 precision highp samplerCubeArrayShadow;
    261 precision highp isamplerCubeArray     ;
    262 precision highp usamplerCubeArray     ;
    263 
    264 uniform writeonly imageCubeArray  CA1;
    265 uniform writeonly iimageCubeArray CA2;
    266 uniform writeonly uimageCubeArray CA3;
    267 
    268 layout(rgba16f) uniform readonly imageCubeArray  rCA1;
    269 layout(rgba32i) uniform readonly iimageCubeArray rCA2;
    270 layout(r32ui) uniform readonly uimageCubeArray rCA3;
    271 
    272 #ifdef GL_OES_texture_cube_map_array
    273 uniform samplerCubeArray          CA4;
    274 uniform samplerCubeArrayShadow    CA5;
    275 uniform isamplerCubeArray         CA6;
    276 uniform usamplerCubeArray         CA7;
    277 #endif
    278 
    279 void CAT()
    280 {
    281     highp ivec3 s4 = textureSize(CA4, 1);
    282     highp ivec3 s5 = textureSize(CA5, 1);
    283     highp ivec3 s6 = textureSize(CA6, 1);
    284     highp ivec3 s7 = textureSize(CA7, 1);
    285     
    286     highp vec4 t4 = texture(CA4, vec4(0.5));
    287     highp float t5 = texture(CA5, vec4(0.5), 3.0);
    288     highp ivec4 t6 = texture(CA6, vec4(0.5));
    289     highp uvec4 t7 = texture(CA7, vec4(0.5));
    290 
    291     highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
    292     highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
    293     highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
    294 
    295     highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
    296     highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
    297     highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
    298 
    299     highp vec4 gath4 = textureGather(CA4, vec4(0.5));
    300     highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
    301     highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
    302     highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
    303     highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
    304     highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
    305 
    306     highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
    307 
    308     highp ivec3 s1 = imageSize(CA1);
    309     highp ivec3 s2 = imageSize(CA2);
    310     highp ivec3 s3 = imageSize(CA3);
    311 
    312     imageStore(CA1, s3, vec4(1));
    313     imageStore(CA2, s3, ivec4(1));
    314     imageStore(CA3, s3, uvec4(1));
    315 
    316     highp vec4 cl1 = imageLoad(rCA1, s3);
    317     highp ivec4 cl2 = imageLoad(rCA2, s3);
    318     highp uvec4 cl3 = imageLoad(rCA3, s3);
    319 }
    320 
    321 uniform sampler2DMSArray  bad2DMS;    // ERROR, reserved
    322 uniform isampler2DMSArray bad2DMSi;   // ERROR, reserved
    323 uniform usampler2DMSArray bad2DMSu;   // ERROR, reserved
    324 
    325 #extension GL_OES_texture_storage_multisample_2d_array : enable
    326 
    327 #ifdef GL_OES_texture_storage_multisample_2d_array
    328 
    329 uniform sampler2DMSArray  noPrec2DMS;    // ERROR, no default
    330 uniform isampler2DMSArray noPrec2DMSi;   // ERROR, no default
    331 uniform usampler2DMSArray noPrec2DMSu;   // ERROR, no default
    332 
    333 #endif
    334 
    335 precision highp sampler2DMSArray;
    336 precision highp isampler2DMSArray;
    337 precision highp usampler2DMSArray;
    338 
    339 uniform sampler2DMSArray  samp2DMSA;
    340 uniform isampler2DMSArray samp2DMSAi;
    341 uniform usampler2DMSArray samp2DMSAu;
    342 
    343 void MSA()
    344 {
    345     vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
    346     ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
    347     uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
    348     
    349     ivec3 tfs = textureSize(samp2DMSA);
    350     ivec3 tfsi = textureSize(samp2DMSAi);
    351     ivec3 tfsb = textureSize(samp2DMSAi, 4);  // ERROR, no lod
    352     ivec3 tfsu = textureSize(samp2DMSAu);
    353 }
    354 
    355 #ifdef GL_OES_shader_image_atomic 
    356 #extension GL_OES_shader_image_atomic : enable
    357 #endif
    358 
    359 uniform layout(r32f)  highp  image2D im2Df;
    360 uniform layout(r32ui) highp uimage2D im2Du;
    361 uniform layout(r32i)  highp iimage2D im2Di;
    362 uniform ivec2 P;
    363 
    364 void goodImageAtom()
    365 {
    366     float datf;
    367     int dati;
    368     uint datu;
    369 
    370     imageAtomicAdd(     im2Di, P, dati);
    371     imageAtomicAdd(     im2Du, P, datu);
    372     imageAtomicMin(     im2Di, P, dati);
    373     imageAtomicMin(     im2Du, P, datu);
    374     imageAtomicMax(     im2Di, P, dati);
    375     imageAtomicMax(     im2Du, P, datu);
    376     imageAtomicAnd(     im2Di, P, dati);
    377     imageAtomicAnd(     im2Du, P, datu);
    378     imageAtomicOr(      im2Di, P, dati);
    379     imageAtomicOr(      im2Du, P, datu);
    380     imageAtomicXor(     im2Di, P, dati);
    381     imageAtomicXor(     im2Du, P, datu);
    382     imageAtomicExchange(im2Di, P, dati);
    383     imageAtomicExchange(im2Du, P, datu);
    384     imageAtomicExchange(im2Df, P, datf);
    385     imageAtomicCompSwap(im2Di, P,  3, dati);
    386     imageAtomicCompSwap(im2Du, P, 5u, datu);
    387 }
    388 
    389 sample out vec4 colorSampInBad;       // ERROR, reserved
    390 
    391 #extension GL_OES_shader_multisample_interpolation : enable
    392 
    393 sample out vec4 colorSample;
    394 flat sample out vec4 colorfsi;
    395 sample out vec3 sampInArray[4];
    396 in vec4 inv4;
    397 
    398 void badInterp()
    399 {
    400     interpolateAtCentroid(inv4);             // ERROR, wrong stage
    401     interpolateAtSample(inv4, 1);            // ERROR, need extension
    402     interpolateAtOffset(inv4, vec2(0.2));    // ERROR, need extension
    403 }
    404