Full stack: distinguish between a scalar and a vector of size 1.

There have been GLSL extensions considering this, and HLSL does it.
This is a fully backward compatible change that allows this distinction.
This commit is contained in:
John Kessenich
2016-05-20 12:06:03 -06:00
parent 823fc65644
commit 8d72f1a2c4
9 changed files with 152 additions and 29 deletions

View File

@@ -219,8 +219,12 @@ bool HlslGrammar::acceptType(TType& type)
new(&type) TType(EbtInt);
break;
case EHTokFloat:
new(&type) TType(EbtFloat);
break;
case EHTokFloat1:
new(&type) TType(EbtFloat);
type.makeVector();
break;
case EHTokFloat2:

View File

@@ -1655,13 +1655,6 @@ void HlslParseContext::boolCheck(const TSourceLoc& loc, const TIntermTyped* type
error(loc, "boolean expression expected", "", "");
}
// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
void HlslParseContext::boolCheck(const TSourceLoc& loc, const TPublicType& pType)
{
if (pType.basicType != EbtBool || pType.arraySizes || pType.matrixCols > 1 || (pType.vectorSize > 1))
error(loc, "boolean expression expected", "", "");
}
//
// Fix just a full qualifier (no variables or types yet, but qualifier is complete) at global level.
//

View File

@@ -107,7 +107,6 @@ public:
void arrayDimMerge(TType& type, const TArraySizes* sizes);
bool voidErrorCheck(const TSourceLoc&, const TString&, TBasicType);
void boolCheck(const TSourceLoc&, const TIntermTyped*);
void boolCheck(const TSourceLoc&, const TPublicType&);
void globalQualifierFix(const TSourceLoc&, TQualifier&);
bool structQualifierErrorCheck(const TSourceLoc&, const TPublicType& pType);
void mergeQualifiers(const TSourceLoc&, TQualifier& dst, const TQualifier& src, bool force);