Add option to disable pipeline cache on specific Vulkan platforms
This commit is contained in:
@@ -33,6 +33,10 @@
|
|||||||
#define VULKAN_USE_DEBUG_LAYER GPU_ENABLE_DIAGNOSTICS
|
#define VULKAN_USE_DEBUG_LAYER GPU_ENABLE_DIAGNOSTICS
|
||||||
#define VULKAN_USE_DEBUG_DATA (GPU_ENABLE_DIAGNOSTICS && COMPILE_WITH_DEV_ENV)
|
#define VULKAN_USE_DEBUG_DATA (GPU_ENABLE_DIAGNOSTICS && COMPILE_WITH_DEV_ENV)
|
||||||
|
|
||||||
|
#ifndef VULKAN_USE_PIPELINE_CACHE
|
||||||
|
#define VULKAN_USE_PIPELINE_CACHE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef VULKAN_USE_VALIDATION_CACHE
|
#ifndef VULKAN_USE_VALIDATION_CACHE
|
||||||
#ifdef VK_EXT_validation_cache
|
#ifdef VK_EXT_validation_cache
|
||||||
#define VULKAN_USE_VALIDATION_CACHE VK_EXT_validation_cache
|
#define VULKAN_USE_VALIDATION_CACHE VK_EXT_validation_cache
|
||||||
|
|||||||
@@ -1498,6 +1498,8 @@ PixelFormat GPUDeviceVulkan::GetClosestSupportedPixelFormat(PixelFormat format,
|
|||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_USE_PIPELINE_CACHE
|
||||||
|
|
||||||
void GetPipelineCachePath(String& path)
|
void GetPipelineCachePath(String& path)
|
||||||
{
|
{
|
||||||
#if USE_EDITOR
|
#if USE_EDITOR
|
||||||
@@ -1507,8 +1509,11 @@ void GetPipelineCachePath(String& path)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
bool GPUDeviceVulkan::SavePipelineCache()
|
bool GPUDeviceVulkan::SavePipelineCache()
|
||||||
{
|
{
|
||||||
|
#if VULKAN_USE_PIPELINE_CACHE
|
||||||
if (PipelineCache == VK_NULL_HANDLE || !vkGetPipelineCacheData)
|
if (PipelineCache == VK_NULL_HANDLE || !vkGetPipelineCacheData)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1529,6 +1534,9 @@ bool GPUDeviceVulkan::SavePipelineCache()
|
|||||||
String path;
|
String path;
|
||||||
GetPipelineCachePath(path);
|
GetPipelineCachePath(path);
|
||||||
return File::WriteAllBytes(path, data);
|
return File::WriteAllBytes(path, data);
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VULKAN_USE_VALIDATION_CACHE
|
#if VULKAN_USE_VALIDATION_CACHE
|
||||||
@@ -1975,6 +1983,7 @@ bool GPUDeviceVulkan::Init()
|
|||||||
UniformBufferUploader = New<UniformBufferUploaderVulkan>(this);
|
UniformBufferUploader = New<UniformBufferUploaderVulkan>(this);
|
||||||
DescriptorPoolsManager = New<DescriptorPoolsManagerVulkan>(this);
|
DescriptorPoolsManager = New<DescriptorPoolsManagerVulkan>(this);
|
||||||
MainContext = New<GPUContextVulkan>(this, GraphicsQueue);
|
MainContext = New<GPUContextVulkan>(this, GraphicsQueue);
|
||||||
|
#if VULKAN_USE_PIPELINE_CACHE
|
||||||
if (vkCreatePipelineCache)
|
if (vkCreatePipelineCache)
|
||||||
{
|
{
|
||||||
Array<uint8> data;
|
Array<uint8> data;
|
||||||
@@ -1992,6 +2001,7 @@ bool GPUDeviceVulkan::Init()
|
|||||||
const VkResult result = vkCreatePipelineCache(Device, &pipelineCacheCreateInfo, nullptr, &PipelineCache);
|
const VkResult result = vkCreatePipelineCache(Device, &pipelineCacheCreateInfo, nullptr, &PipelineCache);
|
||||||
LOG_VULKAN_RESULT(result);
|
LOG_VULKAN_RESULT(result);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if VULKAN_USE_VALIDATION_CACHE
|
#if VULKAN_USE_VALIDATION_CACHE
|
||||||
if (OptionalDeviceExtensions.HasEXTValidationCache && vkCreateValidationCacheEXT && vkDestroyValidationCacheEXT)
|
if (OptionalDeviceExtensions.HasEXTValidationCache && vkCreateValidationCacheEXT && vkDestroyValidationCacheEXT)
|
||||||
{
|
{
|
||||||
@@ -2088,6 +2098,7 @@ void GPUDeviceVulkan::Dispose()
|
|||||||
DeferredDeletionQueue.ReleaseResources(true);
|
DeferredDeletionQueue.ReleaseResources(true);
|
||||||
vmaDestroyAllocator(Allocator);
|
vmaDestroyAllocator(Allocator);
|
||||||
Allocator = VK_NULL_HANDLE;
|
Allocator = VK_NULL_HANDLE;
|
||||||
|
#if VULKAN_USE_PIPELINE_CACHE
|
||||||
if (PipelineCache != VK_NULL_HANDLE)
|
if (PipelineCache != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
if (SavePipelineCache())
|
if (SavePipelineCache())
|
||||||
@@ -2095,6 +2106,7 @@ void GPUDeviceVulkan::Dispose()
|
|||||||
vkDestroyPipelineCache(Device, PipelineCache, nullptr);
|
vkDestroyPipelineCache(Device, PipelineCache, nullptr);
|
||||||
PipelineCache = VK_NULL_HANDLE;
|
PipelineCache = VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if VULKAN_USE_VALIDATION_CACHE
|
#if VULKAN_USE_VALIDATION_CACHE
|
||||||
if (ValidationCache != VK_NULL_HANDLE)
|
if (ValidationCache != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user