DeviceAttribute增加PipelineCache
This commit is contained in:
parent
d09e939971
commit
63cde270b9
@ -131,6 +131,9 @@ DeviceAttribute::DeviceAttribute(VkInstance inst,const PhysicalDevice *pd,VkSurf
|
||||
|
||||
DeviceAttribute::~DeviceAttribute()
|
||||
{
|
||||
if(pipeline_cache)
|
||||
vkDestroyPipelineCache(device,pipeline_cache,nullptr);
|
||||
|
||||
if(desc_pool)
|
||||
vkDestroyDescriptorPool(device,desc_pool,nullptr);
|
||||
|
||||
|
@ -50,6 +50,8 @@ struct DeviceAttribute
|
||||
}depth;
|
||||
|
||||
VkDescriptorPool desc_pool =nullptr;
|
||||
|
||||
VkPipelineCache pipeline_cache =nullptr;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -296,6 +296,23 @@ namespace
|
||||
|
||||
return desc_pool;
|
||||
}
|
||||
|
||||
VkPipelineCache CreatePipelineCache(VkDevice device)
|
||||
{
|
||||
VkPipelineCacheCreateInfo pipelineCache;
|
||||
pipelineCache.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
|
||||
pipelineCache.pNext = nullptr;
|
||||
pipelineCache.initialDataSize = 0;
|
||||
pipelineCache.pInitialData = nullptr;
|
||||
pipelineCache.flags = 0;
|
||||
|
||||
VkPipelineCache cache;
|
||||
|
||||
if(!vkCreatePipelineCache(device, &pipelineCache, nullptr, &cache)!=VK_SUCCESS)
|
||||
return(nullptr);
|
||||
|
||||
return cache;
|
||||
}
|
||||
}//namespace
|
||||
|
||||
Device *CreateRenderDevice(VkInstance inst,const PhysicalDevice *physical_device,Window *win)
|
||||
@ -342,6 +359,11 @@ Device *CreateRenderDevice(VkInstance inst,const PhysicalDevice *physical_device
|
||||
if(!attr->desc_pool)
|
||||
return(nullptr);
|
||||
|
||||
attr->pipeline_cache=CreatePipelineCache(attr->device);
|
||||
|
||||
if(!attr->pipeline_cache)
|
||||
return(nullptr);
|
||||
|
||||
auto_delete.Clear();
|
||||
|
||||
return(new Device(attr));
|
||||
|
Loading…
x
Reference in New Issue
Block a user