Merge pull request #619 from steve-lunarg/opcode-specific-promote

HLSL: opcode specific promotion rules for interlocked ops
This commit is contained in:
John Kessenich 2016-12-08 11:17:21 -07:00 committed by GitHub
commit 302e619e4e
7 changed files with 169 additions and 8 deletions

View file

@ -304,7 +304,7 @@ TVariable* TParseContextBase::getEditableVariable(const char* name)
const TFunction* TParseContextBase::selectFunction(
const TVector<const TFunction*> candidateList,
const TFunction& call,
std::function<bool(const TType& from, const TType& to)> convertible,
std::function<bool(const TType& from, const TType& to, TOperator op, int arg)> convertible,
std::function<bool(const TType& from, const TType& to1, const TType& to2)> better,
/* output */ bool& tie)
{
@ -356,13 +356,13 @@ const TFunction* TParseContextBase::selectFunction(
bool viable = true;
for (int param = 0; param < candidate.getParamCount(); ++param) {
if (candidate[param].type->getQualifier().isParamInput()) {
if (! convertible(*call[param].type, *candidate[param].type)) {
if (! convertible(*call[param].type, *candidate[param].type, candidate.getBuiltInOp(), param)) {
viable = false;
break;
}
}
if (candidate[param].type->getQualifier().isParamOutput()) {
if (! convertible(*candidate[param].type, *call[param].type)) {
if (! convertible(*candidate[param].type, *call[param].type, candidate.getBuiltInOp(), param)) {
viable = false;
break;
}

View file

@ -4875,7 +4875,7 @@ const TFunction* TParseContext::findFunction400(const TSourceLoc& loc, const TFu
symbolTable.findFunctionNameList(call.getMangledName(), candidateList, builtIn);
// can 'from' convert to 'to'?
const auto convertible = [this](const TType& from, const TType& to) -> bool {
const auto convertible = [this](const TType& from, const TType& to, TOperator, int) -> bool {
if (from == to)
return true;
if (from.isArray() || to.isArray() || ! from.sameElementShape(to))

View file

@ -167,7 +167,7 @@ protected:
// see implementation for detail
const TFunction* selectFunction(const TVector<const TFunction*>, const TFunction&,
std::function<bool(const TType&, const TType&)>,
std::function<bool(const TType&, const TType&, TOperator, int arg)>,
std::function<bool(const TType&, const TType&, const TType&)>,
/* output */ bool& tie);