Commit 53863a3a by John Kessenich

GLSL: Implement version 320 for ES.

parent 9353f1af
#version 320 es
void main()
{
}
#version 320 es
out outbname { int a; } outbinst; // ERROR, not out block in fragment shader
in inbname {
int a;
vec4 v;
struct { int b; } s; // ERROR, nested struct definition
} inbinst;
in inbname2 {
layout(location = 12) int aAnon;
layout(location = 13) centroid in vec4 vAnon;
};
in layout(location = 13) vec4 aliased; // ERROR, aliased
in inbname2 { // ERROR, reuse of block name
int aAnon;
centroid in vec4 vAnon;
};
in badmember { // ERROR, aAnon already in global scope
int aAnon;
};
int inbname; // ERROR, redefinition of block name
vec4 vAnon; // ERROR, anon in global scope; redefinition
in arrayed {
float f;
} arrayedInst[4];
uniform int i;
void fooIO()
{
vec4 v = inbinst.v + vAnon;
v *= arrayedInst[2].f;
v *= arrayedInst[i].f;
}
in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord; // ERROR, non-ES
layout(early_fragment_tests) in;
out float gl_FragDepth;
layout(depth_any) out float gl_FragDepth; // ERROR, non-ES
void main()
{
gl_FragDepth = 0.2; // ERROR, early_fragment_tests declared
bool f = gl_FrontFacing;
}
out float gl_FragDepth;
void foo_GS()
{
highp int l = gl_Layer;
highp int p = gl_PrimitiveID;
}
in vec2 inf, ing;
uniform ivec2 offsets[4];
uniform sampler2D sArray[4];
uniform int sIndex;
layout(binding = 0) uniform atomic_uint auArray[2];
uniform ubName { int i; } ubInst[4];
buffer bbName { int i; } bbInst[4];
highp uniform writeonly image2D iArray[5];
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
void pfoo()
{
precise vec2 h;
h = fma(inf, ing, h);
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
precision highp imageCubeArray ;
precision highp iimageCubeArray ;
precision highp uimageCubeArray ;
precision highp samplerCubeArray ;
precision highp samplerCubeArrayShadow;
precision highp isamplerCubeArray ;
precision highp usamplerCubeArray ;
uniform writeonly imageCubeArray CA1;
uniform writeonly iimageCubeArray CA2;
uniform writeonly uimageCubeArray CA3;
#ifdef GL_EXT_texture_cube_map_array
uniform samplerCubeArray CA4;
uniform samplerCubeArrayShadow CA5;
uniform isamplerCubeArray CA6;
uniform usamplerCubeArray CA7;
#endif
void CAT()
{
highp vec4 b4 = texture(CA4, vec4(0.5), 0.24);
highp ivec4 b6 = texture(CA6, vec4(0.5), 0.26);
highp uvec4 b7 = texture(CA7, vec4(0.5), 0.27);
}
void goodSample()
{
lowp int a1 = gl_SampleID;
mediump vec2 a2 = gl_SamplePosition;
highp int a3 = gl_SampleMaskIn[0];
gl_SampleMask[0] = a3;
mediump int n1 = gl_MaxSamples;
mediump int n2 = gl_NumSamples;
}
uniform layout(r32f) highp image2D im2Df;
uniform layout(r32ui) highp uimage2D im2Du;
uniform layout(r32i) highp iimage2D im2Di;
uniform ivec2 P;
uniform layout(rgba32f) highp image2D badIm2Df; // ERROR, needs readonly or writeonly
uniform layout(rgba8ui) highp uimage2D badIm2Du; // ERROR, needs readonly or writeonly
uniform layout(rgba16i) highp iimage2D badIm2Di; // ERROR, needs readonly or writeonly
void goodImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati);
imageAtomicAdd( im2Du, P, datu);
imageAtomicMin( im2Di, P, dati);
imageAtomicMin( im2Du, P, datu);
imageAtomicMax( im2Di, P, dati);
imageAtomicMax( im2Du, P, datu);
imageAtomicAnd( im2Di, P, dati);
imageAtomicAnd( im2Du, P, datu);
imageAtomicOr( im2Di, P, dati);
imageAtomicOr( im2Du, P, datu);
imageAtomicXor( im2Di, P, dati);
imageAtomicXor( im2Du, P, datu);
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
imageAtomicMax(badIm2Di, P, dati); // ERROR, not an allowed layout() on the image
imageAtomicMax(badIm2Du, P, datu); // ERROR, not an allowed layout() on the image
imageAtomicExchange(badIm2Df, P, datf); // ERROR, not an allowed layout() on the image
}
centroid out vec4 colorCentroidBad; // ERROR
flat out vec4 colorBadFlat; // ERROR
smooth out vec4 colorBadSmooth; // ERROR
noperspective out vec4 colorBadNo; // ERROR
flat centroid in vec2 colorfc;
in float scalarIn;
sample in vec4 colorSampIn;
sample out vec4 colorSampleBad; // ERROR
flat sample in vec4 colorfsi;
sample in vec3 sampInArray[4];
void interp()
{
float res;
vec2 res2;
vec3 res3;
vec4 res4;
res2 = interpolateAtCentroid(colorfc);
res4 = interpolateAtCentroid(colorSampIn);
res4 = interpolateAtCentroid(colorfsi);
res = interpolateAtCentroid(scalarIn);
res3 = interpolateAtCentroid(sampInArray); // ERROR
res3 = interpolateAtCentroid(sampInArray[2]);
res2 = interpolateAtCentroid(sampInArray[2].xy); // ERROR
res3 = interpolateAtSample(sampInArray, 1); // ERROR
res3 = interpolateAtSample(sampInArray[i], 0);
res2 = interpolateAtSample(sampInArray[2].xy, 2); // ERROR
res = interpolateAtSample(scalarIn, 1);
res3 = interpolateAtOffset(sampInArray, vec2(0.2)); // ERROR
res3 = interpolateAtOffset(sampInArray[2], vec2(0.2));
res2 = interpolateAtOffset(sampInArray[2].xy, vec2(0.2)); // ERROR, no swizzle
res = interpolateAtOffset(scalarIn + scalarIn, vec2(0.2)); // ERROR, no binary ops other than dereference
res = interpolateAtOffset(scalarIn, vec2(0.2));
float f;
res = interpolateAtCentroid(f); // ERROR, not interpolant
res4 = interpolateAtSample(outp, 0); // ERROR, not interpolant
}
layout(blend_support_multiply) out;
layout(blend_support_screen) out;
layout(blend_support_overlay) out;
layout(blend_support_darken, blend_support_lighten) out;
layout(blend_support_colordodge) layout(blend_support_colorburn) out;
layout(blend_support_hardlight) out;
layout(blend_support_softlight) out;
layout(blend_support_difference) out;
layout(blend_support_exclusion) out;
layout(blend_support_hsl_hue) out;
layout(blend_support_hsl_saturation) out;
layout(blend_support_hsl_color) out;
layout(blend_support_hsl_luminosity) out;
layout(blend_support_all_equations) out;
layout(blend_support_hsl_luminosity) out; // okay to repeat
layout(blend_support_hsl_luminosity) in; // ERROR, only on "out"
layout(blend_support_hsl_luminosity) out vec4; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) out vec4 badout; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) struct badS {int i;}; // ERROR, only on standalone
layout(blend_support_hsl_luminosity) void blendFoo() { } // ERROR, only on standalone
void blendFoo(layout(blend_support_hsl_luminosity) vec3 v) { } // ERROR, only on standalone
layout(blend_support_flizbit) out; // ERROR, no flizbit
out vec4 outAA[2][2]; // ERROR
#version 320 es
precision mediump float;
in fromVertex {
in vec3 color;
} fromV[];
in vec4 nonBlockUnsized[];
out toFragment {
out vec3 color;
} toF;
out fromVertex { // okay to reuse a block name for another block name
vec3 color;
};
out fooB { // ERROR, cannot reuse block name as block instance
vec2 color;
} fromVertex;
int fromVertex; // ERROR, cannot reuse a block name for something else
out fooC { // ERROR, cannot have same name for block and instance name
vec2 color;
} fooC;
void main()
{
EmitVertex();
EndPrimitive();
EmitStreamVertex(1); // ERROR
EndStreamPrimitive(0); // ERROR
color = fromV[0].color;
gl_ClipDistance[3] = // ERROR, no ClipDistance
gl_in[1].gl_ClipDistance[2]; // ERROR, no ClipDistance
gl_Position = gl_in[0].gl_Position;
gl_PrimitiveID = gl_PrimitiveIDIn;
gl_Layer = 2;
}
layout(stream = 4) out vec4 ov4; // ERROR, no streams
layout(line_strip, points, triangle_strip, points, triangle_strip) out; // just means triangle_strip"
out ooutb { vec4 a; } ouuaa6;
layout(max_vertices = 200) out;
layout(max_vertices = 300) out; // ERROR, too big
void foo(layout(max_vertices = 4) int a) // ERROR
{
ouuaa6.a = vec4(1.0);
}
layout(line_strip, points, triangle_strip, points) out; // ERROR, changing output primitive
layout(line_strip, points) out; // ERROR, changing output primitive
layout(triangle_strip) in; // ERROR, not an input primitive
layout(triangle_strip) uniform; // ERROR
layout(triangle_strip) out vec4 badv4; // ERROR, not on a variable
layout(triangle_strip) in vec4 bad2v4[]; // ERROR, not on a variable or input
layout(invocations = 3) out outbn { int a; }; // 2 ERROR, not on a block, not until 4.0
out outbn2 {
layout(invocations = 3) int a; // 2 ERRORs, not on a block member, not until 4.0
layout(max_vertices = 3) int b; // ERROR, not on a block member
layout(triangle_strip) int c; // ERROR, not on a block member
} outbi;
layout(lines) out; // ERROR, not on output
layout(lines_adjacency) in;
layout(triangles) in; // ERROR, can't change it
layout(triangles_adjacency) in; // ERROR, can't change it
layout(invocations = 4) in;
in sameName {
int a15;
} insn[];
out sameName {
float f15;
};
uniform sameName {
bool b15;
};
const int summ = gl_MaxVertexAttribs +
gl_MaxGeometryInputComponents +
gl_MaxGeometryOutputComponents +
gl_MaxGeometryImageUniforms +
gl_MaxGeometryTextureImageUnits +
gl_MaxGeometryOutputVertices +
gl_MaxGeometryTotalOutputComponents +
gl_MaxGeometryUniformComponents +
gl_MaxGeometryAtomicCounters +
gl_MaxGeometryAtomicCounterBuffers +
gl_MaxVertexTextureImageUnits +
gl_MaxCombinedTextureImageUnits +
gl_MaxTextureImageUnits +
gl_MaxDrawBuffers;
void fooe1()
{
gl_ViewportIndex; // ERROR, not in ES
gl_MaxViewports; // ERROR, not in ES
insn.length(); // 4: lines_adjacency
int inv = gl_InvocationID;
}
in vec4 explArray[4];
in vec4 explArrayBad[5]; // ERROR, wrong size
in vec4 nonArrayed; // ERROR, not an array
flat out vec3 myColor1;
centroid out vec3 myColor2;
centroid in vec3 centr[];
sample out vec4 perSampleColor; // ERROR without sample extensions
layout(max_vertices = 200) out; // matching redecl
layout(location = 7, component = 2) in float comp[]; // ERROR, es has no component
void notHere()
{
gl_MaxGeometryVaryingComponents; // ERROR, not in ES
gl_VerticesIn; // ERROR, not in ES
}
void pointSize2()
{
highp float ps = gl_in[3].gl_PointSize; // ERROR, need extension
gl_PointSize = ps; // ERROR, need extension
}
#version 320 es
layout(vertices = 4) out;
out int outa[gl_out.length()];
layout(quads) in; // ERROR
layout(ccw) out; // ERROR
layout(fractional_even_spacing) in; // ERROR
patch in vec4 patchIn; // ERROR
patch out vec4 patchOut;
void main()
{
barrier();
int a = gl_MaxTessControlInputComponents +
gl_MaxTessControlOutputComponents +
gl_MaxTessControlTextureImageUnits +
gl_MaxTessControlUniformComponents +
gl_MaxTessControlTotalOutputComponents;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
int iid = gl_InvocationID;
gl_out[gl_InvocationID].gl_Position = p;
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
gl_out[gl_InvocationID].gl_ClipDistance[1] = cd; // ERROR, not in ES
gl_TessLevelOuter[3] = 3.2;
gl_TessLevelInner[1] = 1.3;
if (a > 10)
barrier(); // ERROR
else
barrier(); // ERROR
barrier();
do {
barrier(); // ERROR
} while (a > 10);
switch (a) {
default:
barrier(); // ERROR
break;
}
a < 12 ? a : (barrier(), a); // ERROR
{
barrier();
}
return;
barrier(); // ERROR
}
layout(vertices = 4) in; // ERROR, not on in
layout(vertices = 5) out; // ERROR, changing #
void foo()
{
gl_out[4].gl_Position; // ERROR, out of range
barrier(); // ERROR, not in main
}
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
patch out float implA[]; // ERROR, not sized
#extension GL_ARB_separate_shader_objects : enable
layout(location = 3) in vec4 ivla[];
layout(location = 4) in vec4 ivlb[];
layout(location = 4) in vec4 ivlc[]; // ERROR, overlapping
layout(location = 3) out vec4 ovla[];
layout(location = 4) out vec4 ovlb[];
layout(location = 4) out vec4 ovlc[]; // ERROR, overlapping
patch out pinbn {
int a;
} pinbi;
centroid out vec3 myColor2[];
centroid in vec3 centr[];
sample out vec4 perSampleColor[];
layout(vertices = 4) out float badlay[]; // ERROR, not on a variable
out float misSized[5]; // ERROR, size doesn't match
out float okaySize[4];
void pointSize2()
{
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
gl_out[gl_InvocationID].gl_PointSize = ps; // ERROR, need point_size extension
}
precise vec3 pv3;
void goodfoop()
{
precise float d;
pv3 *= pv3;
pv3 = fma(pv3, pv3, pv3);
d = fma(d, d, d);
}
void bb()
{
gl_BoundingBoxOES[0] = vec4(0.0);
gl_BoundingBoxOES[1] = vec4(1.0);
gl_BoundingBoxOES[2] = vec4(2.0); // ERROR, overflow
}
out patch badpatchBName { // ERROR, array size required
float f;
} badpatchIName[];
out patch patchBName {
float f;
} patchIName[4];
void outputtingOutparam(out int a)
{
a = 2;
}
void outputting()
{
outa[gl_InvocationID] = 2;
outa[1] = 2; // ERROR, not gl_InvocationID
gl_out[0].gl_Position = vec4(1.0); // ERROR, not gl_InvocationID
outa[1];
gl_out[0];
outputtingOutparam(outa[0]); // ERROR, not gl_InvocationID
outputtingOutparam(outa[gl_InvocationID]);
patchIName[1].f = 3.14;
outa[(gl_InvocationID)] = 2;
}
#version 320 es
layout(vertices = 4) out; // ERROR
layout(quads, cw) in;
layout(triangles) in; // ERROR
layout(isolines) in; // ERROR
layout(ccw) in; // ERROR
layout(cw) in;
layout(fractional_odd_spacing) in;
layout(equal_spacing) in; // ERROR
layout(fractional_even_spacing) in; // ERROR
layout(point_mode) in;
patch in vec4 patchIn;
patch out vec4 patchOut; // ERROR
void main()
{
barrier(); // ERROR
int a = gl_MaxTessEvaluationInputComponents +
gl_MaxTessEvaluationOutputComponents +
gl_MaxTessEvaluationTextureImageUnits +
gl_MaxTessEvaluationUniformComponents +
gl_MaxTessPatchComponents +
gl_MaxPatchVertices +
gl_MaxTessGenLevel;
vec4 p = gl_in[1].gl_Position;
float ps = gl_in[1].gl_PointSize; // ERROR, need point_size extension
float cd = gl_in[1].gl_ClipDistance[2]; // ERROR, not in ES
int pvi = gl_PatchVerticesIn;
int pid = gl_PrimitiveID;
vec3 tc = gl_TessCoord;
float tlo = gl_TessLevelOuter[3];
float tli = gl_TessLevelInner[1];
gl_Position = p;
gl_PointSize = ps; // ERROR, need point_size extension
gl_ClipDistance[2] = cd; // ERROR, not in ES
}
smooth patch in vec4 badp1; // ERROR
flat patch in vec4 badp2; // ERROR
noperspective patch in vec4 badp3; // ERROR
patch sample in vec3 badp4; // ERROR
#extension GL_ARB_separate_shader_objects : enable
in gl_PerVertex // ERROR, no size
{
vec4 gl_Position;
} gl_in[];
in gl_PerVertex // ERROR, second redeclaration of gl_in
{
vec4 gl_Position;
} gl_in[];
layout(quads, cw) out; // ERROR
layout(triangles) out; // ERROR
layout(isolines) out; // ERROR
layout(cw) out; // ERROR
layout(fractional_odd_spacing) out; // ERROR
layout(equal_spacing) out; // ERROR
layout(fractional_even_spacing) out; // ERROR
layout(point_mode) out; // ERROR
in vec2 ina; // ERROR, not array
in vec2 inb[];
in vec2 inc[18]; // ERROR, wrong size
in vec2 ind[gl_MaxPatchVertices];
in testbla { // ERROR, not array
int f;
} bla;
in testblb {
int f;
} blb[];
in testblc { // ERROR wrong size
int f;
} blc[18];
in testbld {
int f;
} bld[gl_MaxPatchVertices];
layout(location = 23) in vec4 ivla[];
layout(location = 24) in vec4 ivlb[];
layout(location = 24) in vec4 ivlc[]; // ERROR, overlap
layout(location = 23) out vec4 ovla[2];
layout(location = 24) out vec4 ovlb[2]; // ERROR, overlap
in float gl_TessLevelOuter[4]; // ERROR, can't redeclare
patch in pinbn {
int a;
} pinbi;
centroid out vec3 myColor2;
centroid in vec3 centr[];
sample out vec4 perSampleColor;
void bbbad()
{
gl_BoundingBoxOES; // ERROR, wrong stage
}
#version 320 es
out outbname {
int a;
out vec4 v;
highp sampler2D s; // ERROR, opaque type
} outbinst;
out outbname2 {
layout(location = 12) int aAnon;
layout(location = 13) vec4 vAnon;
};
layout(location = 12) out highp int aliased; // ERROR, aliasing location
in inbname { int a; } inbinst; // ERROR, no in block in vertex shader
out gl_PerVertex { // ERROR, has extra member
highp vec4 gl_Position;
highp vec4 t;
};
void main()
{
int sum = gl_VertexID +
gl_InstanceID;
gl_Position = vec4(1.0);
gl_PointSize = 2.0; // ERROR, removed by redeclaration
}
out gl_PerVertex { // ERROR, already used and already redeclared
highp vec4 gl_Position;
highp vec4 t;
};
smooth out smo { // ERROR, no smooth on a block
int i;
} smon;
flat out fmo { // ERROR, no flat on a block
int i;
} fmon;
centroid out cmo { // ERROR, no centroid on a block
int i;
} cmon;
invariant out imo { // ERROR, no invariant on a block
int i;
} imon;
in vec2 inf, ing;
uniform ivec2 offsets[4];
uniform sampler2D sArray[4];
uniform int sIndex;
layout(binding = 0) uniform atomic_uint auArray[2];
uniform ubName { int i; } ubInst[4];
buffer bbName { int i; } bbInst[4];
highp uniform writeonly image2D iArray[5];
const ivec2 constOffsets[4] = ivec2[4](ivec2(0.1), ivec2(0.2), ivec2(0.3), ivec2(0.4));
void pfoo()
{
precise vec2 h;
h = fma(inf, ing, h);
sArray[sIndex + 1];
ubInst[sIndex + 1];
bbInst[sIndex - 2]; // ERROR, still not supported
iArray[2];
iArray[sIndex - 2];
textureGatherOffset(sArray[0], vec2(0.1), ivec2(inf));
textureGatherOffsets(sArray[0], vec2(0.1), constOffsets);
textureGatherOffsets(sArray[0], vec2(0.1), offsets); // ERROR, offset not constant
}
uniform samplerBuffer noPreSamp1; // ERROR, no default precision
uniform isamplerBuffer noPreSamp2; // ERROR, no default precision
uniform usamplerBuffer noPreSamp3; // ERROR, no default precision
uniform writeonly imageBuffer noPreSamp4; // ERROR, no default precision
uniform writeonly iimageBuffer noPreSamp5; // ERROR, no default precision
uniform writeonly uimageBuffer noPreSamp6; // ERROR, no default precision
precision highp samplerBuffer;
precision highp isamplerBuffer;
precision highp usamplerBuffer;
precision highp imageBuffer;
precision highp iimageBuffer;
precision highp uimageBuffer;
#ifdef GL_OES_texture_buffer
uniform samplerBuffer bufSamp1;
uniform isamplerBuffer bufSamp2;
uniform usamplerBuffer bufSamp3;
#endif
#ifdef GL_EXT_texture_buffer
uniform writeonly imageBuffer bufSamp4;
uniform writeonly iimageBuffer bufSamp5;
uniform writeonly uimageBuffer bufSamp6;
#endif
void bufferT()
{
highp int s1 = textureSize(bufSamp1);
highp int s2 = textureSize(bufSamp2);
highp int s3 = textureSize(bufSamp3);
highp int s4 = imageSize(bufSamp4);
highp int s5 = imageSize(bufSamp5);
highp int s6 = imageSize(bufSamp6);
highp vec4 f1 = texelFetch(bufSamp1, s1);
highp ivec4 f2 = texelFetch(bufSamp2, s2);
highp uvec4 f3 = texelFetch(bufSamp3, s3);
}
uniform writeonly imageCubeArray noPreCA1; // ERROR, no default precision
uniform writeonly iimageCubeArray noPreCA2; // ERROR, no default precision
uniform writeonly uimageCubeArray noPreCA3; // ERROR, no default precision
uniform samplerCubeArray noPreCA4; // ERROR, no default precision
uniform samplerCubeArrayShadow noPreCA5; // ERROR, no default precision
uniform isamplerCubeArray noPreCA6; // ERROR, no default precision
uniform usamplerCubeArray noPreCA7; // ERROR, no default precision
precision highp imageCubeArray ;
precision highp iimageCubeArray ;
precision highp uimageCubeArray ;
precision highp samplerCubeArray ;
precision highp samplerCubeArrayShadow;
precision highp isamplerCubeArray ;
precision highp usamplerCubeArray ;
uniform writeonly imageCubeArray CA1;
uniform writeonly iimageCubeArray CA2;
uniform writeonly uimageCubeArray CA3;
layout(rgba16f) uniform readonly imageCubeArray rCA1;
layout(rgba32i) uniform readonly iimageCubeArray rCA2;
layout(r32ui) uniform readonly uimageCubeArray rCA3;
#ifdef GL_OES_texture_cube_map_array
uniform samplerCubeArray CA4;
uniform samplerCubeArrayShadow CA5;
uniform isamplerCubeArray CA6;
uniform usamplerCubeArray CA7;
#endif
void CAT()
{
highp ivec3 s4 = textureSize(CA4, 1);
highp ivec3 s5 = textureSize(CA5, 1);
highp ivec3 s6 = textureSize(CA6, 1);
highp ivec3 s7 = textureSize(CA7, 1);
highp vec4 t4 = texture(CA4, vec4(0.5));
highp float t5 = texture(CA5, vec4(0.5), 3.0);
highp ivec4 t6 = texture(CA6, vec4(0.5));
highp uvec4 t7 = texture(CA7, vec4(0.5));
highp vec4 L4 = textureLod(CA4, vec4(0.5), 0.24);
highp ivec4 L6 = textureLod(CA6, vec4(0.5), 0.26);
highp uvec4 L7 = textureLod(CA7, vec4(0.5), 0.27);
highp vec4 g4 = textureGrad(CA4, vec4(0.5), vec3(0.1), vec3(0.2));
highp ivec4 g6 = textureGrad(CA6, vec4(0.5), vec3(0.1), vec3(0.2));
highp uvec4 g7 = textureGrad(CA7, vec4(0.5), vec3(0.1), vec3(0.2));
highp vec4 gath4 = textureGather(CA4, vec4(0.5));
highp vec4 gathC4 = textureGather(CA4, vec4(0.5), 2);
highp ivec4 gath6 = textureGather(CA6, vec4(0.5));
highp ivec4 gathC6 = textureGather(CA6, vec4(0.5), 1);
highp uvec4 gath7 = textureGather(CA7, vec4(0.5));
highp uvec4 gathC7 = textureGather(CA7, vec4(0.5), 0);
highp vec4 gath5 = textureGather(CA5, vec4(0.5), 2.5);
highp ivec3 s1 = imageSize(CA1);
highp ivec3 s2 = imageSize(CA2);
highp ivec3 s3 = imageSize(CA3);
imageStore(CA1, s3, vec4(1));
imageStore(CA2, s3, ivec4(1));
imageStore(CA3, s3, uvec4(1));
highp vec4 cl1 = imageLoad(rCA1, s3);
highp ivec4 cl2 = imageLoad(rCA2, s3);
highp uvec4 cl3 = imageLoad(rCA3, s3);
}
uniform sampler2DMSArray noPrec2DMS; // ERROR, no default
uniform isampler2DMSArray noPrec2DMSi; // ERROR, no default
uniform usampler2DMSArray noPrec2DMSu; // ERROR, no default
precision highp sampler2DMSArray;
precision highp isampler2DMSArray;
precision highp usampler2DMSArray;
uniform sampler2DMSArray samp2DMSA;
uniform isampler2DMSArray samp2DMSAi;
uniform usampler2DMSArray samp2DMSAu;
void MSA()
{
vec4 tf = texelFetch(samp2DMSA, ivec3(5), 2);
ivec4 tfi = texelFetch(samp2DMSAi, ivec3(5), 2);
uvec4 tfu = texelFetch(samp2DMSAu, ivec3(5), 2);
ivec3 tfs = textureSize(samp2DMSA);
ivec3 tfsi = textureSize(samp2DMSAi);
ivec3 tfsb = textureSize(samp2DMSAi, 4); // ERROR, no lod
ivec3 tfsu = textureSize(samp2DMSAu);
}
uniform layout(r32f) highp image2D im2Df;
uniform layout(r32ui) highp uimage2D im2Du;
uniform layout(r32i) highp iimage2D im2Di;
uniform ivec2 P;
void goodImageAtom()
{
float datf;
int dati;
uint datu;
imageAtomicAdd( im2Di, P, dati);
imageAtomicAdd( im2Du, P, datu);
imageAtomicMin( im2Di, P, dati);
imageAtomicMin( im2Du, P, datu);
imageAtomicMax( im2Di, P, dati);
imageAtomicMax( im2Du, P, datu);
imageAtomicAnd( im2Di, P, dati);
imageAtomicAnd( im2Du, P, datu);
imageAtomicOr( im2Di, P, dati);
imageAtomicOr( im2Du, P, datu);
imageAtomicXor( im2Di, P, dati);
imageAtomicXor( im2Du, P, datu);
imageAtomicExchange(im2Di, P, dati);
imageAtomicExchange(im2Du, P, datu);
imageAtomicExchange(im2Df, P, datf);
imageAtomicCompSwap(im2Di, P, 3, dati);
imageAtomicCompSwap(im2Du, P, 5u, datu);
}
sample out vec4 colorSample;
flat sample out vec4 colorfsi;
sample out vec3 sampInArray[4];
in vec4 inv4;
void badInterp()
{
interpolateAtCentroid(inv4); // ERROR, wrong stage
interpolateAtSample(inv4, 1); // ERROR, need extension
interpolateAtOffset(inv4, vec2(0.2)); // ERROR, need extension
}
...@@ -123,7 +123,7 @@ ERROR: 0:391: 'interpolateAtOffset' : first argument must be an interpolant, or ...@@ -123,7 +123,7 @@ ERROR: 0:391: 'interpolateAtOffset' : first argument must be an interpolant, or
ERROR: 0:392: 'interpolateAtOffset' : first argument must be an interpolant, or interpolant-array element ERROR: 0:392: 'interpolateAtOffset' : first argument must be an interpolant, or interpolant-array element
ERROR: 0:396: 'interpolateAtCentroid' : first argument must be an interpolant, or interpolant-array element ERROR: 0:396: 'interpolateAtCentroid' : first argument must be an interpolant, or interpolant-array element
ERROR: 0:397: 'interpolateAtSample' : first argument must be an interpolant, or interpolant-array element ERROR: 0:397: 'interpolateAtSample' : first argument must be an interpolant, or interpolant-array element
ERROR: 0:400: 'blend equation' : required extension not requested: GL_KHR_blend_equation_advanced ERROR: 0:400: 'blend equation' : not supported for this version or the enabled extensions
ERROR: 0:423: 'blend equation' : can only apply to 'out' ERROR: 0:423: 'blend equation' : can only apply to 'out'
ERROR: 0:424: 'blend equation' : can only apply to a standalone qualifier ERROR: 0:424: 'blend equation' : can only apply to a standalone qualifier
ERROR: 0:425: 'blend equation' : can only apply to a standalone qualifier ERROR: 0:425: 'blend equation' : can only apply to a standalone qualifier
......
320.comp
Shader version: 320
local_size = (1, 1, 1)
0:? Sequence
0:3 Function Definition: main( ( global void)
0:3 Function Parameters:
0:? Linker Objects
Linked compute stage:
Shader version: 320
local_size = (1, 1, 1)
0:? Sequence
0:3 Function Definition: main( ( global void)
0:3 Function Parameters:
0:? Linker Objects
...@@ -5316,13 +5316,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -5316,13 +5316,14 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5); if (version == 310)
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
} }
if (version >= 310) if (version == 310)
symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);
} }
if (profile == EEsProfile) { if (profile == EEsProfile && version < 320) {
symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);
symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic);
symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic);
...@@ -5357,8 +5358,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -5357,8 +5358,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
case EShLangTessControl: case EShLangTessControl:
if (profile == EEsProfile && version >= 310) { if (profile == EEsProfile && version >= 310) {
symbolTable.setVariableExtensions("gl_BoundingBoxOES", Num_AEP_primitive_bounding_box, AEP_primitive_bounding_box);
BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable); BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable);
if (version < 320)
symbolTable.setVariableExtensions("gl_BoundingBoxOES", Num_AEP_primitive_bounding_box,
AEP_primitive_bounding_box);
} }
// Fall through // Fall through
...@@ -5505,7 +5508,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -5505,7 +5508,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable); BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable);
BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable); BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable);
BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable); BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);
if (profile == EEsProfile) { if (profile == EEsProfile && version < 320) {
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables); symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables); symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables);
symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables); symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables);
...@@ -5539,14 +5542,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -5539,14 +5542,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod); symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod); symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod); symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5); if (version < 320)
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
} }
if (version == 100) { if (version == 100) {
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives); symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives);
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives); symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives);
symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives); symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives);
} }
if (version >= 310) { if (version == 310) {
symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5); symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);
symbolTable.setFunctionExtensions("interpolateAtCentroid", 1, &E_GL_OES_shader_multisample_interpolation); symbolTable.setFunctionExtensions("interpolateAtCentroid", 1, &E_GL_OES_shader_multisample_interpolation);
symbolTable.setFunctionExtensions("interpolateAtSample", 1, &E_GL_OES_shader_multisample_interpolation); symbolTable.setFunctionExtensions("interpolateAtSample", 1, &E_GL_OES_shader_multisample_interpolation);
...@@ -5675,12 +5679,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion ...@@ -5675,12 +5679,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth); symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
if (profile == EEsProfile) { if (profile == EEsProfile && version < 320) {
symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader); symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);
symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader); symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader);
} }
if (profile == EEsProfile) { if (profile == EEsProfile && version < 320) {
symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);
symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic);
symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic); symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic);
......
...@@ -383,7 +383,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn ...@@ -383,7 +383,8 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
if (base->getQualifier().storage == EvqBuffer) if (base->getQualifier().storage == EvqBuffer)
requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array"); requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array");
else if (base->getQualifier().storage == EvqUniform) else if (base->getQualifier().storage == EvqUniform)
profileRequires(base->getLoc(), EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, "variable indexing uniform block array"); profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5,
"variable indexing uniform block array");
else { else {
// input/output blocks either don't exist or can be variable indexed // input/output blocks either don't exist or can be variable indexed
} }
...@@ -392,7 +393,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn ...@@ -392,7 +393,7 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
else if (base->getBasicType() == EbtSampler && version >= 130) { else if (base->getBasicType() == EbtSampler && version >= 130) {
const char* explanation = "variable indexing sampler array"; const char* explanation = "variable indexing sampler array";
requireProfile(base->getLoc(), EEsProfile | ECoreProfile | ECompatibilityProfile, explanation); requireProfile(base->getLoc(), EEsProfile | ECoreProfile | ECompatibilityProfile, explanation);
profileRequires(base->getLoc(), EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, explanation); profileRequires(base->getLoc(), EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5, explanation);
profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation); profileRequires(base->getLoc(), ECoreProfile | ECompatibilityProfile, 400, nullptr, explanation);
} }
...@@ -1417,7 +1418,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan ...@@ -1417,7 +1418,8 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
else else
profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature);
if (! (*argp)[fnCandidate[0].type->getSampler().shadow ? 3 : 2]->getAsConstantUnion()) if (! (*argp)[fnCandidate[0].type->getSampler().shadow ? 3 : 2]->getAsConstantUnion())
profileRequires(loc, EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, "non-constant offset argument"); profileRequires(loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5,
"non-constant offset argument");
if (! fnCandidate[0].type->getSampler().shadow) if (! fnCandidate[0].type->getSampler().shadow)
compArg = 3; compArg = 3;
break; break;
...@@ -1631,7 +1633,8 @@ void TParseContext::nonOpBuiltInCheck(const TSourceLoc& loc, const TFunction& fn ...@@ -1631,7 +1633,8 @@ void TParseContext::nonOpBuiltInCheck(const TSourceLoc& loc, const TFunction& fn
profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature); profileRequires(loc, ~EEsProfile, 400, E_GL_ARB_gpu_shader5, feature);
int offsetArg = fnCandidate[0].type->getSampler().shadow ? 3 : 2; int offsetArg = fnCandidate[0].type->getSampler().shadow ? 3 : 2;
if (! callNode.getSequence()[offsetArg]->getAsConstantUnion()) if (! callNode.getSequence()[offsetArg]->getAsConstantUnion())
profileRequires(loc, EEsProfile, 0, Num_AEP_gpu_shader5, AEP_gpu_shader5, "non-constant offset argument"); profileRequires(loc, EEsProfile, 320, Num_AEP_gpu_shader5, AEP_gpu_shader5,
"non-constant offset argument");
if (! fnCandidate[0].type->getSampler().shadow) if (! fnCandidate[0].type->getSampler().shadow)
compArg = 3; compArg = 3;
} else if (fnCandidate.getName().compare("textureGatherOffsets") == 0) { } else if (fnCandidate.getName().compare("textureGatherOffsets") == 0) {
...@@ -3016,19 +3019,22 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua ...@@ -3016,19 +3019,22 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
switch (language) { switch (language) {
case EShLangGeometry: case EShLangGeometry:
if (qualifier.storage == EvqVaryingIn) if (qualifier.storage == EvqVaryingIn)
if (extensionsTurnedOn(Num_AEP_geometry_shader, AEP_geometry_shader)) if ((profile == EEsProfile && version >= 320) ||
extensionsTurnedOn(Num_AEP_geometry_shader, AEP_geometry_shader))
return; return;
break; break;
case EShLangTessControl: case EShLangTessControl:
if ( qualifier.storage == EvqVaryingIn || if ( qualifier.storage == EvqVaryingIn ||
(qualifier.storage == EvqVaryingOut && ! qualifier.patch)) (qualifier.storage == EvqVaryingOut && ! qualifier.patch))
if (extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) if ((profile == EEsProfile && version >= 320) ||
extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))
return; return;
break; break;
case EShLangTessEvaluation: case EShLangTessEvaluation:
if ((qualifier.storage == EvqVaryingIn && ! qualifier.patch) || if ((qualifier.storage == EvqVaryingIn && ! qualifier.patch) ||
qualifier.storage == EvqVaryingOut) qualifier.storage == EvqVaryingOut)
if (extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) if ((profile == EEsProfile && version >= 320) ||
extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))
return; return;
break; break;
default: default:
...@@ -3267,7 +3273,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS ...@@ -3267,7 +3273,8 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
return nullptr; return nullptr;
bool nonEsRedecls = (profile != EEsProfile && (version >= 130 || identifier == "gl_TexCoord")); bool nonEsRedecls = (profile != EEsProfile && (version >= 130 || identifier == "gl_TexCoord"));
bool esRedecls = (profile == EEsProfile && extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks)); bool esRedecls = (profile == EEsProfile &&
(version >= 320 || extensionsTurnedOn(Num_AEP_shader_io_blocks, AEP_shader_io_blocks)));
if (! esRedecls && ! nonEsRedecls) if (! esRedecls && ! nonEsRedecls)
return nullptr; return nullptr;
...@@ -3406,7 +3413,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS ...@@ -3406,7 +3413,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes) void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, const TString* instanceName, TArraySizes* arraySizes)
{ {
const char* feature = "built-in block redeclaration"; const char* feature = "built-in block redeclaration";
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature);
if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") { if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment") {
...@@ -4040,7 +4047,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi ...@@ -4040,7 +4047,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
bool found = false; bool found = false;
for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) { for (TBlendEquationShift be = (TBlendEquationShift)0; be < EBlendCount; be = (TBlendEquationShift)(be + 1)) {
if (id == TQualifier::getBlendEquationString(be)) { if (id == TQualifier::getBlendEquationString(be)) {
requireExtensions(loc, 1, &E_GL_KHR_blend_equation_advanced, "blend equation"); profileRequires(loc, EEsProfile, 320, E_GL_KHR_blend_equation_advanced, "blend equation");
profileRequires(loc, ~EEsProfile, 0, E_GL_KHR_blend_equation_advanced, "blend equation");
intermediate.addBlendEquation(be); intermediate.addBlendEquation(be);
publicType.shaderQualifiers.blendEquation = true; publicType.shaderQualifiers.blendEquation = true;
found = true; found = true;
...@@ -5807,7 +5815,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con ...@@ -5807,7 +5815,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
case EvqVaryingOut: case EvqVaryingOut:
requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature); requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature);
profileRequires(memberLoc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); profileRequires(memberLoc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature);
profileRequires(memberLoc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(memberLoc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
memberWithLocation = true; memberWithLocation = true;
break; break;
default: default:
...@@ -5931,14 +5939,14 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q ...@@ -5931,14 +5939,14 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
// "Compute shaders do not permit user-defined input variables..." // "Compute shaders do not permit user-defined input variables..."
requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block"); requireStage(loc, (EShLanguageMask)(EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask|EShLangFragmentMask), "input block");
if (language == EShLangFragment) if (language == EShLangFragment)
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block"); profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "fragment input block");
break; break;
case EvqVaryingOut: case EvqVaryingOut:
profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "output block"); profileRequires(loc, ~EEsProfile, 150, E_GL_ARB_separate_shader_objects, "output block");
requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block"); requireStage(loc, (EShLanguageMask)(EShLangVertexMask|EShLangTessControlMask|EShLangTessEvaluationMask|EShLangGeometryMask), "output block");
// ES 310 can have a block before shader_io is turned on, so skip this test for built-ins // ES 310 can have a block before shader_io is turned on, so skip this test for built-ins
if (language == EShLangVertex && ! parsingBuiltins) if (language == EShLangVertex && ! parsingBuiltins)
profileRequires(loc, EEsProfile, 0, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block"); profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, "vertex output block");
break; break;
default: default:
error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), ""); error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), "");
......
...@@ -864,14 +864,17 @@ int TScanContext::tokenizeIdentifier() ...@@ -864,14 +864,17 @@ int TScanContext::tokenizeIdentifier()
case PATCH: case PATCH:
if (parseContext.symbolTable.atBuiltInLevel() || if (parseContext.symbolTable.atBuiltInLevel() ||
(parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader)) || (parseContext.profile == EEsProfile &&
(parseContext.version >= 320 ||
parseContext.extensionsTurnedOn(Num_AEP_tessellation_shader, AEP_tessellation_shader))) ||
(parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader))) (parseContext.profile != EEsProfile && parseContext.extensionTurnedOn(E_GL_ARB_tessellation_shader)))
return keyword; return keyword;
return es30ReservedFromGLSL(400); return es30ReservedFromGLSL(400);
case SAMPLE: case SAMPLE:
if (parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(1, &E_GL_OES_shader_multisample_interpolation))
return keyword; return keyword;
return es30ReservedFromGLSL(400); return es30ReservedFromGLSL(400);
...@@ -925,7 +928,8 @@ int TScanContext::tokenizeIdentifier() ...@@ -925,7 +928,8 @@ int TScanContext::tokenizeIdentifier()
case IIMAGEBUFFER: case IIMAGEBUFFER:
case UIMAGEBUFFER: case UIMAGEBUFFER:
afterType = true; afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
return keyword; return keyword;
return firstGenerationImage(false); return firstGenerationImage(false);
...@@ -948,7 +952,8 @@ int TScanContext::tokenizeIdentifier() ...@@ -948,7 +952,8 @@ int TScanContext::tokenizeIdentifier()
case IIMAGECUBEARRAY: case IIMAGECUBEARRAY:
case UIMAGECUBEARRAY: case UIMAGECUBEARRAY:
afterType = true; afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
return keyword; return keyword;
return secondGenerationImage(); return secondGenerationImage();
...@@ -1030,7 +1035,8 @@ int TScanContext::tokenizeIdentifier() ...@@ -1030,7 +1035,8 @@ int TScanContext::tokenizeIdentifier()
case ISAMPLERCUBEARRAY: case ISAMPLERCUBEARRAY:
case USAMPLERCUBEARRAY: case USAMPLERCUBEARRAY:
afterType = true; afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(Num_AEP_texture_cube_map_array, AEP_texture_cube_map_array))
return keyword; return keyword;
if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array))) if (parseContext.profile == EEsProfile || (parseContext.version < 400 && ! parseContext.extensionTurnedOn(E_GL_ARB_texture_cube_map_array)))
reservedWord(); reservedWord();
...@@ -1069,14 +1075,16 @@ int TScanContext::tokenizeIdentifier() ...@@ -1069,14 +1075,16 @@ int TScanContext::tokenizeIdentifier()
case SAMPLERBUFFER: case SAMPLERBUFFER:
afterType = true; afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
return keyword; return keyword;
return es30ReservedFromGLSL(130); return es30ReservedFromGLSL(130);
case ISAMPLERBUFFER: case ISAMPLERBUFFER:
case USAMPLERBUFFER: case USAMPLERBUFFER:
afterType = true; afterType = true;
if (parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(Num_AEP_texture_buffer, AEP_texture_buffer))
return keyword; return keyword;
return es30ReservedFromGLSL(140); return es30ReservedFromGLSL(140);
...@@ -1092,7 +1100,8 @@ int TScanContext::tokenizeIdentifier() ...@@ -1092,7 +1100,8 @@ int TScanContext::tokenizeIdentifier()
case ISAMPLER2DMSARRAY: case ISAMPLER2DMSARRAY:
case USAMPLER2DMSARRAY: case USAMPLER2DMSARRAY:
afterType = true; afterType = true;
if (parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array)) if ((parseContext.profile == EEsProfile && parseContext.version >= 320) ||
parseContext.extensionsTurnedOn(1, &E_GL_OES_texture_storage_multisample_2d_array))
return keyword; return keyword;
return es30ReservedFromGLSL(150); return es30ReservedFromGLSL(150);
...@@ -1228,7 +1237,8 @@ int TScanContext::tokenizeIdentifier() ...@@ -1228,7 +1237,8 @@ int TScanContext::tokenizeIdentifier()
return keyword; return keyword;
case PRECISE: case PRECISE:
if ((parseContext.profile == EEsProfile && parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5)) || if ((parseContext.profile == EEsProfile &&
(parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||
(parseContext.profile != EEsProfile && parseContext.version >= 400)) (parseContext.profile != EEsProfile && parseContext.version >= 400))
return keyword; return keyword;
if (parseContext.profile == EEsProfile && parseContext.version == 310) { if (parseContext.profile == EEsProfile && parseContext.version == 310) {
......
...@@ -116,7 +116,7 @@ TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate& ...@@ -116,7 +116,7 @@ TParseContextBase* CreateParseContext(TSymbolTable& symbolTable, TIntermediate&
// Local mapping functions for making arrays of symbol tables.... // Local mapping functions for making arrays of symbol tables....
const int VersionCount = 15; // index range in MapVersionToIndex const int VersionCount = 16; // index range in MapVersionToIndex
int MapVersionToIndex(int version) int MapVersionToIndex(int version)
{ {
...@@ -139,6 +139,7 @@ int MapVersionToIndex(int version) ...@@ -139,6 +139,7 @@ int MapVersionToIndex(int version)
case 310: index = 13; break; case 310: index = 13; break;
case 450: index = 14; break; case 450: index = 14; break;
case 500: index = 0; break; // HLSL case 500: index = 0; break; // HLSL
case 320: index = 15; break;
default: assert(0); break; default: assert(0); break;
} }
...@@ -456,9 +457,9 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo ...@@ -456,9 +457,9 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
// Get a good profile... // Get a good profile...
if (profile == ENoProfile) { if (profile == ENoProfile) {
if (version == 300 || version == 310) { if (version == 300 || version == 310 || version == 320) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: versions 300 and 310 require specifying the 'es' profile"); infoSink.info.message(EPrefixError, "#version: versions 300, 310, and 320 require specifying the 'es' profile");
profile = EEsProfile; profile = EEsProfile;
} else if (version == 100) } else if (version == 100)
profile = EEsProfile; profile = EEsProfile;
...@@ -475,16 +476,16 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo ...@@ -475,16 +476,16 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
profile = EEsProfile; profile = EEsProfile;
else else
profile = ENoProfile; profile = ENoProfile;
} else if (version == 300 || version == 310) { } else if (version == 300 || version == 310 || version == 320) {
if (profile != EEsProfile) { if (profile != EEsProfile) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: versions 300 and 310 support only the es profile"); infoSink.info.message(EPrefixError, "#version: versions 300, 310, and 320 support only the es profile");
} }
profile = EEsProfile; profile = EEsProfile;
} else { } else {
if (profile == EEsProfile) { if (profile == EEsProfile) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: only version 300 and 310 support the es profile"); infoSink.info.message(EPrefixError, "#version: only version 300, 310, and 320 support the es profile");
if (version >= FirstProfileVersion) if (version >= FirstProfileVersion)
profile = ECoreProfile; profile = ECoreProfile;
else else
...@@ -500,6 +501,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo ...@@ -500,6 +501,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
case 100: break; case 100: break;
case 300: break; case 300: break;
case 310: break; case 310: break;
case 320: break;
// desktop versions // desktop versions
case 110: break; case 110: break;
......
...@@ -101,6 +101,12 @@ INSTANTIATE_TEST_CASE_P( ...@@ -101,6 +101,12 @@ INSTANTIATE_TEST_CASE_P(
"310.tese", "310.tese",
"310implicitSizeArrayError.vert", "310implicitSizeArrayError.vert",
"310AofA.vert", "310AofA.vert",
"320.comp",
"320.vert",
"320.geom",
"320.frag",
"320.tesc",
"320.tese",
"330.frag", "330.frag",
"330comp.frag", "330comp.frag",
"constErrors.frag", "constErrors.frag",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment