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.
This commit is contained in:
baldurk
2015-09-21 10:12:57 +02:00
parent 38b2158c7b
commit 45fc32614a
3 changed files with 11 additions and 22 deletions
+5 -20
View File
@@ -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));
}
}
+1 -2
View File
@@ -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;
};
};
+5
View File
@@ -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<typename inner> struct UnwrapHelper {};