Commit ab308035 by John Kessenich

Add layout binding qualifier for blocks and samplers (atomics are not yet in, nor link validation).

parent 8f13e132
...@@ -62,3 +62,12 @@ void bar(in highp volatile vec4 v) ...@@ -62,3 +62,12 @@ void bar(in highp volatile vec4 v)
f.xxxxx; // ERROR f.xxxxx; // ERROR
f.xxy; // ERROR f.xxy; // ERROR
} }
layout(binding = 3) uniform; // ERROR
layout(binding = 3) uniform boundblock { int aoeu; } boundInst;
layout(binding = 7) uniform anonblock { int aoeu; } ;
layout(location = 1) in; // ERROR
layout(binding = 1) in inblock { int aoeua; }; // ERROR
layout(binding = 100000) uniform anonblock2 { int aooeu; } ;
layout(binding = 4) uniform sampler2D sampb1;
layout(binding = 5) uniform sampler2D sampb2[10];
ERROR: 0:4: 'color' : can only use location layout qualifier on a vertex input or fragment output ERROR: 0:4: 'input location layout qualifier' : not supported in this stage: fragment
ERROR: 1 compilation errors. No code generated. ERROR: 1 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
......
...@@ -7,7 +7,7 @@ ERROR: 0:19: 'badf' : member of uniform block cannot have an auxiliary or interp ...@@ -7,7 +7,7 @@ ERROR: 0:19: 'badf' : member of uniform block cannot have an auxiliary or interp
ERROR: 0:20: 'badg' : member storage qualifier cannot contradict block storage qualifier ERROR: 0:20: '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: 'output block' : not supported with this profile: es ERROR: 0:35: 'output block' : not supported with this profile: es
ERROR: 0:39: 'badoutA' : can only use location layout qualifier on a vertex input or fragment output ERROR: 0:39: 'output location layout qualifier' : not supported in this stage: vertex
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.
...@@ -33,11 +33,11 @@ ERROR: node is still EOpNull! ...@@ -33,11 +33,11 @@ ERROR: node is still EOpNull!
0:43 Constant: 0:43 Constant:
0:43 1 (const int) 0:43 1 (const int)
0:43 M4: direct index for structure (layout(row_major shared ) highp 4X4 matrix of float) 0:43 M4: direct index for structure (layout(row_major shared ) highp 4X4 matrix of float)
0:43 '__anon__1' (layout(shared ) uniform block) 0:43 '__anon__1' (layout(column_major shared ) uniform block)
0:43 Constant: 0:43 Constant:
0:43 1 (const uint) 0:43 1 (const uint)
0:43 M3: direct index for structure (layout(column_major shared ) highp 4X4 matrix of float) 0:43 M3: direct index for structure (layout(column_major shared ) highp 4X4 matrix of float)
0:43 '__anon__1' (layout(shared ) uniform block) 0:43 '__anon__1' (layout(column_major shared ) uniform block)
0:43 Constant: 0:43 Constant:
0:43 0 (const uint) 0:43 0 (const uint)
0:43 t2m: direct index for structure (layout(row_major shared ) highp 4X4 matrix of float) 0:43 t2m: direct index for structure (layout(row_major shared ) highp 4X4 matrix of float)
......
...@@ -20,7 +20,11 @@ ERROR: 0:44: '=' : cannot convert from 'float' to 'int' ...@@ -20,7 +20,11 @@ ERROR: 0:44: '=' : cannot convert from 'float' to 'int'
ERROR: 0:54: 'y' : vector field selection out of range ERROR: 0:54: 'y' : vector field selection out of range
ERROR: 0:62: 'xxxxx' : illegal vector field selection ERROR: 0:62: 'xxxxx' : illegal vector field selection
ERROR: 0:63: 'xxy' : vector field selection out of range ERROR: 0:63: 'xxy' : vector field selection out of range
ERROR: 20 compilation errors. No code generated. ERROR: 0:66: 'binding' : cannot declare a default, include a type or full declaration
ERROR: 0:69: 'location' : cannot declare a default, use a full declaration
ERROR: 0:70: 'binding' : requires uniform or buffer storage qualifier
ERROR: 0:71: 'binding' : binding is too large
ERROR: 24 compilation errors. No code generated.
ERROR: node is still EOpNull! ERROR: node is still EOpNull!
0:20 Function Definition: foo( (const int) 0:20 Function Definition: foo( (const int)
...@@ -112,6 +116,12 @@ ERROR: node is still EOpNull! ...@@ -112,6 +116,12 @@ ERROR: node is still EOpNull!
0:? 4.200000 0:? 4.200000
0:? 'dx' (const float) 0:? 'dx' (const float)
0:? 4.200000 0:? 4.200000
0:? 'boundInst' (layout(binding=3 shared ) uniform block)
0:? '__anon__0' (layout(binding=7 shared ) uniform block)
0:? '__anon__1' (layout(binding=1 ) in block)
0:? '__anon__2' (layout(shared ) uniform block)
0:? 'sampb1' (layout(binding=4 ) uniform sampler2D)
0:? 'sampb2' (layout(binding=5 ) uniform 10-element array of sampler2D)
0:? 'gl_VertexID' (gl_VertexId int) 0:? 'gl_VertexID' (gl_VertexId int)
0:? 'gl_InstanceID' (gl_InstanceId int) 0:? 'gl_InstanceID' (gl_InstanceId int)
...@@ -15,23 +15,20 @@ ERROR: 0:46: 'stream' : there is no such layout identifier taking an assigned va ...@@ -15,23 +15,20 @@ ERROR: 0:46: 'stream' : there is no such layout identifier taking an assigned va
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: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: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:80: 's17' : redefinition ERROR: 0:80: 's17' : redefinition
ERROR: 0:85: 'binding' : not supported
ERROR: 0:85: 'offset' : there is no such layout identifier taking an assigned value ERROR: 0:85: 'offset' : there is no such layout identifier taking an assigned value
ERROR: 0:87: 'binding' : not supported ERROR: 0:85: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:89: 'binding' : not supported ERROR: 0:87: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:89: 'offset' : there is no such layout identifier taking an assigned value ERROR: 0:89: 'offset' : there is no such layout identifier taking an assigned value
ERROR: 0:91: 'binding' : not supported WARNING: 0:89: '' : cannot set qualifier defaults when using a type and no identifier
ERROR: 0:91: 'bar' : redefinition ERROR: 0:91: 'bar' : redefinition
ERROR: 0:92: 'offset' : there is no such layout identifier taking an assigned value ERROR: 0:92: 'offset' : there is no such layout identifier taking an assigned value
ERROR: 0:92: 'bar' : redefinition ERROR: 0:92: 'bar' : redefinition
ERROR: 0:94: 'binding' : not supported
ERROR: 0:94: 'offset' : there is no such layout identifier taking an assigned value ERROR: 0:94: 'offset' : there is no such layout identifier taking an assigned value
ERROR: 0:94: 'a2' : redefinition ERROR: 0:94: 'a2' : redefinition
ERROR: 0:95: 'binding' : not supported ERROR: 0:95: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:96: 'binding' : not supported ERROR: 0:96: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:97: 'binding' : not supported ERROR: 0:97: 'binding' : requires block, or sampler/image, or atomic-counter type
ERROR: 0:106: '' : vertex input cannot be further qualified ERROR: 0:106: '' : vertex input cannot be further qualified
ERROR: 0:112: 'ColorIvn' : identifier not previously declared ERROR: 0:112: 'ColorIvn' : identifier not previously declared
ERROR: 0:132: 'shared' : not supported in this stage: vertex ERROR: 0:132: 'shared' : not supported in this stage: vertex
...@@ -43,7 +40,7 @@ ERROR: 0:153: '' : function does not return a value: func3 ...@@ -43,7 +40,7 @@ ERROR: 0:153: '' : function does not return a value: func3
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: 44 compilation errors. No code generated. ERROR: 40 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)
...@@ -289,13 +286,13 @@ ERROR: node is still EOpNull! ...@@ -289,13 +286,13 @@ ERROR: node is still EOpNull!
0:? '__anon__2' (out block) 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__3' (layout(std140 ) uniform block) 0:? '__anon__3' (layout(std140 ) uniform block)
0:? '__anon__4' (layout(shared ) uniform block) 0:? '__anon__4' (layout(column_major shared ) uniform block)
0:? 's17' (uniform sampler2D) 0:? 's17' (layout(binding=3 ) uniform sampler2D)
0:? 'a2' (uniform int) 0:? 'a2' (layout(binding=2 ) uniform int)
0:? 'bar' (uniform int) 0:? 'bar' (layout(binding=2 ) uniform int)
0:? 'b2' (uniform int) 0:? 'b2' (layout(binding=2 ) uniform int)
0:? 'c2' (uniform int) 0:? 'c2' (layout(binding=3 ) uniform int)
0:? 'd2' (uniform int) 0:? 'd2' (layout(binding=2 ) uniform int)
0:? '__anon__5' (out block) 0:? '__anon__5' (out block)
0:? 'ColorInv' (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)
...@@ -306,7 +303,7 @@ ERROR: node is still EOpNull! ...@@ -306,7 +303,7 @@ 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__6' (layout(shared ) uniform block) 0:? '__anon__6' (layout(shared ) coherent uniform block)
0:? '__anon__7' (layout(shared ) uniform block) 0:? '__anon__7' (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)
......
...@@ -297,21 +297,29 @@ public: ...@@ -297,21 +297,29 @@ public:
layoutMatrix = ElmNone; layoutMatrix = ElmNone;
layoutPacking = ElpNone; layoutPacking = ElpNone;
layoutSlotLocation = layoutLocationEnd; layoutSlotLocation = layoutLocationEnd;
layoutBinding = layoutBindingEnd;
} }
bool hasLayout() const bool hasLayout() const
{ {
return layoutMatrix != ElmNone || return layoutMatrix != ElmNone ||
layoutPacking != ElpNone || layoutPacking != ElpNone ||
layoutSlotLocation != layoutLocationEnd; hasLocation() ||
hasBinding();
} }
TLayoutMatrix layoutMatrix : 3; TLayoutMatrix layoutMatrix : 3;
TLayoutPacking layoutPacking : 4; TLayoutPacking layoutPacking : 4;
unsigned int layoutSlotLocation : 7; // ins/outs should have small numbers, buffer offsets could be large unsigned int layoutSlotLocation : 7; // ins/outs should have small numbers, buffer offsets could be large
static const unsigned int layoutLocationEnd = 0x3F; static const unsigned int layoutLocationEnd = 0x3F;
unsigned int layoutBinding : 8;
static const unsigned int layoutBindingEnd = 0xFF;
bool hasLocation() const bool hasLocation() const
{ {
return layoutSlotLocation != layoutLocationEnd; return layoutSlotLocation != layoutLocationEnd;
} }
bool hasBinding() const
{
return layoutBinding != layoutBindingEnd;
}
static const char* getLayoutPackingString(TLayoutPacking packing) static const char* getLayoutPackingString(TLayoutPacking packing)
{ {
switch (packing) { switch (packing) {
...@@ -430,17 +438,20 @@ public: ...@@ -430,17 +438,20 @@ public:
typeName = NewPoolTString(p.userDef->getTypeName().c_str()); typeName = NewPoolTString(p.userDef->getTypeName().c_str());
} }
} }
TType(TTypeList* userDef, const TString& n, TStorageQualifier blockQualifier = EvqGlobal) : TType(TTypeList* userDef, const TString& n) :
basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0), arraySizes(0), basicType(EbtStruct), vectorSize(1), matrixCols(0), matrixRows(0),
structure(userDef), fieldName(0) arraySizes(0), structure(userDef), fieldName(0)
{ {
sampler.clear(); sampler.clear();
qualifier.clear(); qualifier.clear();
// is it an interface block? typeName = NewPoolTString(n.c_str());
if (blockQualifier != EvqGlobal) { }
qualifier.storage = blockQualifier; // For interface blocks
basicType = EbtBlock; TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
} basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0),
qualifier(q), arraySizes(0), structure(userDef), fieldName(0)
{
sampler.clear();
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
} }
virtual ~TType() {} virtual ~TType() {}
...@@ -628,6 +639,8 @@ public: ...@@ -628,6 +639,8 @@ public:
p += snprintf(p, end - p, "layout("); p += snprintf(p, end - p, "layout(");
if (qualifier.hasLocation()) if (qualifier.hasLocation())
p += snprintf(p, end - p, "location=%d ", qualifier.layoutSlotLocation); p += snprintf(p, end - p, "location=%d ", qualifier.layoutSlotLocation);
if (qualifier.hasBinding())
p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding);
if (qualifier.layoutMatrix != ElmNone) if (qualifier.layoutMatrix != ElmNone)
p += snprintf(p, end - p, "%s ", TQualifier::getLayoutMatrixString(qualifier.layoutMatrix)); p += snprintf(p, end - p, "%s ", TQualifier::getLayoutMatrixString(qualifier.layoutMatrix));
if (qualifier.layoutPacking != ElpNone) if (qualifier.layoutPacking != ElpNone)
......
...@@ -126,6 +126,7 @@ public: ...@@ -126,6 +126,7 @@ public:
void setLayoutQualifier(TSourceLoc, TPublicType&, TString&); void setLayoutQualifier(TSourceLoc, TPublicType&, TString&);
void setLayoutQualifier(TSourceLoc, TPublicType&, TString&, int); void setLayoutQualifier(TSourceLoc, TPublicType&, TString&, int);
void mergeLayoutQualifiers(TSourceLoc, TQualifier& dest, const TQualifier& src); void mergeLayoutQualifiers(TSourceLoc, TQualifier& dest, const TQualifier& src);
void layoutCheck(TSourceLoc, const TSymbol&);
const TFunction* findFunction(TSourceLoc, TFunction* pfnCall, bool *builtIn = 0); const TFunction* findFunction(TSourceLoc, TFunction* pfnCall, bool *builtIn = 0);
TIntermNode* declareVariable(TSourceLoc, TString& identifier, TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0); TIntermNode* declareVariable(TSourceLoc, TString& identifier, TPublicType&, TArraySizes* typeArray = 0, TIntermTyped* initializer = 0);
......
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