Non-functional: Better use of .isParamOutput() and some other methods.

This commit is contained in:
John Kessenich 2016-10-01 13:30:37 -06:00
parent ba56e23e8a
commit c86d38bb2b
3 changed files with 15 additions and 14 deletions

View File

@ -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"

View File

@ -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;

View File

@ -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;
}