GLSL/SPV: Fix #1310: don't create unnecessary integer matrices.
This commit is contained in:
parent
88a6a18119
commit
b92ce60fc7
4 changed files with 117 additions and 1 deletions
|
|
@ -5771,8 +5771,22 @@ TIntermTyped* TParseContext::addConstructor(const TSourceLoc& loc, TIntermNode*
|
|||
//
|
||||
// Returns nullptr for an error or the constructed node.
|
||||
//
|
||||
TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc, bool subset)
|
||||
TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, TIntermTyped* node, const TSourceLoc& loc,
|
||||
bool subset)
|
||||
{
|
||||
// If we are changing a matrix in both domain of basic type and to a non matrix,
|
||||
// do the shape change first (by default, below, basic type is changed before shape).
|
||||
// This avoids requesting a matrix of a new type that is going to be discarded anyway.
|
||||
// TODO: This could be generalized to more type combinations, but that would require
|
||||
// more extensive testing and full algorithm rework. For now, the need to do two changes makes
|
||||
// the recursive call work, and avoids the most aggregious case of creating integer matrices.
|
||||
if (node->getType().isMatrix() && (type.isScalar() || type.isVector()) &&
|
||||
type.isFloatingDomain() != node->getType().isFloatingDomain()) {
|
||||
TType transitionType(node->getBasicType(), glslang::EvqTemporary, type.getVectorSize(), 0, 0, node->isVector());
|
||||
TOperator transitionOp = intermediate.mapTypeToConstructorOp(transitionType);
|
||||
node = constructBuiltIn(transitionType, transitionOp, node, loc, false);
|
||||
}
|
||||
|
||||
TIntermTyped* newNode;
|
||||
TOperator basicOp;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue