More preparation for pure built-in functions as enums: Add texturing op cracker.
This commit is contained in:
parent
ef676b0a59
commit
81639827d5
@ -350,8 +350,7 @@ enum TOperator {
|
|||||||
// Image operations
|
// Image operations
|
||||||
//
|
//
|
||||||
|
|
||||||
// N.B. The following is not being used yet, pending input, as switching
|
EOpImageGuardBegin,
|
||||||
// to it from the current text-based approach will break existing consumers.
|
|
||||||
|
|
||||||
EOpImageQuerySize,
|
EOpImageQuerySize,
|
||||||
EOpImageQuerySamples,
|
EOpImageQuerySamples,
|
||||||
@ -366,11 +365,14 @@ enum TOperator {
|
|||||||
EOpImageAtomicExchange,
|
EOpImageAtomicExchange,
|
||||||
EOpImageAtomicCompSwap,
|
EOpImageAtomicCompSwap,
|
||||||
|
|
||||||
|
EOpImageGuardEnd,
|
||||||
|
|
||||||
//
|
//
|
||||||
// Texture operations
|
// Texture operations
|
||||||
//
|
//
|
||||||
|
|
||||||
EOpTextureGuardBegin,
|
EOpTextureGuardBegin,
|
||||||
|
|
||||||
EOpTextureQuerySize,
|
EOpTextureQuerySize,
|
||||||
EOpTextureQueryLod,
|
EOpTextureQueryLod,
|
||||||
EOpTextureQueryLevels,
|
EOpTextureQueryLevels,
|
||||||
@ -392,6 +394,7 @@ enum TOperator {
|
|||||||
EOpTextureGather,
|
EOpTextureGather,
|
||||||
EOpTextureGatherOffset,
|
EOpTextureGatherOffset,
|
||||||
EOpTextureGatherOffsets,
|
EOpTextureGatherOffsets,
|
||||||
|
|
||||||
EOpTextureGuardEnd,
|
EOpTextureGuardEnd,
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -605,6 +608,18 @@ protected:
|
|||||||
bool literal; // true if node represents a literal in the source code
|
bool literal; // true if node represents a literal in the source code
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Represent the independent aspects of a texturing TOperator
|
||||||
|
struct TCrackedTextureOp {
|
||||||
|
bool query;
|
||||||
|
bool proj;
|
||||||
|
bool lod;
|
||||||
|
bool fetch;
|
||||||
|
bool offset;
|
||||||
|
bool offsets;
|
||||||
|
bool gather;
|
||||||
|
bool grad;
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Intermediate class for node types that hold operators.
|
// Intermediate class for node types that hold operators.
|
||||||
//
|
//
|
||||||
@ -613,9 +628,98 @@ public:
|
|||||||
virtual TIntermOperator* getAsOperator() { return this; }
|
virtual TIntermOperator* getAsOperator() { return this; }
|
||||||
virtual const TIntermOperator* getAsOperator() const { return this; }
|
virtual const TIntermOperator* getAsOperator() const { return this; }
|
||||||
TOperator getOp() const { return op; }
|
TOperator getOp() const { return op; }
|
||||||
|
virtual bool promote() { return true; }
|
||||||
bool modifiesState() const;
|
bool modifiesState() const;
|
||||||
bool isConstructor() const;
|
bool isConstructor() const;
|
||||||
virtual bool promote() { return true; }
|
bool isTexture() const { return op > EOpTextureGuardBegin && op < EOpTextureGuardEnd; }
|
||||||
|
bool isImage() const { return op > EOpImageGuardBegin && op < EOpImageGuardEnd; }
|
||||||
|
|
||||||
|
// Crack the op into the individual dimensions of texturing operation.
|
||||||
|
void crackTexture(TCrackedTextureOp& cracked) const
|
||||||
|
{
|
||||||
|
cracked.query = false;
|
||||||
|
cracked.proj = false;
|
||||||
|
cracked.lod = false;
|
||||||
|
cracked.fetch = false;
|
||||||
|
cracked.offset = false;
|
||||||
|
cracked.offsets = false;
|
||||||
|
cracked.gather = false;
|
||||||
|
cracked.grad = false;
|
||||||
|
|
||||||
|
switch (op) {
|
||||||
|
case EOpTextureQuerySize:
|
||||||
|
case EOpTextureQueryLod:
|
||||||
|
case EOpTextureQueryLevels:
|
||||||
|
case EOpTextureQuerySamples:
|
||||||
|
cracked.query = true;
|
||||||
|
break;
|
||||||
|
case EOpTexture:
|
||||||
|
break;
|
||||||
|
case EOpTextureProj:
|
||||||
|
cracked.proj = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureLod:
|
||||||
|
cracked.lod = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureOffset:
|
||||||
|
cracked.offset = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureFetch:
|
||||||
|
cracked.fetch = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureFetchOffset:
|
||||||
|
cracked.fetch = true;
|
||||||
|
cracked.offset = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureProjOffset:
|
||||||
|
cracked.offset = true;
|
||||||
|
cracked.proj = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureLodOffset:
|
||||||
|
cracked.offset = true;
|
||||||
|
cracked.lod = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureProjLod:
|
||||||
|
cracked.lod = true;
|
||||||
|
cracked.proj = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureProjLodOffset:
|
||||||
|
cracked.offset = true;
|
||||||
|
cracked.lod = true;
|
||||||
|
cracked.proj = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureGrad:
|
||||||
|
cracked.grad = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureGradOffset:
|
||||||
|
cracked.grad = true;
|
||||||
|
cracked.offset = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureProjGrad:
|
||||||
|
cracked.grad = true;
|
||||||
|
cracked.proj = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureProjGradOffset:
|
||||||
|
cracked.grad = true;
|
||||||
|
cracked.offset = true;
|
||||||
|
cracked.proj = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureGather:
|
||||||
|
cracked.gather = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureGatherOffset:
|
||||||
|
cracked.gather = true;
|
||||||
|
cracked.offset = true;
|
||||||
|
break;
|
||||||
|
case EOpTextureGatherOffsets:
|
||||||
|
cracked.gather = true;
|
||||||
|
cracked.offsets = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TIntermOperator(TOperator o) : TIntermTyped(EbtFloat), op(o) {}
|
TIntermOperator(TOperator o) : TIntermTyped(EbtFloat), op(o) {}
|
||||||
TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
|
TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
|
||||||
@ -652,6 +756,7 @@ public:
|
|||||||
virtual void traverse(TIntermTraverser*);
|
virtual void traverse(TIntermTraverser*);
|
||||||
virtual void setOperand(TIntermTyped* o) { operand = o; }
|
virtual void setOperand(TIntermTyped* o) { operand = o; }
|
||||||
virtual TIntermTyped* getOperand() { return operand; }
|
virtual TIntermTyped* getOperand() { return operand; }
|
||||||
|
virtual const TIntermTyped* getOperand() const { return operand; }
|
||||||
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
virtual TIntermUnary* getAsUnaryNode() { return this; }
|
||||||
virtual const TIntermUnary* getAsUnaryNode() const { return this; }
|
virtual const TIntermUnary* getAsUnaryNode() const { return this; }
|
||||||
virtual bool promote();
|
virtual bool promote();
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// For the version, it uses the latest git tag followed by the number of commits.
|
||||||
// For the date, it uses the current date (when then script is run).
|
// For the date, it uses the current date (when then script is run).
|
||||||
|
|
||||||
#define GLSLANG_REVISION "2.3.725"
|
#define GLSLANG_REVISION "2.3.726"
|
||||||
#define GLSLANG_DATE "18-Aug-2015"
|
#define GLSLANG_DATE "19-Aug-2015"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user