Minor infrastructure changes, to simplify an upcoming check in:
- print out block member types when printing a block (makes all test results change) - const versions of all intermediate.h type-identification methods - layoutSlotLocation -> layoutLocation git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@24664 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
@@ -353,7 +353,7 @@ public:
|
||||
{
|
||||
layoutMatrix = ElmNone;
|
||||
layoutPacking = ElpNone;
|
||||
layoutSlotLocation = layoutLocationEnd;
|
||||
layoutLocation = layoutLocationEnd;
|
||||
layoutBinding = layoutBindingEnd;
|
||||
layoutStream = layoutStreamEnd;
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
}
|
||||
TLayoutMatrix layoutMatrix : 3;
|
||||
TLayoutPacking layoutPacking : 4;
|
||||
unsigned int layoutSlotLocation : 7; // ins/outs should have small numbers, buffer offsets could be large
|
||||
unsigned int layoutLocation : 7; // ins/outs should have small numbers, buffer offsets could be large
|
||||
static const unsigned int layoutLocationEnd = 0x3F;
|
||||
unsigned int layoutBinding : 8;
|
||||
static const unsigned int layoutBindingEnd = 0xFF;
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
static const unsigned int layoutStreamEnd = 0xFF;
|
||||
bool hasLocation() const
|
||||
{
|
||||
return layoutSlotLocation != layoutLocationEnd;
|
||||
return layoutLocation != layoutLocationEnd;
|
||||
}
|
||||
bool hasBinding() const
|
||||
{
|
||||
@@ -825,7 +825,7 @@ public:
|
||||
if (qualifier.hasLayout()) {
|
||||
p += snprintf(p, end - p, "layout(");
|
||||
if (qualifier.hasLocation())
|
||||
p += snprintf(p, end - p, "location=%d ", qualifier.layoutSlotLocation);
|
||||
p += snprintf(p, end - p, "location=%d ", qualifier.layoutLocation);
|
||||
if (qualifier.hasBinding())
|
||||
p += snprintf(p, end - p, "binding=%d ", qualifier.layoutBinding);
|
||||
if (qualifier.hasStream())
|
||||
@@ -887,9 +887,11 @@ public:
|
||||
s.append("{");
|
||||
for (size_t i = 0; i < structure->size(); ++i) {
|
||||
if ((*structure)[i].type->getBasicType() != EbtVoid) {
|
||||
s.append((*structure)[i].type->getCompleteString());
|
||||
s.append(" ");
|
||||
s.append((*structure)[i].type->getFieldName());
|
||||
if (i < structure->size() - 1)
|
||||
s.append(",");
|
||||
s.append(", ");
|
||||
}
|
||||
}
|
||||
s.append("}");
|
||||
|
||||
@@ -343,17 +343,29 @@ public:
|
||||
virtual glslang::TSourceLoc getLoc() const { return loc; }
|
||||
virtual void setLoc(glslang::TSourceLoc l) { loc = l; }
|
||||
virtual void traverse(glslang::TIntermTraverser*) = 0;
|
||||
virtual glslang::TIntermTyped* getAsTyped() { return 0; }
|
||||
virtual glslang::TIntermOperator* getAsOperator() { return 0; }
|
||||
virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; }
|
||||
virtual glslang::TIntermAggregate* getAsAggregate() { return 0; }
|
||||
virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; }
|
||||
virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; }
|
||||
virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; }
|
||||
virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; }
|
||||
virtual glslang::TIntermMethod* getAsMethodNode() { return 0; }
|
||||
virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; }
|
||||
virtual glslang::TIntermBranch* getAsBranchNode() { return 0; }
|
||||
virtual glslang::TIntermTyped* getAsTyped() { return 0; }
|
||||
virtual glslang::TIntermOperator* getAsOperator() { return 0; }
|
||||
virtual glslang::TIntermConstantUnion* getAsConstantUnion() { return 0; }
|
||||
virtual glslang::TIntermAggregate* getAsAggregate() { return 0; }
|
||||
virtual glslang::TIntermUnary* getAsUnaryNode() { return 0; }
|
||||
virtual glslang::TIntermBinary* getAsBinaryNode() { return 0; }
|
||||
virtual glslang::TIntermSelection* getAsSelectionNode() { return 0; }
|
||||
virtual glslang::TIntermSwitch* getAsSwitchNode() { return 0; }
|
||||
virtual glslang::TIntermMethod* getAsMethodNode() { return 0; }
|
||||
virtual glslang::TIntermSymbol* getAsSymbolNode() { return 0; }
|
||||
virtual glslang::TIntermBranch* getAsBranchNode() { return 0; }
|
||||
|
||||
virtual const glslang::TIntermTyped* getAsTyped() const { return 0; }
|
||||
virtual const glslang::TIntermOperator* getAsOperator() const { return 0; }
|
||||
virtual const glslang::TIntermConstantUnion* getAsConstantUnion() const { return 0; }
|
||||
virtual const glslang::TIntermAggregate* getAsAggregate() const { return 0; }
|
||||
virtual const glslang::TIntermUnary* getAsUnaryNode() const { return 0; }
|
||||
virtual const glslang::TIntermBinary* getAsBinaryNode() const { return 0; }
|
||||
virtual const glslang::TIntermSelection* getAsSelectionNode() const { return 0; }
|
||||
virtual const glslang::TIntermSwitch* getAsSwitchNode() const { return 0; }
|
||||
virtual const glslang::TIntermMethod* getAsMethodNode() const { return 0; }
|
||||
virtual const glslang::TIntermSymbol* getAsSymbolNode() const { return 0; }
|
||||
virtual const glslang::TIntermBranch* getAsBranchNode() const { return 0; }
|
||||
virtual ~TIntermNode() { }
|
||||
protected:
|
||||
glslang::TSourceLoc loc;
|
||||
@@ -375,7 +387,8 @@ struct TIntermNodePair {
|
||||
class TIntermTyped : public TIntermNode {
|
||||
public:
|
||||
TIntermTyped(const TType& t) { type.shallowCopy(t); }
|
||||
virtual TIntermTyped* getAsTyped() { return this; }
|
||||
virtual TIntermTyped* getAsTyped() { return this; }
|
||||
virtual const TIntermTyped* getAsTyped() const { return this; }
|
||||
virtual void setType(const TType& t) { type.shallowCopy(t); }
|
||||
virtual const TType& getType() const { return type; }
|
||||
virtual TType& getWritableType() { return type; }
|
||||
@@ -428,7 +441,8 @@ public:
|
||||
TIntermBranch(TOperator op, TIntermTyped* e) :
|
||||
flowOp(op),
|
||||
expression(e) { }
|
||||
virtual TIntermBranch* getAsBranchNode() { return this; }
|
||||
virtual TIntermBranch* getAsBranchNode() { return this; }
|
||||
virtual const TIntermBranch* getAsBranchNode() const { return this; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
TOperator getFlowOp() { return flowOp; }
|
||||
TIntermTyped* getExpression() { return expression; }
|
||||
@@ -445,7 +459,8 @@ protected:
|
||||
class TIntermMethod : public TIntermTyped {
|
||||
public:
|
||||
TIntermMethod(TIntermTyped* o, const TType& t, const TString& m) : TIntermTyped(t), object(o), method(m) { }
|
||||
virtual TIntermMethod* getAsMethodNode() { return this; }
|
||||
virtual TIntermMethod* getAsMethodNode() { return this; }
|
||||
virtual const TIntermMethod* getAsMethodNode() const { return this; }
|
||||
virtual const TString& getMethodName() const { return method; }
|
||||
virtual TIntermTyped* getObject() const { return object; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
@@ -467,7 +482,8 @@ public:
|
||||
virtual int getId() const { return id; }
|
||||
virtual const TString& getName() const { return name; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermSymbol* getAsSymbolNode() { return this; }
|
||||
virtual TIntermSymbol* getAsSymbolNode() { return this; }
|
||||
virtual const TIntermSymbol* getAsSymbolNode() const { return this; }
|
||||
void setConstArray(const TConstUnionArray& c) { unionArray = c; }
|
||||
const TConstUnionArray& getConstArray() const { return unionArray; }
|
||||
protected:
|
||||
@@ -480,10 +496,11 @@ class TIntermConstantUnion : public TIntermTyped {
|
||||
public:
|
||||
TIntermConstantUnion(const TConstUnionArray& ua, const TType& t) : TIntermTyped(t), unionArray(ua) { }
|
||||
const TConstUnionArray& getConstArray() const { return unionArray; }
|
||||
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
|
||||
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
|
||||
virtual const TIntermConstantUnion* getAsConstantUnion() const { return this; }
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermTyped* fold(TOperator, TIntermTyped*);
|
||||
virtual TIntermTyped* fold(TOperator, const TType&);
|
||||
virtual TIntermTyped* fold(TOperator, const TIntermTyped*) const;
|
||||
virtual TIntermTyped* fold(TOperator, const TType&) const;
|
||||
protected:
|
||||
const TConstUnionArray unionArray;
|
||||
};
|
||||
@@ -493,7 +510,8 @@ protected:
|
||||
//
|
||||
class TIntermOperator : public TIntermTyped {
|
||||
public:
|
||||
TIntermOperator* getAsOperator() { return this; }
|
||||
virtual TIntermOperator* getAsOperator() { return this; }
|
||||
virtual const TIntermOperator* getAsOperator() const { return this; }
|
||||
TOperator getOp() { return op; }
|
||||
bool modifiesState() const;
|
||||
bool isConstructor() const;
|
||||
@@ -515,7 +533,8 @@ public:
|
||||
virtual void setRight(TIntermTyped* n) { right = n; }
|
||||
virtual TIntermTyped* getLeft() const { return left; }
|
||||
virtual TIntermTyped* getRight() const { return right; }
|
||||
virtual TIntermBinary* getAsBinaryNode() { return this; }
|
||||
virtual TIntermBinary* getAsBinaryNode() { return this; }
|
||||
virtual const TIntermBinary* getAsBinaryNode() const { return this; }
|
||||
virtual bool promote();
|
||||
virtual void updatePrecision();
|
||||
protected:
|
||||
@@ -533,7 +552,8 @@ public:
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual void setOperand(TIntermTyped* o) { operand = o; }
|
||||
virtual TIntermTyped* getOperand() { return operand; }
|
||||
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
||||
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
||||
virtual const TIntermUnary* getAsUnaryNode() const { return this; }
|
||||
virtual bool promote();
|
||||
virtual void updatePrecision();
|
||||
protected:
|
||||
@@ -550,7 +570,8 @@ public:
|
||||
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }
|
||||
TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
|
||||
~TIntermAggregate() { delete pragmaTable; }
|
||||
virtual TIntermAggregate* getAsAggregate() { return this; }
|
||||
virtual TIntermAggregate* getAsAggregate() { return this; }
|
||||
virtual const TIntermAggregate* getAsAggregate() const { return this; }
|
||||
virtual void setOperator(TOperator o) { op = o; }
|
||||
virtual TIntermSequence& getSequence() { return sequence; }
|
||||
virtual const TIntermSequence& getSequence() const { return sequence; }
|
||||
@@ -592,7 +613,8 @@ public:
|
||||
virtual TIntermTyped* getCondition() const { return condition; }
|
||||
virtual TIntermNode* getTrueBlock() const { return trueBlock; }
|
||||
virtual TIntermNode* getFalseBlock() const { return falseBlock; }
|
||||
virtual TIntermSelection* getAsSelectionNode() { return this; }
|
||||
virtual TIntermSelection* getAsSelectionNode() { return this; }
|
||||
virtual const TIntermSelection* getAsSelectionNode() const { return this; }
|
||||
protected:
|
||||
TIntermTyped* condition;
|
||||
TIntermNode* trueBlock;
|
||||
@@ -611,7 +633,8 @@ public:
|
||||
virtual void traverse(TIntermTraverser*);
|
||||
virtual TIntermNode* getCondition() const { return condition; }
|
||||
virtual TIntermAggregate* getBody() const { return body; }
|
||||
virtual TIntermSwitch* getAsSwitchNode() { return this; }
|
||||
virtual TIntermSwitch* getAsSwitchNode() { return this; }
|
||||
virtual const TIntermSwitch* getAsSwitchNode() const { return this; }
|
||||
protected:
|
||||
TIntermTyped* condition;
|
||||
TIntermAggregate* body;
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
// source have to figure out how to create revision.h just to get a build
|
||||
// going. However, if it is not updated, it can be a version behind.
|
||||
|
||||
#define GLSLANG_REVISION "24628"
|
||||
#define GLSLANG_DATE "2013/12/30 13:44:49"
|
||||
#define GLSLANG_REVISION "24635"
|
||||
#define GLSLANG_DATE "2013/12/31 16:02:24"
|
||||
|
||||
@@ -83,7 +83,9 @@ namespace glslang {
|
||||
//
|
||||
// Do folding between a pair of nodes
|
||||
//
|
||||
TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode)
|
||||
// Returns a new node representing the result.
|
||||
//
|
||||
TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TIntermTyped* constantNode) const
|
||||
{
|
||||
// For most cases, the return type matches the argument type, so set that
|
||||
// up and just code to exceptions below.
|
||||
@@ -94,7 +96,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
||||
// A pair of nodes is to be folded together
|
||||
//
|
||||
|
||||
TIntermConstantUnion *node = constantNode->getAsConstantUnion();
|
||||
const TIntermConstantUnion *node = constantNode->getAsConstantUnion();
|
||||
TConstUnionArray unionArray = getConstArray();
|
||||
TConstUnionArray rightUnionArray = node->getConstArray();
|
||||
|
||||
@@ -297,7 +299,9 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNod
|
||||
//
|
||||
// Do single unary node folding
|
||||
//
|
||||
TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
|
||||
// Returns a new node representing the result.
|
||||
//
|
||||
TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) const
|
||||
{
|
||||
// First, size the result, which is mostly the same as the argument's size,
|
||||
// but not always, and classify what is componentwise.
|
||||
|
||||
@@ -1455,7 +1455,7 @@ void TParseContext::constantValueCheck(TIntermTyped* node, const char* token)
|
||||
// Both test, and if necessary spit out an error, to see if the node is really
|
||||
// an integer.
|
||||
//
|
||||
void TParseContext::integerCheck(TIntermTyped* node, const char* token)
|
||||
void TParseContext::integerCheck(const TIntermTyped* node, const char* token)
|
||||
{
|
||||
if ((node->getBasicType() == EbtInt || node->getBasicType() == EbtUint) && node->isScalar())
|
||||
return;
|
||||
@@ -2820,7 +2820,7 @@ void TParseContext::setLayoutQualifier(TSourceLoc loc, TPublicType& publicType,
|
||||
if ((unsigned int)value >= TQualifier::layoutLocationEnd)
|
||||
error(loc, "location is too large", id.c_str(), "");
|
||||
else
|
||||
publicType.qualifier.layoutSlotLocation = value;
|
||||
publicType.qualifier.layoutLocation = value;
|
||||
return;
|
||||
}
|
||||
if (id == "binding") {
|
||||
@@ -2882,12 +2882,11 @@ void TParseContext::mergeObjectLayoutQualifiers(TSourceLoc loc, TQualifier& dst,
|
||||
{
|
||||
if (src.layoutMatrix != ElmNone)
|
||||
dst.layoutMatrix = src.layoutMatrix;
|
||||
|
||||
if (src.layoutPacking != ElpNone)
|
||||
dst.layoutPacking = src.layoutPacking;
|
||||
|
||||
if (src.hasLocation())
|
||||
dst.layoutSlotLocation = src.layoutSlotLocation;
|
||||
dst.layoutLocation = src.layoutLocation;
|
||||
|
||||
if (src.hasBinding())
|
||||
dst.layoutBinding = src.layoutBinding;
|
||||
@@ -2910,17 +2909,10 @@ void TParseContext::layoutTypeCheck(TSourceLoc loc, const TSymbol& symbol)
|
||||
if (qualifier.hasLocation()) {
|
||||
switch (qualifier.storage) {
|
||||
case EvqVaryingIn:
|
||||
{
|
||||
if (type.getBasicType() == EbtBlock)
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, 0 /* TODO ARB_enhanced_layouts*/, "location qualifier on input block");
|
||||
break;
|
||||
}
|
||||
case EvqVaryingOut:
|
||||
{
|
||||
if (type.getBasicType() == EbtBlock)
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, 0 /* TODO ARB_enhanced_layouts*/, "location qualifier on output block");
|
||||
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, 0 /* TODO ARB_enhanced_layouts*/, "location qualifier on in/out block");
|
||||
break;
|
||||
}
|
||||
case EvqUniform:
|
||||
case EvqBuffer:
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
void variableCheck(TIntermTyped*& nodePtr);
|
||||
bool lValueErrorCheck(TSourceLoc, const char* op, TIntermTyped*);
|
||||
void constantValueCheck(TIntermTyped* node, const char* token);
|
||||
void integerCheck(TIntermTyped* node, const char* token);
|
||||
void integerCheck(const TIntermTyped* node, const char* token);
|
||||
void globalCheck(TSourceLoc, const char* token);
|
||||
bool constructorError(TSourceLoc, TIntermNode*, TFunction&, TOperator, TType&);
|
||||
void arraySizeCheck(TSourceLoc, TIntermTyped* expr, int& size);
|
||||
|
||||
@@ -183,7 +183,7 @@ const char* TParseContext::getPreamble()
|
||||
"#define GL_ARB_shading_language_420pack 1\n"
|
||||
"#define GL_ARB_texture_gather 1\n"
|
||||
"#define GL_ARB_gpu_shader5 1\n"
|
||||
"#define GL_ARB_separate_shader_objects 1\n";
|
||||
"#define GL_ARB_separate_shader_objects 1\n"
|
||||
"#define GL_ARB_tessellation_shader 1\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,10 +253,10 @@ void TIntermediate::mergeErrorCheck(TInfoSink& infoSink, const TIntermSymbol& sy
|
||||
}
|
||||
|
||||
// Layouts...
|
||||
if (symbol.getQualifier().layoutMatrix != unitSymbol.getQualifier().layoutMatrix ||
|
||||
symbol.getQualifier().layoutPacking != unitSymbol.getQualifier().layoutPacking ||
|
||||
symbol.getQualifier().layoutSlotLocation != unitSymbol.getQualifier().layoutSlotLocation ||
|
||||
symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding) {
|
||||
if (symbol.getQualifier().layoutMatrix != unitSymbol.getQualifier().layoutMatrix ||
|
||||
symbol.getQualifier().layoutPacking != unitSymbol.getQualifier().layoutPacking ||
|
||||
symbol.getQualifier().layoutLocation != unitSymbol.getQualifier().layoutLocation ||
|
||||
symbol.getQualifier().layoutBinding != unitSymbol.getQualifier().layoutBinding) {
|
||||
error(infoSink, "Layout qualification must match:");
|
||||
writeTypeComparison = true;
|
||||
}
|
||||
@@ -510,7 +510,7 @@ int TIntermediate::addUsedLocation(const TQualifier& qualifier, const TType& typ
|
||||
size = computeTypeLocationSize(type);
|
||||
}
|
||||
|
||||
TRange range = { qualifier.layoutSlotLocation, qualifier.layoutSlotLocation + size - 1 };
|
||||
TRange range = { qualifier.layoutLocation, qualifier.layoutLocation + size - 1 };
|
||||
|
||||
// check for collisions, except for vertex inputs on desktop
|
||||
if (! (profile != EEsProfile && language == EShLangVertex && qualifier.isPipeInput())) {
|
||||
|
||||
Reference in New Issue
Block a user