MCPcopy Create free account
hub / github.com/alecazam/kram / NeedsCast

Method NeedsCast

hlslparser/src/MSLGenerator.cpp:1141–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139}
1140
1141bool MSLGenerator::NeedsCast(const HLSLType& target, const HLSLType& source)
1142{
1143 HLSLBaseType targetType = target.baseType;
1144 HLSLBaseType sourceType = source.baseType;
1145
1146 if (sourceType == HLSLBaseType_Int) {
1147 // int k = 1;
1148 }
1149
1150 /*if (IsScalarType(target))
1151 {
1152 // Scalar types do not need casting.
1153 return false;
1154 }*/
1155
1156 if (m_options.treatHalfAsFloat) {
1157 // use call to convert half back to float type
1158 if (IsHalf(targetType)) targetType = HalfToFloatBaseType(targetType);
1159 if (IsHalf(sourceType)) sourceType = HalfToFloatBaseType(sourceType);
1160 }
1161
1162 return targetType != sourceType && (IsCoreTypeEqual(targetType, sourceType) || IsScalarType(sourceType));
1163}
1164
1165void MSLGenerator::OutputTypedExpression(const HLSLType& type, HLSLExpression* expression, HLSLExpression* parentExpression)
1166{

Callers

nothing calls this directly

Calls 4

IsHalfFunction · 0.85
HalfToFloatBaseTypeFunction · 0.85
IsCoreTypeEqualFunction · 0.85
IsScalarTypeFunction · 0.85

Tested by

no test coverage detected