From bd983ad7837fff5a8a05ee33896ed0eac8bff734 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 9 Apr 2018 16:51:42 +0100 Subject: [PATCH] Handle double precision when converting to vulkan format --- renderdoc/driver/vulkan/vk_common.cpp | 48 +++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_common.cpp b/renderdoc/driver/vulkan/vk_common.cpp index 52e49b466..1a84df995 100644 --- a/renderdoc/driver/vulkan/vk_common.cpp +++ b/renderdoc/driver/vulkan/vk_common.cpp @@ -1058,6 +1058,17 @@ VkFormat MakeVkFormat(ResourceFormat fmt) { ret = fmt.bgraOrder ? VK_FORMAT_B8G8R8A8_SRGB : VK_FORMAT_R8G8B8A8_SRGB; } + else if(fmt.compByteWidth == 8) + { + if(fmt.compType == CompType::Float || fmt.compType == CompType::Double) + ret = VK_FORMAT_R64G64B64A64_SFLOAT; + else if(fmt.compType == CompType::SInt) + ret = VK_FORMAT_R64G64B64A64_SINT; + else if(fmt.compType == CompType::UInt) + ret = VK_FORMAT_R64G64B64A64_UINT; + else + RDCERR("Unrecognised component type"); + } else if(fmt.compByteWidth == 4) { if(fmt.compType == CompType::Float) @@ -1116,6 +1127,17 @@ VkFormat MakeVkFormat(ResourceFormat fmt) { ret = VK_FORMAT_R8G8B8_SRGB; } + else if(fmt.compByteWidth == 8) + { + if(fmt.compType == CompType::Float || fmt.compType == CompType::Double) + ret = VK_FORMAT_R64G64B64_SFLOAT; + else if(fmt.compType == CompType::SInt) + ret = VK_FORMAT_R64G64B64_SINT; + else if(fmt.compType == CompType::UInt) + ret = VK_FORMAT_R64G64B64_UINT; + else + RDCERR("Unrecognised component type"); + } else if(fmt.compByteWidth == 4) { if(fmt.compType == CompType::Float) @@ -1170,7 +1192,18 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compCount == 2) { - if(fmt.compByteWidth == 4) + if(fmt.compByteWidth == 8) + { + if(fmt.compType == CompType::Float || fmt.compType == CompType::Double) + ret = VK_FORMAT_R64G64_SFLOAT; + else if(fmt.compType == CompType::SInt) + ret = VK_FORMAT_R64G64_SINT; + else if(fmt.compType == CompType::UInt) + ret = VK_FORMAT_R64G64_UINT; + else + RDCERR("Unrecognised component type"); + } + else if(fmt.compByteWidth == 4) { if(fmt.compType == CompType::Float) ret = VK_FORMAT_R32G32_SFLOAT; @@ -1224,7 +1257,18 @@ VkFormat MakeVkFormat(ResourceFormat fmt) } else if(fmt.compCount == 1) { - if(fmt.compByteWidth == 4) + if(fmt.compByteWidth == 8) + { + if(fmt.compType == CompType::Float || fmt.compType == CompType::Double) + ret = VK_FORMAT_R64_SFLOAT; + else if(fmt.compType == CompType::SInt) + ret = VK_FORMAT_R64_SINT; + else if(fmt.compType == CompType::UInt) + ret = VK_FORMAT_R64_UINT; + else + RDCERR("Unrecognised component type"); + } + else if(fmt.compByteWidth == 4) { if(fmt.compType == CompType::Float) ret = VK_FORMAT_R32_SFLOAT;