| 1139 | } |
| 1140 | |
| 1141 | bool 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 | |
| 1165 | void MSLGenerator::OutputTypedExpression(const HLSLType& type, HLSLExpression* expression, HLSLExpression* parentExpression) |
| 1166 | { |
nothing calls this directly
no test coverage detected