Add precision qualifier propagation for swizzling, texture lookups, built-in funtions mapped to operators, comma op, and more robustly propagate for all binary/unary ops.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@21622 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-05-17 02:51:45 +00:00
parent 61f205ecd8
commit 2d0f1e5424
4 changed files with 68 additions and 37 deletions

View file

@ -410,12 +410,12 @@ postfix_expression
unionArray->setIConst(fields.offsets[0]);
TIntermTyped* index = parseContext.intermediate.addConstantUnion(unionArray, TType(EbtInt, EvqConst), $3.line);
$$ = parseContext.intermediate.addIndex(EOpIndexDirect, $1, index, $2.line);
$$->setType(TType($1->getBasicType()));
$$->setType(TType($1->getBasicType(), EvqTemporary, $1->getType().getQualifier().precision));
} else {
TString vectorString = *$3.string;
TIntermTyped* index = parseContext.intermediate.addSwizzle(fields, $3.line);
$$ = parseContext.intermediate.addIndex(EOpVectorSwizzle, $1, index, $2.line);
$$->setType(TType($1->getBasicType(), EvqTemporary, (int) vectorString.size()));
$$->setType(TType($1->getBasicType(), EvqTemporary, $1->getType().getQualifier().precision, (int) vectorString.size()));
}
}
} else if ($1->isMatrix()) {
@ -582,6 +582,11 @@ function_call
}
qualifierList.push_back(qual);
}
// built-in texturing functions get their return value precision from the precision of the sampler
if (builtIn && fnCandidate->getReturnType().getQualifier().precision == EpqNone &&
fnCandidate->getParamCount() > 0 && (*fnCandidate)[0].type->getBasicType() == EbtSampler)
$$->getQualifier().precision = $$->getAsAggregate()->getSequence()[0]->getAsTyped()->getQualifier().precision;
}
} else {
// error message was put out by PaFindFunction()