John Kessenich | 8ec55cd | 2013-11-05 18:07:25 +0000 | [diff] [blame] | 1 | #version 150 core
|
| 2 |
|
| 3 | in vec4 gl_FragCoord;
|
| 4 | layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR
|
| 5 | layout(pixel_center_integer) in vec4 gl_FragCoord; // ERROR
|
| 6 | layout(origin_upper_left) in vec4 foo; // ERROR
|
| 7 | layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
|
| 8 |
|
| 9 | void main()
|
| 10 | {
|
| 11 | vec4 c = gl_FragCoord;
|
| 12 | }
|
| 13 |
|
John Kessenich | 5134b9c | 2013-11-20 21:12:43 +0000 | [diff] [blame] | 14 | layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, declared after use
|
John Kessenich | afda241 | 2013-12-04 20:41:33 +0000 | [diff] [blame] | 15 |
|
| 16 | in struct S { float f; } s;
|
John Kessenich | e8fe7b8 | 2013-12-18 18:47:12 +0000 | [diff] [blame] | 17 |
|
John Kessenich | e96ee85 | 2014-04-14 22:08:16 +0000 | [diff] [blame] | 18 | float patch = 3.1;
|
| 19 |
|
| 20 | uniform sampler2DMS sms;
|
| 21 | uniform isampler2DMS isms;
|
| 22 | uniform usampler2DMS usms;
|
| 23 | uniform sampler2DMSArray smsa;
|
| 24 | uniform isampler2DMSArray ismsa;
|
| 25 | uniform usampler2DMSArray usmsa;
|
| 26 |
|
| 27 | flat in ivec2 p2;
|
| 28 | flat in ivec3 p3;
|
| 29 | flat in int samp;
|
| 30 |
|
| 31 | void barWxyz()
|
| 32 | {
|
| 33 | ivec2 t11 = textureSize( sms);
|
| 34 | ivec2 t12 = textureSize(isms);
|
| 35 | ivec2 t13 = textureSize(usms);
|
| 36 | ivec3 t21 = textureSize( smsa);
|
| 37 | ivec3 t22 = textureSize(ismsa);
|
| 38 | ivec3 t23 = textureSize(usmsa);
|
| 39 | vec4 t31 = texelFetch( sms, p2, samp);
|
| 40 | ivec4 t32 = texelFetch(isms, p2, samp);
|
| 41 | uvec4 t33 = texelFetch(usms, p2, 3);
|
| 42 | vec4 t41 = texelFetch( smsa, p3, samp);
|
| 43 | ivec4 t42 = texelFetch(ismsa, ivec3(2), samp);
|
| 44 | uvec4 t43 = texelFetch(usmsa, p3, samp);
|
| 45 | }
|
Rex Xu | e553ace | 2015-12-07 19:07:17 +0800 | [diff] [blame] | 46 |
|
| 47 | int primitiveID()
|
| 48 | {
|
| 49 | return gl_PrimitiveID;
|
John Kessenich | 664ad41 | 2019-09-05 02:26:39 -0600 | [diff] [blame] | 50 | gl_PerFragment; // ERROR, block name can't get reused
|
Rex Xu | e553ace | 2015-12-07 19:07:17 +0800 | [diff] [blame] | 51 | }
|
Chow | a3c7a25 | 2019-11-26 17:27:33 +0800 | [diff] [blame] | 52 |
|
| 53 | in double type1; // ERROR
|
| 54 | #extension GL_ARB_gpu_shader_fp64 : enable
|
| 55 | double type2;
|
| 56 | double type3 = 2.0;
|
| 57 | int absTest = sqrt(type3);
|
| 58 | double absTest2 = sqrt(type3);
|
| 59 | double absTest3 = sqrt(2);
|
pmistryNV | 9f46e3d | 2020-04-17 04:24:12 -0700 | [diff] [blame] | 60 | float dk = sqrt(11);
|
| 61 |
|
| 62 | #extension GL_ARB_shader_bit_encoding: enable
|
| 63 |
|
| 64 | float f;
|
| 65 | vec4 v4;
|
| 66 | ivec4 iv4a;
|
| 67 | uvec2 uv2c;
|
| 68 | void bitEncodingPass()
|
| 69 | {
|
| 70 | int i = floatBitsToInt(f);
|
| 71 | uvec4 uv11 = floatBitsToUint(v4);
|
| 72 | vec4 v14 = intBitsToFloat(iv4a);
|
| 73 | vec2 v15 = uintBitsToFloat(uv2c);
|
| 74 | }
|
| 75 |
|
| 76 | #extension GL_ARB_shader_bit_encoding: disable
|
| 77 |
|
| 78 | void bitEncodingFail()
|
| 79 | {
|
| 80 | int i = floatBitsToInt(f); // Error, extention GL_ARB_bit_encoding is diabled
|
| 81 | }
|
pmistryNV | ea50f6d | 2020-04-27 01:46:32 -0700 | [diff] [blame] | 82 |
|
| 83 | #extension GL_ARB_shading_language_packing : enable
|
| 84 | vec2 v2a;
|
| 85 | uint uy;
|
| 86 |
|
| 87 | void packingPass()
|
| 88 | {
|
| 89 | uint u19 = packSnorm2x16(v2a);
|
| 90 | vec2 v20 = unpackSnorm2x16(uy);
|
| 91 | uint u15 = packUnorm2x16(v2a);
|
| 92 | vec2 v16 = unpackUnorm2x16(uy);
|
| 93 | uint u17 = packHalf2x16(v2a);
|
| 94 | vec2 v18 = unpackHalf2x16(uy);
|
| 95 | }
|
| 96 |
|
| 97 | #extension GL_ARB_shading_language_packing : disable
|
| 98 | void packingFail()
|
| 99 | {
|
| 100 | uint u19 = packSnorm2x16(v2a); // Error, extension GL_ARB_shading_language_packing is disabled
|
| 101 | }
|
pmistryNV | f03cb29 | 2020-04-27 22:46:54 -0700 | [diff] [blame] | 102 |
|
| 103 | // Testing extension GL_ARB_texture_query_lod
|
| 104 | uniform sampler1D samp1D;
|
| 105 | uniform sampler2DShadow samp2Ds;
|
| 106 |
|
| 107 | void qlodFail()
|
| 108 | {
|
| 109 | vec2 lod;
|
| 110 | float pf;
|
| 111 | vec2 pf2;
|
| 112 | vec3 pf3;
|
| 113 |
|
| 114 | lod = textureQueryLod(samp1D, pf); // ERROR, extension GL_ARB_texture_query_lod needed
|
| 115 | lod = textureQueryLod(samp2Ds, pf2); // ERROR, extension GL_ARB_texture_query_lod needed
|
| 116 | }
|
| 117 |
|
| 118 | #extension GL_ARB_texture_query_lod : enable
|
| 119 |
|
| 120 | uniform isampler2D isamp2D;
|
| 121 | uniform usampler3D usamp3D;
|
| 122 | uniform samplerCube sampCube;
|
| 123 | uniform isampler1DArray isamp1DA;
|
| 124 | uniform usampler2DArray usamp2DA;
|
| 125 |
|
| 126 | uniform sampler1DShadow samp1Ds;
|
| 127 | uniform samplerCubeShadow sampCubes;
|
| 128 | uniform sampler1DArrayShadow samp1DAs;
|
| 129 | uniform sampler2DArrayShadow samp2DAs;
|
| 130 |
|
| 131 | uniform samplerBuffer sampBuf;
|
| 132 | uniform sampler2DRect sampRect;
|
| 133 |
|
| 134 | void qlodPass()
|
| 135 | {
|
| 136 | vec2 lod;
|
| 137 | float pf;
|
| 138 | vec2 pf2;
|
| 139 | vec3 pf3;
|
| 140 |
|
| 141 | lod = textureQueryLod(samp1D, pf);
|
| 142 | lod = textureQueryLod(isamp2D, pf2);
|
| 143 | lod = textureQueryLod(usamp3D, pf3);
|
| 144 | lod = textureQueryLod(sampCube, pf3);
|
| 145 | lod = textureQueryLod(isamp1DA, pf);
|
| 146 | lod = textureQueryLod(usamp2DA, pf2);
|
| 147 |
|
| 148 | lod = textureQueryLod(samp1Ds, pf);
|
| 149 | lod = textureQueryLod(samp2Ds, pf2);
|
| 150 | lod = textureQueryLod(sampCubes, pf3);
|
| 151 | lod = textureQueryLod(samp1DAs, pf);
|
| 152 | lod = textureQueryLod(samp2DAs, pf2);
|
| 153 |
|
| 154 | lod = textureQueryLod(sampBuf, pf); // ERROR
|
| 155 | lod = textureQueryLod(sampRect, pf2); // ERROR
|
| 156 | }
|
pmistryNV | 2c53bae | 2020-04-30 21:41:33 -0700 | [diff] [blame] | 157 |
|
| 158 | // Test extension GL_EXT_shader_integer_mix
|
| 159 | #extension GL_EXT_shader_integer_mix : enable
|
| 160 | bool b1, b2, b;
|
| 161 | int x,y;
|
| 162 | uint z,w;
|
| 163 |
|
| 164 | void testmix()
|
| 165 | {
|
| 166 | int ival = mix(x, y, b);
|
| 167 | ivec2 iv2 = mix(ivec2(x), ivec2(y), bvec2(b));
|
| 168 | ivec3 iv3 = mix(ivec3(x), ivec3(y), bvec3(b));
|
| 169 | ivec4 iv4 = mix(ivec4(x), ivec4(x), bvec4(b));
|
| 170 | uint uiv = mix(z, w, b);
|
| 171 | uvec2 uv2 = mix(uvec2(z), uvec2(z), bvec2(b));
|
| 172 | uvec3 uv3 = mix(uvec3(z), uvec3(z), bvec3(b));
|
| 173 | uvec4 uv4 = mix(uvec4(z), uvec4(z), bvec4(b));
|
| 174 | bool bv = mix(b1, b2, b);
|
| 175 | bvec2 bv2 = mix(bvec2(b1), bvec2(b2), bvec2(b));
|
| 176 | bvec3 bv3 = mix(bvec3(b1), bvec3(b2), bvec3(b));
|
| 177 | bvec4 bv4 = mix(bvec4(b1), bvec4(b2), bvec4(b));
|
| 178 | }
|
| 179 |
|
| 180 | #extension GL_EXT_shader_integer_mix : disable
|
| 181 | void testmixFail()
|
| 182 | {
|
| 183 | int ival = mix(x, y, b); // Error since extenson GL_EXT_shader_integer_mix is disabled
|
| 184 | }
|