| 1478 | } |
| 1479 | |
| 1480 | void ValidationContext::validateKTXglFormat(const uint8_t* data, uint32_t size) { |
| 1481 | foundKTXglFormat = true; |
| 1482 | |
| 1483 | if (header.vkFormat != VK_FORMAT_UNDEFINED) |
| 1484 | error(Metadata::KTXglFormatWithVkFormat, toString(VkFormat(header.vkFormat))); |
| 1485 | |
| 1486 | if (size != 12) { |
| 1487 | error(Metadata::KTXglFormatInvalidSize, size); |
| 1488 | return; |
| 1489 | } |
| 1490 | |
| 1491 | struct Value { |
| 1492 | uint32_t glInternalformat = 0; |
| 1493 | uint32_t glFormat = 0; |
| 1494 | uint32_t glType = 0; |
| 1495 | }; |
| 1496 | |
| 1497 | Value value{}; |
| 1498 | std::memcpy(&value, data, size); |
| 1499 | |
| 1500 | if (value.glFormat != 0 || value.glType != 0) { |
| 1501 | if (isSupercompressionBlockCompressed(ktxSupercmpScheme(header.supercompressionScheme))) |
| 1502 | error(Metadata::KTXglFormatInvalidValueForCompressed, value.glFormat, value.glType, toString(ktxSupercmpScheme(header.supercompressionScheme))); |
| 1503 | |
| 1504 | else if (parsedColorModel && isColorModelBlockCompressed(*parsedColorModel)) |
| 1505 | error(Metadata::KTXglFormatInvalidValueForCompressed, value.glFormat, value.glType, toString(*parsedColorModel)); |
| 1506 | } |
| 1507 | } |
| 1508 | |
| 1509 | void ValidationContext::validateKTXdxgiFormat(const uint8_t* data, uint32_t size) { |
| 1510 | (void) data; |
nothing calls this directly
no test coverage detected