diff --git a/example/Vulkan/VKDevice.h b/example/Vulkan/VKDevice.h index 76fef9bc..61cf64cc 100644 --- a/example/Vulkan/VKDevice.h +++ b/example/Vulkan/VKDevice.h @@ -40,6 +40,7 @@ public: const VkExtent2D & GetExtent ()const {return attr->swapchain_extent;} VkDescriptorPool GetDescriptorPool () {return attr->desc_pool;} + VkPipelineCache GetPipelineCache () {return attr->pipeline_cache;} public: diff --git a/example/Vulkan/VKDeviceCreater.cpp b/example/Vulkan/VKDeviceCreater.cpp index cfeee45d..0a2bcadc 100644 --- a/example/Vulkan/VKDeviceCreater.cpp +++ b/example/Vulkan/VKDeviceCreater.cpp @@ -308,7 +308,7 @@ namespace VkPipelineCache cache; - if(!vkCreatePipelineCache(device, &pipelineCache, nullptr, &cache)!=VK_SUCCESS) + if(vkCreatePipelineCache(device, &pipelineCache, nullptr, &cache)!=VK_SUCCESS) return(nullptr); return cache; diff --git a/example/Vulkan/VKPipeline.cpp b/example/Vulkan/VKPipeline.cpp index b24cc4b3..9b09b91e 100644 --- a/example/Vulkan/VKPipeline.cpp +++ b/example/Vulkan/VKPipeline.cpp @@ -14,6 +14,7 @@ PipelineCreater::PipelineCreater(Device *dev) { device=dev->GetDevice(); extent=dev->GetExtent(); + cache=dev->GetPipelineCache(); hgl_zero(pipelineInfo); pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; @@ -133,7 +134,7 @@ Pipeline *PipelineCreater::Create() { VkPipeline graphicsPipeline; - if (vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &graphicsPipeline) != VK_SUCCESS) + if (vkCreateGraphicsPipelines(device, cache, 1, &pipelineInfo, nullptr, &graphicsPipeline) != VK_SUCCESS) return(nullptr); return(new Pipeline(device,graphicsPipeline)); diff --git a/example/Vulkan/VKPipeline.h b/example/Vulkan/VKPipeline.h index 7cf564fa..164093de 100644 --- a/example/Vulkan/VKPipeline.h +++ b/example/Vulkan/VKPipeline.h @@ -27,6 +27,7 @@ class PipelineCreater { VkDevice device; VkExtent2D extent; + VkPipelineCache cache; VkGraphicsPipelineCreateInfo pipelineInfo; VkPipelineVertexInputStateCreateInfo vis_create_info;