| 68 | } |
| 69 | |
| 70 | static bool CheckFormat(GraphicContext* ctx, VkImageCreateInfo* image_info) |
| 71 | { |
| 72 | VkImageFormatProperties props {}; |
| 73 | if (vkGetPhysicalDeviceImageFormatProperties(ctx->physical_device, image_info->format, image_info->imageType, image_info->tiling, |
| 74 | image_info->usage, image_info->flags, &props) == VK_ERROR_FORMAT_NOT_SUPPORTED) |
| 75 | { |
| 76 | if (image_info->format == VK_FORMAT_R8G8B8A8_SRGB) |
| 77 | { |
| 78 | // TODO() convert SRGB -> LINEAR in shader |
| 79 | image_info->format = VK_FORMAT_R8G8B8A8_UNORM; |
| 80 | bool result = CheckFormat(ctx, image_info); |
| 81 | printf("replace VK_FORMAT_R8G8B8A8_SRGB => VK_FORMAT_R8G8B8A8_UNORM [%s]\n", (!result ? "FAIL" : "SUCCESS")); |
| 82 | return result; |
| 83 | } |
| 84 | if (image_info->format == VK_FORMAT_B8G8R8A8_SRGB) |
| 85 | { |
| 86 | // TODO() convert SRGB -> LINEAR in shader |
| 87 | image_info->format = VK_FORMAT_B8G8R8A8_UNORM; |
| 88 | bool result = CheckFormat(ctx, image_info); |
| 89 | printf("replace VK_FORMAT_B8G8R8A8_SRGB => VK_FORMAT_B8G8R8A8_UNORM [%s]\n", (!result ? "FAIL" : "SUCCESS")); |
| 90 | return result; |
| 91 | } |
| 92 | return false; |
| 93 | } |
| 94 | return true; |
| 95 | } |
| 96 | |
| 97 | static bool CheckSwizzle(GraphicContext* /*ctx*/, VkImageCreateInfo* image_info, VkComponentMapping* components) |
| 98 | { |