HLSL: Support vector 'cond ? :' -> EOpMix -> OpSelect.
This commit is contained in:
@@ -2536,7 +2536,7 @@ bool HlslGrammar::acceptConditionalExpression(TIntermTyped*& node)
|
||||
if (! acceptTokenClass(EHTokQuestion))
|
||||
return true;
|
||||
|
||||
node = parseContext.convertConditionalExpression(token.loc, node);
|
||||
node = parseContext.convertConditionalExpression(token.loc, node, false);
|
||||
if (node == nullptr)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -4529,9 +4529,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
|
||||
|
||||
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
|
||||
// report an error and return nullptr.
|
||||
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition)
|
||||
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition, bool mustBeScalar)
|
||||
{
|
||||
if (!condition->getType().isScalarOrVec1()) {
|
||||
if (mustBeScalar && !condition->getType().isScalarOrVec1()) {
|
||||
error(loc, "requires a scalar", "conditional expression", "");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
const glslang::TString* component);
|
||||
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
|
||||
int subComponent, const glslang::TString*);
|
||||
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*);
|
||||
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*, bool mustBeScalar = true);
|
||||
TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
|
||||
|
||||
bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);
|
||||
|
||||
Reference in New Issue
Block a user