Put all glslang internals (but not the external interface) into the glslang namespace.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22882 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
23bdb29eac
commit
b603f918a4
55 changed files with 511 additions and 463 deletions
|
|
@ -37,6 +37,8 @@
|
|||
#ifndef _BASICTYPES_INCLUDED_
|
||||
#define _BASICTYPES_INCLUDED_
|
||||
|
||||
namespace glslang {
|
||||
|
||||
//
|
||||
// Basic type. Arrays, vectors, sampler details, etc., are orthogonal to this.
|
||||
//
|
||||
|
|
@ -97,7 +99,7 @@ enum TStorageQualifier {
|
|||
};
|
||||
|
||||
// These will show up in error messages
|
||||
__inline const char* getStorageQualifierString(TStorageQualifier q)
|
||||
__inline const char* GetStorageQualifierString(TStorageQualifier q)
|
||||
{
|
||||
switch (q) {
|
||||
case EvqTemporary: return "temporary"; break;
|
||||
|
|
@ -133,7 +135,7 @@ enum TPrecisionQualifier {
|
|||
EpqHigh
|
||||
};
|
||||
|
||||
__inline const char* getPrecisionQualifierString(TPrecisionQualifier p)
|
||||
__inline const char* GetPrecisionQualifierString(TPrecisionQualifier p)
|
||||
{
|
||||
switch(p) {
|
||||
case EpqNone: return ""; break;
|
||||
|
|
@ -144,4 +146,6 @@ __inline const char* getPrecisionQualifierString(TPrecisionQualifier p)
|
|||
}
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _BASICTYPES_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@
|
|||
#define TBaseList std::list
|
||||
#define TBaseSet std::set
|
||||
|
||||
namespace glslang {
|
||||
|
||||
//
|
||||
// Pool version of string.
|
||||
//
|
||||
|
|
@ -170,4 +172,6 @@ typedef TMap<TString, TString>::tAllocator TPragmaTableAllocator;
|
|||
|
||||
const int GlslangMaxTokenLength = 1024;
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _COMMON_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -37,8 +37,9 @@
|
|||
#ifndef _CONSTANT_UNION_INCLUDED_
|
||||
#define _CONSTANT_UNION_INCLUDED_
|
||||
|
||||
namespace glslang {
|
||||
|
||||
class constUnion {
|
||||
class TConstUnion {
|
||||
public:
|
||||
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
|
|
@ -103,7 +104,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const constUnion& constant) const
|
||||
bool operator==(const TConstUnion& constant) const
|
||||
{
|
||||
if (constant.type != type)
|
||||
return false;
|
||||
|
|
@ -156,12 +157,12 @@ public:
|
|||
return !operator==(b);
|
||||
}
|
||||
|
||||
bool operator!=(const constUnion& constant) const
|
||||
bool operator!=(const TConstUnion& constant) const
|
||||
{
|
||||
return !operator==(constant);
|
||||
}
|
||||
|
||||
bool operator>(const constUnion& constant) const
|
||||
bool operator>(const TConstUnion& constant) const
|
||||
{
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
|
|
@ -188,7 +189,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool operator<(const constUnion& constant) const
|
||||
bool operator<(const TConstUnion& constant) const
|
||||
{
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
|
|
@ -215,9 +216,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
constUnion operator+(const constUnion& constant) const
|
||||
TConstUnion operator+(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
|
||||
|
|
@ -229,9 +230,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator-(const constUnion& constant) const
|
||||
TConstUnion operator-(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
|
||||
|
|
@ -243,9 +244,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator*(const constUnion& constant) const
|
||||
TConstUnion operator*(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
|
||||
|
|
@ -257,9 +258,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator%(const constUnion& constant) const
|
||||
TConstUnion operator%(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
|
||||
|
|
@ -270,9 +271,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator>>(const constUnion& constant) const
|
||||
TConstUnion operator>>(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
switch (type) {
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
|
|
@ -294,9 +295,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator<<(const constUnion& constant) const
|
||||
TConstUnion operator<<(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
switch (type) {
|
||||
case EbtInt:
|
||||
switch (constant.type) {
|
||||
|
|
@ -318,9 +319,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator&(const constUnion& constant) const
|
||||
TConstUnion operator&(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
|
||||
|
|
@ -331,9 +332,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator|(const constUnion& constant) const
|
||||
TConstUnion operator|(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
|
||||
|
|
@ -344,9 +345,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator^(const constUnion& constant) const
|
||||
TConstUnion operator^(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
|
||||
|
|
@ -357,9 +358,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator~() const
|
||||
TConstUnion operator~() const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
switch (type) {
|
||||
case EbtInt: returnValue.setIConst(~iConst); break;
|
||||
case EbtUint: returnValue.setUConst(~uConst); break;
|
||||
|
|
@ -369,9 +370,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator&&(const constUnion& constant) const
|
||||
TConstUnion operator&&(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtBool: returnValue.setBConst(bConst && constant.bConst); break;
|
||||
|
|
@ -381,9 +382,9 @@ public:
|
|||
return returnValue;
|
||||
}
|
||||
|
||||
constUnion operator||(const constUnion& constant) const
|
||||
TConstUnion operator||(const TConstUnion& constant) const
|
||||
{
|
||||
constUnion returnValue;
|
||||
TConstUnion returnValue;
|
||||
assert(type == constant.type);
|
||||
switch (type) {
|
||||
case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
|
||||
|
|
@ -406,4 +407,6 @@ private:
|
|||
TBasicType type;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _CONSTANT_UNION_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@
|
|||
#include "../Include/Common.h"
|
||||
#include <math.h>
|
||||
|
||||
namespace glslang {
|
||||
|
||||
//
|
||||
// TPrefixType is used to centralize how info log messages start.
|
||||
// See below.
|
||||
|
|
@ -131,10 +133,12 @@ protected:
|
|||
int outputStream;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
class TInfoSink {
|
||||
public:
|
||||
TInfoSinkBase info;
|
||||
TInfoSinkBase debug;
|
||||
glslang::TInfoSinkBase info;
|
||||
glslang::TInfoSinkBase debug;
|
||||
};
|
||||
|
||||
#endif // _INFOSINK_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -35,9 +35,13 @@
|
|||
#ifndef __INITIALIZE_GLOBALS_INCLUDED_
|
||||
#define __INITIALIZE_GLOBALS_INCLUDED_
|
||||
|
||||
namespace glslang {
|
||||
|
||||
void InitializeGlobalPools();
|
||||
void FreeGlobalPools();
|
||||
bool InitializePoolIndex();
|
||||
void FreePoolIndex();
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // __INITIALIZE_GLOBALS_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@
|
|||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
namespace glslang {
|
||||
|
||||
// If we are using guard blocks, we must track each indivual
|
||||
// allocation. If we aren't using guard blocks, these
|
||||
// never get instantiated, so won't have any impact.
|
||||
|
|
@ -316,4 +318,6 @@ protected:
|
|||
TPoolAllocator& allocator;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _POOLALLOC_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -58,4 +58,5 @@ struct TBuiltInResource {
|
|||
int minProgramTexelOffset;
|
||||
int maxProgramTexelOffset;
|
||||
};
|
||||
|
||||
#endif // _RESOURCE_LIMITS_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ class TCompiler;
|
|||
class TLinker;
|
||||
class TUniformMap;
|
||||
|
||||
|
||||
//
|
||||
// The base class used to back handles returned to the driver.
|
||||
//
|
||||
|
|
@ -78,6 +77,7 @@ public:
|
|||
virtual TInfoSink& getInfoSink() { return infoSink; }
|
||||
TInfoSink infoSink;
|
||||
};
|
||||
|
||||
class TIntermNode;
|
||||
|
||||
//
|
||||
|
|
@ -105,8 +105,8 @@ protected:
|
|||
//
|
||||
// Link operations are base on a list of compile results...
|
||||
//
|
||||
typedef TVector<TCompiler*> TCompilerList;
|
||||
typedef TVector<TShHandleBase*> THandleList;
|
||||
typedef glslang::TVector<TCompiler*> TCompilerList;
|
||||
typedef glslang::TVector<TShHandleBase*> THandleList;
|
||||
|
||||
//
|
||||
// The base class for the machine dependent linker to derive from
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#include "../Include/Common.h"
|
||||
#include "../Include/BaseTypes.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
const int GlslangMaxTypeLength = 200;
|
||||
|
||||
//
|
||||
|
|
@ -680,8 +682,8 @@ public:
|
|||
return getBasicString();
|
||||
}
|
||||
|
||||
const char* getStorageQualifierString() const { return ::getStorageQualifierString(qualifier.storage); }
|
||||
const char* getPrecisionQualifierString() const { return ::getPrecisionQualifierString(qualifier.precision); }
|
||||
const char* getStorageQualifierString() const { return GetStorageQualifierString(qualifier.storage); }
|
||||
const char* getPrecisionQualifierString() const { return GetPrecisionQualifierString(qualifier.precision); }
|
||||
TTypeList* getStruct() { return structure; }
|
||||
TTypeList* getStruct() const { return structure; }
|
||||
|
||||
|
|
@ -753,4 +755,6 @@ protected:
|
|||
TString *typeName; // for structure field type name
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // _TYPES_INCLUDED_
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@
|
|||
#include "../Include/Types.h"
|
||||
#include "../Include/ConstantUnion.h"
|
||||
|
||||
namespace glslang {
|
||||
|
||||
//
|
||||
// Operators used by the high-level (parse tree) representation.
|
||||
//
|
||||
|
|
@ -324,34 +326,41 @@ class TIntermBranch;
|
|||
class TIntermTyped;
|
||||
class TIntermMethod;
|
||||
class TIntermSymbol;
|
||||
class TInfoSink;
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
//
|
||||
// Base class for the tree nodes
|
||||
//
|
||||
// (Put outside the glslang namespace, as it's used as part of the external interface.)
|
||||
//
|
||||
class TIntermNode {
|
||||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
POOL_ALLOCATOR_NEW_DELETE(glslang::GetThreadPoolAllocator())
|
||||
|
||||
TIntermNode() { loc.line = 0; loc.string = 0; }
|
||||
virtual TSourceLoc getLoc() const { return loc; }
|
||||
virtual void setLoc(TSourceLoc l) { loc = l; }
|
||||
virtual void traverse(TIntermTraverser*) = 0;
|
||||
virtual TIntermTyped* getAsTyped() { return 0; }
|
||||
virtual TIntermConstantUnion* getAsConstantUnion() { return 0; }
|
||||
virtual TIntermAggregate* getAsAggregate() { return 0; }
|
||||
virtual TIntermUnary* getAsUnaryNode() { return 0; }
|
||||
virtual TIntermBinary* getAsBinaryNode() { return 0; }
|
||||
virtual TIntermSelection* getAsSelectionNode() { return 0; }
|
||||
virtual TIntermSwitch* getAsSwitchNode() { return 0; }
|
||||
virtual TIntermMethod* getAsMethodNode() { return 0; }
|
||||
virtual TIntermSymbol* getAsSymbolNode() { return 0; }
|
||||
virtual TIntermBranch* getAsBranchNode() { return 0; }
|
||||
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::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 ~TIntermNode() { }
|
||||
protected:
|
||||
TSourceLoc loc;
|
||||
glslang::TSourceLoc loc;
|
||||
};
|
||||
|
||||
class TInfoSink;
|
||||
|
||||
namespace glslang {
|
||||
|
||||
//
|
||||
// This is just to help yacc.
|
||||
//
|
||||
|
|
@ -465,15 +474,15 @@ protected:
|
|||
|
||||
class TIntermConstantUnion : public TIntermTyped {
|
||||
public:
|
||||
TIntermConstantUnion(constUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
|
||||
constUnion* getUnionArrayPointer() const { return unionArrayPointer; }
|
||||
void setUnionArrayPointer(constUnion *c) { unionArrayPointer = c; }
|
||||
TIntermConstantUnion(TConstUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer) { }
|
||||
TConstUnion* getUnionArrayPointer() const { return unionArrayPointer; }
|
||||
void setUnionArrayPointer(TConstUnion *c) { unionArrayPointer = c; }
|
||||
virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
|
||||
virtual void traverse(TIntermTraverser* );
|
||||
virtual TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
|
||||
virtual TIntermTyped* fold(TOperator, const TType&, TInfoSink&);
|
||||
protected:
|
||||
constUnion *unionArrayPointer;
|
||||
TConstUnion *unionArrayPointer;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
@ -646,4 +655,6 @@ public:
|
|||
bool rightToLeft;
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
#endif // __INTERMEDIATE_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue