From 45fc32614a82454f04c5cef7173e31d45e1da8a2 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 21 Sep 2015 10:12:57 +0200 Subject: [PATCH] Remove pipeline cache as it is optional and causes duplicate wrappers * The same ICD in the SDK just returns '1' as the handle for all caches. * This could be valid behaviour (not for caches but for other objects) so need to check where this could happen and handle it. We already do for queues, physical devices, and a couple of others. --- renderdoc/driver/vulkan/vk_debug.cpp | 25 +++++-------------------- renderdoc/driver/vulkan/vk_debug.h | 3 +-- renderdoc/driver/vulkan/vk_resources.h | 5 +++++ 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_debug.cpp b/renderdoc/driver/vulkan/vk_debug.cpp index bcf0d0fb2..f612ab174 100644 --- a/renderdoc/driver/vulkan/vk_debug.cpp +++ b/renderdoc/driver/vulkan/vk_debug.cpp @@ -169,7 +169,6 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev, VkIm { // VKTODOLOW needs tidy up - isn't scalable. Needs more classes like UBO above. - m_PipelineCache = VK_NULL_HANDLE; m_DescriptorPool = VK_NULL_HANDLE; m_DynamicCBStateWhite = VK_NULL_HANDLE; m_DynamicRSState = VK_NULL_HANDLE; @@ -235,13 +234,6 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev, VkIm VKMGR()->WrapResource(Unwrap(dev), m_PointSampler); - VkPipelineCacheCreateInfo cacheInfo = { VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO, NULL, 0, NULL, 0 }; - - vkr = vt->CreatePipelineCache(Unwrap(dev), &cacheInfo, &m_PipelineCache); - RDCASSERT(vkr == VK_SUCCESS); - - VKMGR()->WrapResource(Unwrap(dev), m_PipelineCache); - { // VKTODOLOW not sure if these stage flags VK_SHADER_STAGE_... work yet? VkDescriptorSetLayoutBinding layoutBinding[] = { @@ -505,7 +497,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev, VkIm stages[0].shader = Unwrap(shader[BLITVS]); stages[1].shader = Unwrap(shader[CHECKERBOARDFS]); - vkr = vt->CreateGraphicsPipelines(Unwrap(dev), Unwrap(m_PipelineCache), 1, &pipeInfo, &m_CheckerboardPipeline); + vkr = vt->CreateGraphicsPipelines(Unwrap(dev), VK_NULL_HANDLE, 1, &pipeInfo, &m_CheckerboardPipeline); RDCASSERT(vkr == VK_SUCCESS); VKMGR()->WrapResource(Unwrap(dev), m_CheckerboardPipeline); @@ -515,7 +507,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev, VkIm pipeInfo.layout = Unwrap(m_TexDisplayPipeLayout); - vkr = vt->CreateGraphicsPipelines(Unwrap(dev), Unwrap(m_PipelineCache), 1, &pipeInfo, &m_TexDisplayPipeline); + vkr = vt->CreateGraphicsPipelines(Unwrap(dev), VK_NULL_HANDLE, 1, &pipeInfo, &m_TexDisplayPipeline); RDCASSERT(vkr == VK_SUCCESS); VKMGR()->WrapResource(Unwrap(dev), m_TexDisplayPipeline); @@ -524,7 +516,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev, VkIm attState.srcBlendColor = VK_BLEND_SRC_ALPHA; attState.destBlendColor = VK_BLEND_ONE_MINUS_SRC_ALPHA; - vkr = vt->CreateGraphicsPipelines(Unwrap(dev), Unwrap(m_PipelineCache), 1, &pipeInfo, &m_TexDisplayBlendPipeline); + vkr = vt->CreateGraphicsPipelines(Unwrap(dev), VK_NULL_HANDLE, 1, &pipeInfo, &m_TexDisplayBlendPipeline); RDCASSERT(vkr == VK_SUCCESS); VKMGR()->WrapResource(Unwrap(dev), m_TexDisplayBlendPipeline); @@ -536,7 +528,7 @@ VulkanDebugManager::VulkanDebugManager(WrappedVulkan *driver, VkDevice dev, VkIm pipeInfo.layout = Unwrap(m_TextPipeLayout); - vkr = vt->CreateGraphicsPipelines(Unwrap(dev), Unwrap(m_PipelineCache), 1, &pipeInfo, &m_TextPipeline); + vkr = vt->CreateGraphicsPipelines(Unwrap(dev), VK_NULL_HANDLE, 1, &pipeInfo, &m_TextPipeline); RDCASSERT(vkr == VK_SUCCESS); VKMGR()->WrapResource(Unwrap(dev), m_TextPipeline); @@ -771,13 +763,6 @@ VulkanDebugManager::~VulkanDebugManager() VkResult vkr = VK_SUCCESS; - if(m_PipelineCache != VK_NULL_HANDLE) - { - vkr = vt->DestroyPipelineCache(Unwrap(dev), Unwrap(m_PipelineCache)); - RDCASSERT(vkr == VK_SUCCESS); - VKMGR()->ReleaseWrappedResource(m_PipelineCache); - } - if(m_DescriptorPool != VK_NULL_HANDLE) { vkr = vt->DestroyDescriptorPool(Unwrap(dev), Unwrap(m_DescriptorPool)); @@ -1008,4 +993,4 @@ void VulkanDebugManager::RenderTextInternal(const TextPrintState &textstate, flo vt->QueueSubmit(Unwrap(textstate.q), 1, UnwrapPtr(textstate.cmd), VK_NULL_HANDLE); vt->QueueWaitIdle(Unwrap(textstate.q)); -} \ No newline at end of file +} diff --git a/renderdoc/driver/vulkan/vk_debug.h b/renderdoc/driver/vulkan/vk_debug.h index 00e66b91e..0cdaa1cf7 100644 --- a/renderdoc/driver/vulkan/vk_debug.h +++ b/renderdoc/driver/vulkan/vk_debug.h @@ -63,7 +63,6 @@ class VulkanDebugManager }; // VKTODOLOW make this all private/wrapped up - VkPipelineCache m_PipelineCache; VkDescriptorPool m_DescriptorPool; VkDynamicColorBlendState m_DynamicCBStateWhite; VkDynamicRasterState m_DynamicRSState; @@ -110,4 +109,4 @@ class VulkanDebugManager WrappedVulkan *m_pDriver; VkDevice m_Device; -}; \ No newline at end of file +}; diff --git a/renderdoc/driver/vulkan/vk_resources.h b/renderdoc/driver/vulkan/vk_resources.h index 05f5b169f..3d930d0cb 100644 --- a/renderdoc/driver/vulkan/vk_resources.h +++ b/renderdoc/driver/vulkan/vk_resources.h @@ -415,6 +415,11 @@ struct WrappedVkSwapChainWSI : WrappedVkNonDispRes enum { TypeEnum = eResWSISwapChain, }; }; +// VKTODOMED Need to find out which resources can validly return duplicate +// handles for unique creates. E.g. if there are the same input parameters +// to multiple create calls - perhaps it is valid for any handle to be +// returned twice. + // template magic voodoo to unwrap types template struct UnwrapHelper {};