Turn on non-uniform blocks (in/out/buffer), and prevent new stages from working with "no profile" (before 150) shaders.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23470 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-11 19:46:10 +00:00
parent 9d30218fb6
commit a4ea1313c3
9 changed files with 60 additions and 39 deletions

View File

@ -36,7 +36,7 @@ out badout { // ERROR
float f; float f;
}; };
layout (location = 10) out vec4 badout; // ERROR layout (location = 10) out vec4 badoutA; // ERROR
void main() void main()
{ {

View File

@ -6,8 +6,8 @@ ERROR: 0:12: 'badm4' : cannot specify packing on a variable declaration
ERROR: 0:15: 'badf' : member of uniform block cannot have an auxiliary or interpolation qualifier ERROR: 0:15: 'badf' : member of uniform block cannot have an auxiliary or interpolation qualifier
ERROR: 0:15: 'badg' : member storage qualifier cannot contradict block storage qualifier ERROR: 0:15: 'badg' : member storage qualifier cannot contradict block storage qualifier
ERROR: 0:28: 'T3' : nameless block contains a member that already has a name at global scope ERROR: 0:28: 'T3' : nameless block contains a member that already has a name at global scope
ERROR: 0:35: 'badout' : only uniform interface blocks are supported ERROR: 0:35: 'in/out block' : not supported with this profile: es
ERROR: 0:39: 'badout' : can only use location layout qualifier on a vertex input or fragment output ERROR: 0:39: 'badoutA' : can only use location layout qualifier on a vertex input or fragment output
ERROR: 0:47: 'shared' : not supported with this profile: es ERROR: 0:47: 'shared' : not supported with this profile: es
ERROR: 0:47: 'shared' : not supported in this stage: vertex ERROR: 0:47: 'shared' : not supported in this stage: vertex
ERROR: 12 compilation errors. No code generated. ERROR: 12 compilation errors. No code generated.
@ -62,7 +62,8 @@ ERROR: node is still EOpNull!
0:? 'badm4' (layout(column_major shared ) uniform highp 4X4 matrix of float) 0:? 'badm4' (layout(column_major shared ) uniform highp 4X4 matrix of float)
0:? 'tblock' (layout(std140 ) uniform block) 0:? 'tblock' (layout(std140 ) uniform block)
0:? '__anon__0' (layout(shared ) uniform block) 0:? '__anon__0' (layout(shared ) uniform block)
0:? 'badout' (layout(location=10 ) smooth out highp 4-component vector of float) 0:? '__anon__2' (out block)
0:? 'badoutA' (layout(location=10 ) smooth out highp 4-component vector of float)
0:? 'compute_only' (shared highp 4-component vector of float) 0:? 'compute_only' (shared highp 4-component vector of float)
0:? 'gl_VertexID' (gl_VertexId highp int) 0:? 'gl_VertexID' (gl_VertexId highp int)
0:? 'gl_InstanceID' (gl_InstanceId highp int) 0:? 'gl_InstanceID' (gl_InstanceId highp int)

View File

@ -4,9 +4,7 @@ ERROR: 0:20: '' : numeric literal too big
ERROR: 0:21: '' : hexidecimal literal too big ERROR: 0:21: '' : hexidecimal literal too big
ERROR: 0:37: 'view' : redefinition ERROR: 0:37: 'view' : redefinition
ERROR: 0:68: 'lightPosition' : redefinition ERROR: 0:68: 'lightPosition' : redefinition
ERROR: 0:71: 'Material' : only uniform interface blocks are supported ERROR: 0:71: 'Atten' : member storage qualifier cannot contradict block storage qualifier
ERROR: 0:79: 'Light' : only uniform interface blocks are supported
ERROR: 0:83: 'ColoredTexture' : only uniform interface blocks are supported
ERROR: 0:87: 'Color' : redefinition ERROR: 0:87: 'Color' : redefinition
ERROR: 0:92: 'origin_upper_left' : unrecognized layout identifier ERROR: 0:92: 'origin_upper_left' : unrecognized layout identifier
ERROR: 0:93: 'pixel_center_integer' : unrecognized layout identifier ERROR: 0:93: 'pixel_center_integer' : unrecognized layout identifier
@ -54,7 +52,7 @@ ERROR: 0:226: 'in' : only allowed at global scope
ERROR: 0:227: 'in' : only allowed at global scope ERROR: 0:227: 'in' : only allowed at global scope
ERROR: 0:228: 'in' : only allowed at global scope ERROR: 0:228: 'in' : only allowed at global scope
ERROR: 0:232: 'out' : only allowed at global scope ERROR: 0:232: 'out' : only allowed at global scope
ERROR: 55 compilation errors. No code generated. ERROR: 53 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:5 Sequence 0:5 Sequence
@ -265,6 +263,9 @@ ERROR: node is still EOpNull!
0:? 0.700000 0:? 0.700000
0:? 0.700000 0:? 0.700000
0:? 0.200000 0:? 0.200000
0:? '__anon__0' (in block)
0:? '__anon__1' (in block)
0:? 'Materiala' (in block)
0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float) 0:? 'gl_FragCoord' (gl_FragCoord 4-component vector of float)
0:? 'factor' (layout(location=3 ) out 4-component vector of float) 0:? 'factor' (layout(location=3 ) out 4-component vector of float)
0:? 'colors' (layout(location=2 ) out 3-element array of 4-component vector of float) 0:? 'colors' (layout(location=2 ) out 3-element array of 4-component vector of float)

View File

@ -1,6 +1,4 @@
Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. Warning, version 430 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:5: 'Vertex' : only uniform interface blocks are supported
ERROR: 0:10: 'Vertex2' : only uniform interface blocks are supported
ERROR: 0:23: 'transforms' : redeclaration of array with size ERROR: 0:23: 'transforms' : redeclaration of array with size
ERROR: 0:29: 's' : location qualifiers only appy to uniform, in, or out storage qualifiers ERROR: 0:29: 's' : location qualifiers only appy to uniform, in, or out storage qualifiers
ERROR: 0:31: 'triangles' : unrecognized layout identifier ERROR: 0:31: 'triangles' : unrecognized layout identifier
@ -15,9 +13,7 @@ ERROR: 0:43: 'stream' : there is no such layout identifier taking an assigned va
ERROR: 0:45: 'stream' : there is no such layout identifier taking an assigned value ERROR: 0:45: 'stream' : there is no such layout identifier taking an assigned value
ERROR: 0:46: 'stream' : there is no such layout identifier taking an assigned value ERROR: 0:46: 'stream' : there is no such layout identifier taking an assigned value
ERROR: 0:47: 'stream' : there is no such layout identifier taking an assigned value ERROR: 0:47: 'stream' : there is no such layout identifier taking an assigned value
ERROR: 0:45: 'Block1' : only uniform interface blocks are supported
ERROR: 0:50: 'stream' : there is no such layout identifier taking an assigned value ERROR: 0:50: 'stream' : there is no such layout identifier taking an assigned value
ERROR: 0:52: 'Block2' : only uniform interface blocks are supported
ERROR: 0:55: 'stream' : there is no such layout identifier taking an assigned value ERROR: 0:55: 'stream' : there is no such layout identifier taking an assigned value
ERROR: 0:77: 'binding' : not supported ERROR: 0:77: 'binding' : not supported
ERROR: 0:80: 's17' : redefinition ERROR: 0:80: 's17' : redefinition
@ -37,8 +33,8 @@ ERROR: 0:96: 'binding' : not supported
ERROR: 0:97: 'binding' : not supported ERROR: 0:97: 'binding' : not supported
ERROR: 0:106: '' : vertex input cannot be further qualified ERROR: 0:106: '' : vertex input cannot be further qualified
ERROR: 0:106: 'gl_' : reserved built-in name ERROR: 0:106: 'gl_' : reserved built-in name
ERROR: 0:112: 'ColorIvn' : identifier not previously declared
ERROR: 0:119: 'a' : redefinition ERROR: 0:119: 'a' : redefinition
ERROR: 0:127: 'Block2' : nameless block contains a member that already has a name at global scope
ERROR: 0:132: 'shared' : not supported in this stage: vertex ERROR: 0:132: 'shared' : not supported in this stage: vertex
ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:134: '' : function does not return a value: funcA
ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:136: '' : function does not return a value: funcB
@ -55,7 +51,7 @@ ERROR: 0:191: '=' : cannot convert from 'const 4-component vector of float' to
ERROR: 0:192: 'constructor' : constructing from a non-dereferenced array ERROR: 0:192: 'constructor' : constructing from a non-dereferenced array
ERROR: 0:193: 'constructor' : constructing from a non-dereferenced array ERROR: 0:193: 'constructor' : constructing from a non-dereferenced array
ERROR: 0:194: 'constructor' : constructing from a non-dereferenced array ERROR: 0:194: 'constructor' : constructing from a non-dereferenced array
ERROR: 56 compilation errors. No code generated. ERROR: 52 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:134 Function Definition: funcA(I21; (4-component vector of float) 0:134 Function Definition: funcA(I21; (4-component vector of float)
@ -241,15 +237,19 @@ ERROR: node is still EOpNull!
0:193 Construct vec4 (3-element array of 4-component vector of float) 0:193 Construct vec4 (3-element array of 4-component vector of float)
0:194 Construct vec4 (3-element array of 4-component vector of float) 0:194 Construct vec4 (3-element array of 4-component vector of float)
0:? Linker Objects 0:? Linker Objects
0:? 'Coords' (out block)
0:? '__anon__0' (out block)
0:? 'transforms' (layout(shared ) uniform 4-element array of block) 0:? 'transforms' (layout(shared ) uniform 4-element array of block)
0:? 'normal' (layout(location=3 ) in 4-component vector of float) 0:? 'normal' (layout(location=3 ) in 4-component vector of float)
0:? 'colors' (layout(location=6 ) in 3-element array of 4-component vector of float) 0:? 'colors' (layout(location=6 ) in 3-element array of 4-component vector of float)
0:? 's' (layout(location=3 ) structure) 0:? 's' (layout(location=3 ) structure)
0:? 'var1' (smooth out 4-component vector of float) 0:? 'var1' (smooth out 4-component vector of float)
0:? '__anon__1' (out block)
0:? 'var5' (smooth out 4-component vector of float) 0:? 'var5' (smooth out 4-component vector of float)
0:? '__anon__2' (out block)
0:? 'var7' (smooth out 4-component vector of float) 0:? 'var7' (smooth out 4-component vector of float)
0:? '__anon__0' (layout(std140 ) uniform block) 0:? '__anon__3' (layout(std140 ) uniform block)
0:? '__anon__1' (layout(shared ) uniform block) 0:? '__anon__4' (layout(shared ) uniform block)
0:? 's17' (uniform sampler2D) 0:? 's17' (uniform sampler2D)
0:? 'a' (uniform int) 0:? 'a' (uniform int)
0:? 'bar' (uniform int) 0:? 'bar' (uniform int)
@ -258,7 +258,7 @@ ERROR: node is still EOpNull!
0:? 'c2' (uniform int) 0:? 'c2' (uniform int)
0:? 'd2' (uniform int) 0:? 'd2' (uniform int)
0:? 'gl_FrontColor' (flat in 4-component vector of float) 0:? 'gl_FrontColor' (flat in 4-component vector of float)
0:? 'Color' (smooth out 3-component vector of float) 0:? 'ColorInv' (smooth out 3-component vector of float)
0:? 'Color4' (invariant centroid smooth out 3-component vector of float) 0:? 'Color4' (invariant centroid smooth out 3-component vector of float)
0:? 'position' (smooth out 4-component vector of float) 0:? 'position' (smooth out 4-component vector of float)
0:? 'Color5' (smooth out 3-component vector of float) 0:? 'Color5' (smooth out 3-component vector of float)
@ -266,7 +266,8 @@ ERROR: node is still EOpNull!
0:? 'c' (in 4-component vector of float) 0:? 'c' (in 4-component vector of float)
0:? 'd' (in 4-component vector of float) 0:? 'd' (in 4-component vector of float)
0:? 'v' (smooth out 4-component vector of float) 0:? 'v' (smooth out 4-component vector of float)
0:? '__anon__2' (layout(shared ) uniform block) 0:? '__anon__5' (layout(shared ) uniform block)
0:? '__anon__6' (layout(shared ) uniform block)
0:? 'shv' (shared 4-component vector of float) 0:? 'shv' (shared 4-component vector of float)
0:? 'img1' (uniform image2D) 0:? 'img1' (uniform image2D)
0:? 'img2' (coherent uniform image2D) 0:? 'img2' (coherent uniform image2D)

View File

@ -71,7 +71,7 @@ uniform vec3 color = vec3(0.7, 0.7, 0.2); // value assigned at link time
in Material { in Material {
smooth in vec4 Color1; // legal, input inside in block smooth in vec4 Color1; // legal, input inside in block
smooth vec4 Color2; // legal, 'in' inherited from 'in Material' smooth vec4 Color2; // legal, 'in' inherited from 'in Material'
vec2 TexCoord; // legal, TexCoord is an input vec2 TexCoordA; // legal, TexCoord is an input
uniform float Atten; // illegal, mismatched storage qualifier uniform float Atten; // illegal, mismatched storage qualifier
}; };
@ -83,7 +83,7 @@ in Light {
in ColoredTexture { in ColoredTexture {
vec4 Color; vec4 Color;
vec2 TexCoord; vec2 TexCoord;
} Material; // instance name } Materiala; // instance name
vec3 Color; // different Color than Material.Color vec3 Color; // different Color than Material.Color
in vec4 gl_FragCoord; // redeclaration that changes nothing is allowed in vec4 gl_FragCoord; // redeclaration that changes nothing is allowed

View File

@ -108,8 +108,8 @@ flat out vec4 gl_FrontColor; // output from geometry shader
invariant gl_Position; // make existing gl_Position be invariant invariant gl_Position; // make existing gl_Position be invariant
out vec3 Color; out vec3 ColorInv;
invariant Color; // make existing Color be invariant invariant ColorIvn; // make existing Color be invariant
invariant centroid out vec3 Color4; invariant centroid out vec3 Color4;
precise out vec4 position; precise out vec4 position;
@ -124,9 +124,9 @@ coherent buffer Block {
vec4 member2; vec4 member2;
}; };
buffer Block2 { buffer Block2a {
coherent readonly vec4 member1; coherent readonly vec4 member1A;
coherent vec4 member2; coherent vec4 member2A;
}; };
shared vec4 shv; shared vec4 shv;

View File

@ -97,6 +97,10 @@ TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb,
globalUniformDefaults.layoutMatrix = ElmColumnMajor; globalUniformDefaults.layoutMatrix = ElmColumnMajor;
globalUniformDefaults.layoutPacking = ElpShared; globalUniformDefaults.layoutPacking = ElpShared;
globalBufferDefaults.clear();
globalBufferDefaults.layoutMatrix = ElmColumnMajor;
globalBufferDefaults.layoutPacking = ElpShared;
globalInputDefaults.clear(); globalInputDefaults.clear();
globalOutputDefaults.clear(); globalOutputDefaults.clear();
@ -2356,12 +2360,21 @@ void TParseContext::addBlock(TSourceLoc loc, TTypeList& typeList, const TString*
if (profile == EEsProfile && arraySizes) if (profile == EEsProfile && arraySizes)
arraySizeRequiredCheck(loc, arraySizes->getSize()); arraySizeRequiredCheck(loc, arraySizes->getSize());
if (currentBlockDefaults.storage == EvqUniform) { switch (currentBlockDefaults.storage) {
requireProfile(loc, ~ENoProfile, "uniform block"); case EvqBuffer:
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "buffer block");
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, 0, "buffer block");
break;
case EvqUniform:
profileRequires(loc, EEsProfile, 300, 0, "uniform block"); profileRequires(loc, EEsProfile, 300, 0, "uniform block");
} else { profileRequires(loc, ENoProfile, 140, 0, "uniform block");
error(loc, "only uniform interface blocks are supported", blockName->c_str(), ""); break;
case EvqIn:
case EvqOut:
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "in/out block");
break;
default:
error(loc, "only uniform, in, or out interface blocks are supported", blockName->c_str(), "");
return; return;
} }
@ -2384,6 +2397,7 @@ void TParseContext::addBlock(TSourceLoc loc, TTypeList& typeList, const TString*
TQualifier defaultQualification; TQualifier defaultQualification;
switch (currentBlockDefaults.storage) { switch (currentBlockDefaults.storage) {
case EvqBuffer: defaultQualification = globalBufferDefaults; break;
case EvqUniform: defaultQualification = globalUniformDefaults; break; case EvqUniform: defaultQualification = globalUniformDefaults; break;
case EvqIn: defaultQualification = globalInputDefaults; break; case EvqIn: defaultQualification = globalInputDefaults; break;
case EvqOut: defaultQualification = globalOutputDefaults; break; case EvqOut: defaultQualification = globalOutputDefaults; break;
@ -2471,6 +2485,12 @@ void TParseContext::addQualifierToExisting(TSourceLoc loc, TQualifier qualifier,
void TParseContext::updateQualifierDefaults(TQualifier qualifier) void TParseContext::updateQualifierDefaults(TQualifier qualifier)
{ {
switch (qualifier.storage) { switch (qualifier.storage) {
case EvqBuffer:
if (qualifier.layoutMatrix != ElmNone)
globalBufferDefaults.layoutMatrix = qualifier.layoutMatrix;
if (qualifier.layoutPacking != ElpNone)
globalBufferDefaults.layoutPacking = qualifier.layoutPacking;
break;
case EvqUniform: case EvqUniform:
if (qualifier.layoutMatrix != ElmNone) if (qualifier.layoutMatrix != ElmNone)
globalUniformDefaults.layoutMatrix = qualifier.layoutMatrix; globalUniformDefaults.layoutMatrix = qualifier.layoutMatrix;

View File

@ -208,6 +208,7 @@ protected:
static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2)); // see computeSamplerTypeIndex() static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2)); // see computeSamplerTypeIndex()
TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex];
bool afterEOF; bool afterEOF;
TQualifier globalBufferDefaults;
TQualifier globalUniformDefaults; TQualifier globalUniformDefaults;
TQualifier globalInputDefaults; TQualifier globalInputDefaults;
TQualifier globalOutputDefaults; TQualifier globalOutputDefaults;

View File

@ -340,30 +340,27 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
// Correct for stage type... // Correct for stage type...
switch (stage) { switch (stage) {
case EShLangGeometry: case EShLangGeometry:
if (version < 150 || profile == EEsProfile) { if (version < 150 || (profile != ECoreProfile && profile != ECompatibilityProfile)) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: geometry shaders require non-es profile and version 150 or above"); infoSink.info.message(EPrefixError, "#version: geometry shaders require non-es profile and version 150 or above");
version = 150; version = 150;
if (profile == EEsProfile)
profile = ECoreProfile; profile = ECoreProfile;
} }
break; break;
case EShLangTessControl: case EShLangTessControl:
case EShLangTessEvaluation: case EShLangTessEvaluation:
if (version < 400 || profile == EEsProfile) { if (version < 400 || (profile != ECoreProfile && profile != ECompatibilityProfile)) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: tessellation shaders require non-es profile and version 400 or above"); infoSink.info.message(EPrefixError, "#version: tessellation shaders require non-es profile and version 400 or above");
version = 400; version = 400;
if (profile == EEsProfile)
profile = ECoreProfile; profile = ECoreProfile;
} }
break; break;
case EShLangCompute: case EShLangCompute:
if (version < 430 || profile == EEsProfile) { if (version < 430 || (profile != ECoreProfile && profile != ECompatibilityProfile)) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: compute shaders require non-es profile and version 430 or above"); infoSink.info.message(EPrefixError, "#version: compute shaders require non-es profile and version 430 or above");
version = 430; version = 430;
if (profile == EEsProfile)
profile = ECoreProfile; profile = ECoreProfile;
} }
break; break;