| 16 | namespace M4 { |
| 17 | |
| 18 | const char* HLSLGenerator::GetTypeName(const HLSLType& type) |
| 19 | { |
| 20 | bool promote = ((type.flags & HLSLTypeFlag_NoPromote) == 0); |
| 21 | |
| 22 | // number |
| 23 | bool isHalfNumerics = promote && !m_options.treatHalfAsFloat; |
| 24 | HLSLBaseType baseType = type.baseType; |
| 25 | |
| 26 | // Note: these conversions should really be done during parsing |
| 27 | // so that casting gets applied. |
| 28 | if (!isHalfNumerics) |
| 29 | baseType = HalfToFloatBaseType(baseType); |
| 30 | |
| 31 | // MSL doesn't support double, and many HLSL cards don't either. |
| 32 | //if (IsDouble(baseType)) |
| 33 | // baseType = DoubleToFloatBaseType(baseType); |
| 34 | |
| 35 | HLSLType remappedType(type); |
| 36 | remappedType.baseType = baseType; |
| 37 | |
| 38 | // DONE: these can all just use a table entry, have another slot for MSL |
| 39 | // Functions can return void, especially with compute |
| 40 | if (IsTextureType(baseType) || IsSamplerType(baseType) || IsNumericType(baseType) || baseType == HLSLBaseType_Void || baseType == HLSLBaseType_UserDefined) |
| 41 | return GetTypeNameHLSL(remappedType); |
| 42 | |
| 43 | Error("Unknown type"); |
| 44 | return NULL; |
| 45 | } |
| 46 | |
| 47 | // TODO: copied from MSLGenerator |
| 48 | // @@ We could be a lot smarter removing parenthesis based on the operator precedence of the parent expression. |
nothing calls this directly
no test coverage detected