Bug fix: Make the type of the result of a structure assignment be the type of the structure assigned. That is, the type of the result of the "=" itself, if used in a broader expression. This probably fixes some other subtle problems as well.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20001 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
f20bb0eb94
commit
5f96bbf9fd
@ -281,7 +281,7 @@ public:
|
|||||||
TIntermTyped(const TType& t) : type(t) { }
|
TIntermTyped(const TType& t) : type(t) { }
|
||||||
virtual TIntermTyped* getAsTyped() { return this; }
|
virtual TIntermTyped* getAsTyped() { return this; }
|
||||||
virtual void setType(const TType& t) { type = t; }
|
virtual void setType(const TType& t) { type = t; }
|
||||||
virtual TType getType() const { return type; }
|
virtual const TType& getType() const { return type; }
|
||||||
virtual TType* getTypePointer() { return &type; }
|
virtual TType* getTypePointer() { return &type; }
|
||||||
|
|
||||||
virtual TBasicType getBasicType() const { return type.getBasicType(); }
|
virtual TBasicType getBasicType() const { return type.getBasicType(); }
|
||||||
|
@ -815,7 +815,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
if (right->getNominalSize() > size)
|
if (right->getNominalSize() > size)
|
||||||
size = right->getNominalSize();
|
size = right->getNominalSize();
|
||||||
|
|
||||||
TBasicType type = left->getBasicType();
|
TBasicType basicType = left->getBasicType();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Arrays have to be exact matches.
|
// Arrays have to be exact matches.
|
||||||
@ -827,7 +827,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
// Base assumption: just make the type the same as the left
|
// Base assumption: just make the type the same as the left
|
||||||
// operand. Then only deviations from this need be coded.
|
// operand. Then only deviations from this need be coded.
|
||||||
//
|
//
|
||||||
setType(TType(type, EvqTemporary, left->getNominalSize(), left->isMatrix()));
|
setType(left->getType());
|
||||||
|
type.changeQualifier(EvqTemporary);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Array operations.
|
// Array operations.
|
||||||
@ -844,12 +845,8 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
setType(TType(EbtBool));
|
setType(TType(EbtBool));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//
|
|
||||||
// Set array information.
|
|
||||||
//
|
|
||||||
case EOpAssign:
|
case EOpAssign:
|
||||||
getType().setArraySize(left->getType().getArraySize());
|
// array information was correctly set above
|
||||||
getType().setArrayInformationType(left->getType().getArrayInformationType());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -939,12 +936,12 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
op = EOpVectorTimesMatrix;
|
op = EOpVectorTimesMatrix;
|
||||||
else {
|
else {
|
||||||
op = EOpMatrixTimesScalar;
|
op = EOpMatrixTimesScalar;
|
||||||
setType(TType(type, EvqTemporary, size, true));
|
setType(TType(basicType, EvqTemporary, size, true));
|
||||||
}
|
}
|
||||||
} else if (left->isMatrix() && !right->isMatrix()) {
|
} else if (left->isMatrix() && !right->isMatrix()) {
|
||||||
if (right->isVector()) {
|
if (right->isVector()) {
|
||||||
op = EOpMatrixTimesVector;
|
op = EOpMatrixTimesVector;
|
||||||
setType(TType(type, EvqTemporary, size, false));
|
setType(TType(basicType, EvqTemporary, size, false));
|
||||||
} else {
|
} else {
|
||||||
op = EOpMatrixTimesScalar;
|
op = EOpMatrixTimesScalar;
|
||||||
}
|
}
|
||||||
@ -955,7 +952,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
// leave as component product
|
// leave as component product
|
||||||
} else if (left->isVector() || right->isVector()) {
|
} else if (left->isVector() || right->isVector()) {
|
||||||
op = EOpVectorTimesScalar;
|
op = EOpVectorTimesScalar;
|
||||||
setType(TType(type, EvqTemporary, size, false));
|
setType(TType(basicType, EvqTemporary, size, false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
|
infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
|
||||||
@ -984,7 +981,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
if (! left->isVector())
|
if (! left->isVector())
|
||||||
return false;
|
return false;
|
||||||
op = EOpVectorTimesScalarAssign;
|
op = EOpVectorTimesScalarAssign;
|
||||||
setType(TType(type, EvqTemporary, size, false));
|
setType(TType(basicType, EvqTemporary, size, false));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
|
infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
|
||||||
@ -1007,7 +1004,7 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
|
|||||||
left->isVector() && right->isMatrix() ||
|
left->isVector() && right->isMatrix() ||
|
||||||
left->getBasicType() != right->getBasicType())
|
left->getBasicType() != right->getBasicType())
|
||||||
return false;
|
return false;
|
||||||
setType(TType(type, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
|
setType(TType(basicType, EvqTemporary, size, left->isMatrix() || right->isMatrix()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EOpEqual:
|
case EOpEqual:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user