glslang/Test/310.frag

71 lines
2.5 KiB
GLSL
Raw Normal View History

#version 310 es
precision mediump float;
precision highp usampler2D;
precision highp sampler2D;
precision highp isampler2DArray;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, not supported
layout(location = 2) in vec3 v3;
layout(location = 2) in mat4 yi; // ERROR, locations conflict with xi
uniform sampler2D arrayedSampler[5];
uniform usampler2D usamp2d;
uniform usampler2DRect samp2dr; // ERROR, reserved
uniform isampler2DArray isamp2DA;
in vec2 c2D;
uniform int i;
void main()
{
vec4 v = texture(arrayedSampler[i], c2D); // ERROR
ivec2 offsets[4];
const ivec2 constOffsets[4] = ivec2[4](ivec2(1,2), ivec2(3,4), ivec2(15,16), ivec2(-2,0));
uvec4 uv4 = textureGatherOffsets(samp2dr, c2D, offsets, 2); // ERROR, not supported
vec4 v4 = textureGather(arrayedSampler[0], c2D);
ivec4 iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 3);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), i); // ERROR, last argument not const
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 4); // ERROR, last argument out of range
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(1), 1+2);
iv4 = textureGatherOffset(isamp2DA, vec3(0.1), ivec2(i));
}
out vec4 outp;
void foo23()
{
const ivec2[3] offsets = ivec2[3](ivec2(1,2), ivec2(3,4), ivec2(15,16));
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(c2D)); // ERROR, offset not constant
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[1]);
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), offsets[2]); // ERROR, offset out of range
textureProjGradOffset(usamp2d, outp, vec2(0.0), vec2(0.0), ivec2(-10, 20)); // ERROR, offset out of range
if (gl_HelperInvocation)
++outp;
int sum = gl_MaxVertexImageUniforms +
gl_MaxFragmentImageUniforms +
gl_MaxComputeImageUniforms +
gl_MaxCombinedImageUniforms +
gl_MaxCombinedShaderOutputResources;
bool b1, b2, b3, b;
b1 = mix(b2, b3, b);
uvec3 um3 = mix(uvec3(i), uvec3(i), bvec3(b));
ivec4 im4 = mix(ivec4(i), ivec4(i), bvec4(b));
}
layout(binding=3) uniform sampler2D s1;
layout(binding=3) uniform sampler2D s2; // ERROR: overlapping bindings? Don't see that in the 310 spec.
layout(binding=2) uniform writeonly image2D i2D;
layout(binding = 1) uniform bb {
int foo;
layout(binding = 2) float f; // ERROR
} bbi;