From f1e81f69c53b5b1362d3c16ea53a65ec9a04e1b4 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 10 Jan 2022 12:54:25 +0000 Subject: [PATCH] Fix handling of S8 textures on vulkan. Closes #2428 --- .../VulkanPipelineStateViewer.cpp | 19 ++++++++++++++++++ renderdoc/driver/vulkan/vk_resources.cpp | 1 + .../vulkan/wrappers/vk_resource_funcs.cpp | 20 ++++++++++++++----- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index 64d77bd1a..8f45f16bb 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -2633,14 +2633,33 @@ void VulkanPipelineStateViewer::setState() QString slotname; if(colIdx >= 0) + { slotname = QFormatStr("Color %1").arg(colIdx); + } else if(resIdx >= 0) + { slotname = QFormatStr("Resolve %1").arg(resIdx); + } else if(state.currentPass.renderpass.fragmentDensityAttachment == i) + { slotname = lit("Fragment Density Map"); + } else + { slotname = lit("Depth"); + if(p.viewFormat.type == ResourceFormatType::D16S8 || + p.viewFormat.type == ResourceFormatType::D24S8 || + p.viewFormat.type == ResourceFormatType::D32S8) + { + slotname = lit("Depth/Stencil"); + } + else if(p.viewFormat.type == ResourceFormatType::S8) + { + slotname = lit("Stencil"); + } + } + if(state.fragmentShader.reflection != NULL) { for(int s = 0; s < state.fragmentShader.reflection->outputSignature.count(); s++) diff --git a/renderdoc/driver/vulkan/vk_resources.cpp b/renderdoc/driver/vulkan/vk_resources.cpp index 148b4fa5f..9844bed7c 100644 --- a/renderdoc/driver/vulkan/vk_resources.cpp +++ b/renderdoc/driver/vulkan/vk_resources.cpp @@ -1736,6 +1736,7 @@ ResourceFormat MakeResourceFormat(VkFormat fmt) case VK_FORMAT_D16_UNORM_S8_UINT: ret.type = ResourceFormatType::D16S8; break; case VK_FORMAT_D24_UNORM_S8_UINT: ret.type = ResourceFormatType::D24S8; break; case VK_FORMAT_D32_SFLOAT_S8_UINT: ret.type = ResourceFormatType::D32S8; break; + case VK_FORMAT_S8_UINT: ret.type = ResourceFormatType::S8; break; case VK_FORMAT_BC1_RGB_UNORM_BLOCK: case VK_FORMAT_BC1_RGB_SRGB_BLOCK: case VK_FORMAT_BC1_RGBA_UNORM_BLOCK: diff --git a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp index 6d1c701e3..db1f39270 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_resource_funcs.cpp @@ -2098,7 +2098,17 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device state->isMemoryBound = true; } - const char *prefix = "Image"; + rdcstr prefix = "Image"; + rdcstr depth = "Depth"; + + if(CreateInfo.format == VK_FORMAT_S8_UINT) + { + depth = "Stencil"; + } + else if(IsStencilFormat(CreateInfo.format)) + { + depth = "Depth/Stencil"; + } if(CreateInfo.imageType == VK_IMAGE_TYPE_1D) { @@ -2107,7 +2117,7 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device if(CreateInfo.usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) prefix = "1D Color Attachment"; else if(CreateInfo.usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) - prefix = "1D Depth Attachment"; + prefix = "1D " + depth + " Attachment"; } else if(CreateInfo.imageType == VK_IMAGE_TYPE_2D) { @@ -2116,7 +2126,7 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device if(CreateInfo.usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) prefix = "2D Color Attachment"; else if(CreateInfo.usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) - prefix = "2D Depth Attachment"; + prefix = "2D " + depth + " Attachment"; else if(CreateInfo.usage & VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT) prefix = "2D Fragment Density Map Attachment"; } @@ -2127,10 +2137,10 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device if(CreateInfo.usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) prefix = "3D Color Attachment"; else if(CreateInfo.usage & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) - prefix = "3D Depth Attachment"; + prefix = "3D " + depth + " Attachment"; } - AddResource(Image, ResourceType::Texture, prefix); + AddResource(Image, ResourceType::Texture, prefix.c_str()); DerivedResource(device, Image); }