Support suffixes for floats and doubles (none were supported in 110).

Add preprocessor support for parsing doubles.

Add double support to the flex stage.

Put in some of the basic double supported needed in the front end.

Add generic support for version numbers in the preprocessor, and the core, compatibility, and es profiles.


git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@19949 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2012-12-12 22:42:30 +00:00
parent e95ecc54fa
commit 5d3e2e35b6
15 changed files with 842 additions and 770 deletions

View file

@ -41,6 +41,7 @@
enum TBasicType {
EbtVoid,
EbtFloat,
EbtDouble,
EbtInt,
EbtBool,
EbtGuardSamplerBegin, // non type: see implementation of IsSampler()

View file

@ -42,13 +42,16 @@ public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
void setIConst(int i) {iConst = i; type = EbtInt; }
void setFConst(float f) {fConst = f; type = EbtFloat; }
void setDConst(double d) {dConst = d; type = EbtDouble; }
void setBConst(bool b) {bConst = b; type = EbtBool; }
int getIConst() { return iConst; }
float getFConst() { return fConst; }
double getDConst() { return dConst; }
bool getBConst() { return bConst; }
int getIConst() const { return iConst; }
float getFConst() const { return fConst; }
double getDConst() const { return dConst; }
bool getBConst() const { return bConst; }
bool operator==(const int i) const
@ -67,6 +70,14 @@ public:
return false;
}
bool operator==(const double d) const
{
if (d == dConst)
return true;
return false;
}
bool operator==(const bool b) const
{
if (b == bConst)
@ -90,6 +101,11 @@ public:
if (constant.fConst == fConst)
return true;
break;
case EbtDouble:
if (constant.dConst == dConst)
return true;
break;
case EbtBool:
if (constant.bConst == bConst)
@ -134,6 +150,11 @@ public:
if (fConst > constant.fConst)
return true;
return false;
case EbtDouble:
if (dConst > constant.dConst)
return true;
return false;
default:
assert(false && "Default missing");
@ -156,6 +177,11 @@ public:
if (fConst < constant.fConst)
return true;
return false;
case EbtDouble:
if (dConst < constant.dConst)
return true;
return false;
default:
assert(false && "Default missing");
@ -172,6 +198,7 @@ public:
switch (type) {
case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
case EbtFloat: returnValue.setFConst(fConst + constant.fConst); break;
case EbtDouble: returnValue.setDConst(dConst + constant.dConst); break;
default: assert(false && "Default missing");
}
@ -185,6 +212,7 @@ public:
switch (type) {
case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
case EbtFloat: returnValue.setFConst(fConst - constant.fConst); break;
case EbtDouble: returnValue.setDConst(dConst - constant.dConst); break;
default: assert(false && "Default missing");
}
@ -198,6 +226,7 @@ public:
switch (type) {
case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
case EbtFloat: returnValue.setFConst(fConst * constant.fConst); break;
case EbtDouble: returnValue.setDConst(dConst * constant.dConst); break;
default: assert(false && "Default missing");
}
@ -307,6 +336,7 @@ private:
int iConst; // used for ivec, scalar ints
bool bConst; // used for bvec, scalar bools
float fConst; // used for vec, mat, scalar floats
double dConst; // used for dvec, dmat, scalar doubles
} ;
TBasicType type;

View file

@ -235,6 +235,7 @@ public:
switch (t) {
case EbtVoid: return "void"; break;
case EbtFloat: return "float"; break;
case EbtDouble: return "double"; break;
case EbtInt: return "int"; break;
case EbtBool: return "bool"; break;
case EbtSampler1D: return "sampler1D"; break;

View file

@ -187,6 +187,7 @@ enum TOperator {
EOpConstructInt,
EOpConstructBool,
EOpConstructFloat,
EOpConstructDouble,
EOpConstructVec2,
EOpConstructVec3,
EOpConstructVec4,