Non-functional: Better use of .isParamOutput() and some other methods.
This commit is contained in:
@@ -2,5 +2,5 @@
|
|||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// 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).
|
// 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"
|
#define GLSLANG_DATE "01-Oct-2016"
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
|
|||||||
// means take 'arguments' itself as the one argument.
|
// means take 'arguments' itself as the one argument.
|
||||||
TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments);
|
TIntermNode* arg = fnCandidate->getParamCount() == 1 ? arguments : (aggregate ? aggregate->getSequence()[i] : arguments);
|
||||||
TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier();
|
TQualifier& formalQualifier = (*fnCandidate)[i].type->getQualifier();
|
||||||
if (formalQualifier.storage == EvqOut || formalQualifier.storage == EvqInOut) {
|
if (formalQualifier.isParamOutput()) {
|
||||||
if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped()))
|
if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped()))
|
||||||
error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", "");
|
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?
|
// Will there be any output conversions?
|
||||||
bool outputConversions = false;
|
bool outputConversions = false;
|
||||||
for (int i = 0; i < function.getParamCount(); ++i) {
|
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;
|
outputConversions = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3003,7 +3003,7 @@ void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType ba
|
|||||||
|
|
||||||
void TParseContext::parameterTypeCheck(const TSourceLoc& loc, TStorageQualifier qualifier, const TType& type)
|
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(), "");
|
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)
|
if (qualifier.invariant)
|
||||||
error(loc, "cannot use invariant qualifier on a function parameter", "", "");
|
error(loc, "cannot use invariant qualifier on a function parameter", "", "");
|
||||||
if (qualifier.noContraction) {
|
if (qualifier.noContraction) {
|
||||||
if (qualifier.storage == EvqOut || qualifier.storage == EvqInOut)
|
if (qualifier.isParamOutput())
|
||||||
type.getQualifier().noContraction = true;
|
type.getQualifier().noContraction = true;
|
||||||
else
|
else
|
||||||
warn(loc, "qualifier has no effect on non-output parameters", "precise", "");
|
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
|
// an array of size N, all elements of the array from binding through binding + N - 1 must be within this
|
||||||
// range."
|
// 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", "");
|
error(loc, "requires block, or sampler/image, or atomic-counter type", "binding", "");
|
||||||
if (type.getBasicType() == EbtSampler) {
|
if (type.getBasicType() == EbtSampler) {
|
||||||
int lastBinding = qualifier.layoutBinding;
|
int lastBinding = qualifier.layoutBinding;
|
||||||
|
|||||||
@@ -2384,18 +2384,19 @@ void HlslParseContext::addInputArgumentConversions(const TFunction& function, TI
|
|||||||
|
|
||||||
// Process each argument's conversion
|
// Process each argument's conversion
|
||||||
for (int i = 0; i < function.getParamCount(); ++i) {
|
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'
|
// 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
|
// is the single argument itself or its children are the arguments. Only one argument
|
||||||
// means take 'arguments' itself as the one argument.
|
// means take 'arguments' itself as the one argument.
|
||||||
TIntermTyped* arg = function.getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped());
|
TIntermTyped* arg = function.getParamCount() == 1 ? arguments->getAsTyped() : (aggregate ? aggregate->getSequence()[i]->getAsTyped() : arguments->getAsTyped());
|
||||||
if (*function[i].type != arg->getType()) {
|
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
|
||||||
// In-qualified arguments just need an extra node added above the argument to
|
// convert to the correct type.
|
||||||
// convert to the correct type.
|
arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg);
|
||||||
arg = intermediate.addConversion(EOpFunctionCall, *function[i].type, arg);
|
arg = intermediate.addShapeConversion(EOpFunctionCall, *function[i].type, arg);
|
||||||
arg = intermediate.addShapeConversion(EOpFunctionCall, *function[i].type, arg);
|
setArg(i, arg);
|
||||||
setArg(i, arg);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (shouldFlatten(arg->getType())) {
|
if (shouldFlatten(arg->getType())) {
|
||||||
// Will make a two-level subtree.
|
// Will make a two-level subtree.
|
||||||
@@ -2436,7 +2437,7 @@ TIntermTyped* HlslParseContext::addOutputArgumentConversions(const TFunction& fu
|
|||||||
// Will there be any output conversions?
|
// Will there be any output conversions?
|
||||||
bool outputConversions = false;
|
bool outputConversions = false;
|
||||||
for (int i = 0; i < function.getParamCount(); ++i) {
|
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;
|
outputConversions = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user