Merge remote-tracking branch 'upstream/master' into nvptx

This commit is contained in:
egaburov
2013-10-29 15:24:40 +01:00
19 changed files with 808 additions and 760 deletions

View File

@@ -7074,9 +7074,22 @@ TypeCastExpr::GetLValue(FunctionEmitContext *ctx) const {
const Type *
TypeCastExpr::GetType() const {
// We have to switch off this assert after supporting of operators.
//AssertPos(pos, type->HasUnboundVariability() == false);
return type;
// Here we try to resolve situation where (base_type) can be treated as
// (uniform base_type) of (varying base_type). This is a part of function
// TypeCastExpr::TypeCheck. After implementation of operators we
// have to have this functionality here.
const Type *toType = type, *fromType = expr->GetType();
if (toType == NULL || fromType == NULL)
return NULL;
if (toType->HasUnboundVariability()) {
if (fromType->IsUniformType()) {
toType = type->ResolveUnboundVariability(Variability::Uniform);
} else {
toType = type->ResolveUnboundVariability(Variability::Varying);
}
}
AssertPos(pos, toType->HasUnboundVariability() == false);
return toType;
}