add version of findDepthFormat without return code

This commit is contained in:
Greg Wells
2025-05-11 10:46:09 -04:00
parent 57f272728c
commit 5250054432

View File

@@ -17,17 +17,24 @@ gnReturnCode findDepthFormat(const gnOutputDevice& outputDevice, VkFormat& forma
); );
} }
VkFormat findDepthFormat(const gnOutputDevice& outputDevice) {
VkFormat format;
findSupportedFormat(outputDevice,
{VK_FORMAT_D32_SFLOAT, VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D24_UNORM_S8_UINT},
VK_IMAGE_TILING_OPTIMAL,
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT, format
);
return format;
}
VkFormat vulkanFormatFromGryphnFormat(const gnOutputDevice& outputDevice, gnColorMode colorMode) { VkFormat vulkanFormatFromGryphnFormat(const gnOutputDevice& outputDevice, gnColorMode colorMode) {
switch (colorMode) { switch (colorMode) {
case GN_RED: return VK_FORMAT_R8_UNORM; case GN_RED: return VK_FORMAT_R8_UNORM;
case GN_RGB8: return VK_FORMAT_R8G8B8A8_SRGB; case GN_RGB8: return VK_FORMAT_R8G8B8A8_SRGB;
case GN_RGBA8: return VK_FORMAT_R8G8B8A8_SRGB; case GN_RGBA8: return VK_FORMAT_R8G8B8A8_SRGB;
case GN_BGRA8: return VK_FORMAT_B8G8R8A8_SRGB; case GN_BGRA8: return VK_FORMAT_B8G8R8A8_SRGB;
case GN_DEPTH_STENCIL: { case GN_DEPTH_STENCIL: return findDepthFormat(outputDevice);
VkFormat depthFormat;
findDepthFormat(outputDevice, depthFormat);
return depthFormat;
}
} }
return VK_FORMAT_R8_UNORM; return VK_FORMAT_R8_UNORM;
} }