From c86d38bb2bbb6e66782e19796cdb0ea1bd5b55d8 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Sat, 1 Oct 2016 13:30:37 -0600 Subject: [PATCH] Non-functional: Better use of .isParamOutput() and some other methods. --- glslang/Include/revision.h | 2 +- glslang/MachineIndependent/ParseHelper.cpp | 10 +++++----- hlsl/hlslParseHelper.cpp | 17 +++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 295d610..589c881 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // 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). -#define GLSLANG_REVISION "Overload400-PrecQual.1542" +#define GLSLANG_REVISION "Overload400-PrecQual.1543" #define GLSLANG_DATE "01-Oct-2016" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 8e8e7da..63140a0 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -1168,7 +1168,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction // means take 'arguments' itself as the one argument. TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments); TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier(); - if (formalQualifier.storage == EvqOut || formalQualifier.storage == EvqInOut) { + if (formalQualifier.isParamOutput()) { if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped())) error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", ""); } @@ -1499,7 +1499,7 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct // Will there be any output conversions? bool outputConversions = false; for (int i = 0; i < function.getParamCount(); ++i) { - if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().storage == EvqOut) { + if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().isParamOutput()) { outputConversions = true; break; } @@ -3003,7 +3003,7 @@ void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType ba void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier qualifier, const TType& type) { - if ((qualifier == EvqOut || qualifier == EvqInOut) && (type.getBasicType() == EbtSampler || type.getBasicType() == EbtAtomicUint)) + if ((qualifier == EvqOut || qualifier == EvqInOut) && type.isOpaque()) error(loc, "samplers and atomic_uints cannot be output parameters", type.getBasicTypeString().c_str(), ""); } @@ -3716,7 +3716,7 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali if (qualifier.invariant) error(loc, "cannot use invariant qualifier on a function parameter", "", ""); if (qualifier.noContraction) { - if (qualifier.storage == EvqOut || qualifier.storage == EvqInOut) + if (qualifier.isParamOutput()) type.getQualifier().noContraction = true; else warn(loc, "qualifier has no effect on non-output parameters", "precise", ""); @@ -4582,7 +4582,7 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type) // an array of size N, all elements of the array from binding through binding + N - 1 must be within this // range." // - if (type.getBasicType() != EbtSampler && type.getBasicType() != EbtBlock && type.getBasicType() != EbtAtomicUint) + if (! type.isOpaque() && type.getBasicType() != EbtBlock) error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", ""); if (type.getBasicType() == EbtSampler) { int lastBinding = qualifier.layoutBinding; diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 47c6fd6..42b57b9 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -2384,18 +2384,19 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI // Process each argument's conversion for (int i = 0; i < function.getParamCount(); ++i) { + if (! function[i].type->getQualifier().isParamInput()) + continue; + // At this early point there is a slight ambiguity between whether an aggregate 'arguments' // is the single argument itself or its children are the arguments. Only one argument // means take 'arguments' itself as the one argument. TIntermTyped* arg = function.getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped()); if (*function[i].type != arg->getType()) { - if (function[i].type->getQualifier().isParamInput()) { - // In-qualified arguments just need an extra node added above the argument to - // convert to the correct type. - arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg); - arg = intermediate.addShapeConversion(EOpFunctionCall, *function[i].type, arg); - setArg(i, arg); - } + // In-qualified arguments just need an extra node added above the argument to + // convert to the correct type. + arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg); + arg = intermediate.addShapeConversion(EOpFunctionCall, *function[i].type, arg); + setArg(i, arg); } else { if (shouldFlatten(arg->getType())) { // Will make a two-level subtree. @@ -2436,7 +2437,7 @@ TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& fu // Will there be any output conversions? bool outputConversions = false; for (int i = 0; i < function.getParamCount(); ++i) { - if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().storage == EvqOut) { + if (*function[i].type != arguments[i]->getAsTyped()->getType() && function[i].type->getQualifier().isParamOutput()) { outputConversions = true; break; } -- 2.7.4