|
@@ -945,17 +945,17 @@ bool SpirvEmitter::loadIfAliasVarRef(const Expr *varExpr,
|
|
SpirvInstruction *SpirvEmitter::castToType(SpirvInstruction *value,
|
|
SpirvInstruction *SpirvEmitter::castToType(SpirvInstruction *value,
|
|
QualType fromType, QualType toType,
|
|
QualType fromType, QualType toType,
|
|
SourceLocation srcLoc) {
|
|
SourceLocation srcLoc) {
|
|
- if (isFloatOrVecOfFloatType(toType))
|
|
|
|
|
|
+ if (isFloatOrVecMatOfFloatType(toType))
|
|
return castToFloat(value, fromType, toType, srcLoc);
|
|
return castToFloat(value, fromType, toType, srcLoc);
|
|
|
|
|
|
// Order matters here. Bool (vector) values will also be considered as uint
|
|
// Order matters here. Bool (vector) values will also be considered as uint
|
|
// (vector) values. So given a bool (vector) argument, isUintOrVecOfUintType()
|
|
// (vector) values. So given a bool (vector) argument, isUintOrVecOfUintType()
|
|
// will also return true. We need to check bool before uint. The opposite is
|
|
// will also return true. We need to check bool before uint. The opposite is
|
|
// not true.
|
|
// not true.
|
|
- if (isBoolOrVecOfBoolType(toType))
|
|
|
|
|
|
+ if (isBoolOrVecMatOfBoolType(toType))
|
|
return castToBool(value, fromType, toType);
|
|
return castToBool(value, fromType, toType);
|
|
|
|
|
|
- if (isSintOrVecOfSintType(toType) || isUintOrVecOfUintType(toType))
|
|
|
|
|
|
+ if (isSintOrVecMatOfSintType(toType) || isUintOrVecMatOfUintType(toType))
|
|
return castToInt(value, fromType, toType, srcLoc);
|
|
return castToInt(value, fromType, toType, srcLoc);
|
|
|
|
|
|
emitError("casting to type %0 unimplemented", {}) << toType;
|
|
emitError("casting to type %0 unimplemented", {}) << toType;
|
|
@@ -6117,7 +6117,7 @@ SpirvInstruction *SpirvEmitter::turnIntoElementPtr(
|
|
SpirvInstruction *SpirvEmitter::castToBool(SpirvInstruction *fromVal,
|
|
SpirvInstruction *SpirvEmitter::castToBool(SpirvInstruction *fromVal,
|
|
QualType fromType,
|
|
QualType fromType,
|
|
QualType toBoolType) {
|
|
QualType toBoolType) {
|
|
- if (isSameScalarOrVecType(fromType, toBoolType))
|
|
|
|
|
|
+ if (isSameType(astContext, fromType, toBoolType))
|
|
return fromVal;
|
|
return fromVal;
|
|
|
|
|
|
{ // Special case handling for converting to a matrix of booleans.
|
|
{ // Special case handling for converting to a matrix of booleans.
|
|
@@ -6147,7 +6147,7 @@ SpirvInstruction *SpirvEmitter::castToBool(SpirvInstruction *fromVal,
|
|
SpirvInstruction *SpirvEmitter::castToInt(SpirvInstruction *fromVal,
|
|
SpirvInstruction *SpirvEmitter::castToInt(SpirvInstruction *fromVal,
|
|
QualType fromType, QualType toIntType,
|
|
QualType fromType, QualType toIntType,
|
|
SourceLocation srcLoc) {
|
|
SourceLocation srcLoc) {
|
|
- if (isSameScalarOrVecType(fromType, toIntType))
|
|
|
|
|
|
+ if (isSameType(astContext, fromType, toIntType))
|
|
return fromVal;
|
|
return fromVal;
|
|
|
|
|
|
if (isBoolOrVecOfBoolType(fromType)) {
|
|
if (isBoolOrVecOfBoolType(fromType)) {
|
|
@@ -6254,7 +6254,7 @@ SpirvInstruction *SpirvEmitter::castToFloat(SpirvInstruction *fromVal,
|
|
QualType fromType,
|
|
QualType fromType,
|
|
QualType toFloatType,
|
|
QualType toFloatType,
|
|
SourceLocation srcLoc) {
|
|
SourceLocation srcLoc) {
|
|
- if (isSameScalarOrVecType(fromType, toFloatType))
|
|
|
|
|
|
+ if (isSameType(astContext, fromType, toFloatType))
|
|
return fromVal;
|
|
return fromVal;
|
|
|
|
|
|
if (isBoolOrVecOfBoolType(fromType)) {
|
|
if (isBoolOrVecOfBoolType(fromType)) {
|