| 1429 | } |
| 1430 | |
| 1431 | bool InitBaseTypeDescriptions() |
| 1432 | { |
| 1433 | { |
| 1434 | const uint32_t kNumTypes = 3; |
| 1435 | const char* typeNames[kNumTypes] = {"float", "half", "double"}; |
| 1436 | const HLSLBaseType baseTypes[kNumTypes] = {HLSLBaseType_Float, HLSLBaseType_Half, HLSLBaseType_Double}; |
| 1437 | const NumericType numericTypes[kNumTypes] = {NumericType_Float, NumericType_Half, NumericType_Double}; |
| 1438 | const int binaryOpRanks[kNumTypes] = {0, 1, 2}; |
| 1439 | |
| 1440 | for (uint32_t i = 0; i < kNumTypes; ++i) { |
| 1441 | const char* typeName = typeNames[i]; |
| 1442 | HLSLBaseType baseType = baseTypes[i]; |
| 1443 | NumericType numericType = numericTypes[i]; |
| 1444 | int binaryOpRank = binaryOpRanks[i]; |
| 1445 | |
| 1446 | RegisterScalar(baseType, 0, numericType, binaryOpRank, typeName); |
| 1447 | RegisterVector(baseType, 1, numericType, binaryOpRank, typeName, 2); |
| 1448 | RegisterVector(baseType, 2, numericType, binaryOpRank, typeName, 3); |
| 1449 | RegisterVector(baseType, 3, numericType, binaryOpRank, typeName, 4); |
| 1450 | |
| 1451 | RegisterMatrix(baseType, 4, numericType, binaryOpRank, typeName, 2, 2); |
| 1452 | RegisterMatrix(baseType, 5, numericType, binaryOpRank, typeName, 3, 3); |
| 1453 | RegisterMatrix(baseType, 6, numericType, binaryOpRank, typeName, 4, 4); |
| 1454 | } |
| 1455 | } |
| 1456 | |
| 1457 | { |
| 1458 | const uint32_t kNumTypes = 7; |
| 1459 | const char* typeNames[kNumTypes] = { |
| 1460 | "int", "uint", |
| 1461 | "long", "ulong", |
| 1462 | "short", "ushort", |
| 1463 | "bool"}; |
| 1464 | const HLSLBaseType baseTypes[kNumTypes] = { |
| 1465 | HLSLBaseType_Int, HLSLBaseType_Uint, |
| 1466 | HLSLBaseType_Long, HLSLBaseType_Ulong, |
| 1467 | HLSLBaseType_Short, HLSLBaseType_Ushort, |
| 1468 | HLSLBaseType_Bool}; |
| 1469 | const NumericType numericTypes[kNumTypes] = { |
| 1470 | NumericType_Int, NumericType_Uint, |
| 1471 | NumericType_Long, NumericType_Ulong, |
| 1472 | NumericType_Short, NumericType_Ushort, |
| 1473 | NumericType_Bool}; |
| 1474 | const int binaryOpRanks[kNumTypes] = { |
| 1475 | 2, 1, // Note: int seems like it should be highest |
| 1476 | 3, 2, |
| 1477 | 4, 3, |
| 1478 | 4}; |
| 1479 | |
| 1480 | for (uint32_t i = 0; i < kNumTypes; ++i) { |
| 1481 | const char* typeName = typeNames[i]; |
| 1482 | HLSLBaseType baseType = baseTypes[i]; |
| 1483 | NumericType numericType = numericTypes[i]; |
| 1484 | int binaryOpRank = binaryOpRanks[i]; |
| 1485 | |
| 1486 | RegisterScalar(baseType, 0, numericType, binaryOpRank, typeName); |
| 1487 | RegisterVector(baseType, 1, numericType, binaryOpRank, typeName, 2); |
| 1488 | RegisterVector(baseType, 2, numericType, binaryOpRank, typeName, 3); |
no test coverage detected