ShaderCache: Add a data version field

We can increment this to prevent people's shader caches from growing too
large with shader changes.
This commit is contained in:
Connor McLaughlin
2021-01-11 14:50:25 +10:00
parent 97971464d1
commit fd166a4485
14 changed files with 56 additions and 29 deletions

View File

@ -6,6 +6,7 @@
#include "common/string_util.h"
#include "core/host_interface.h"
#include "core/settings.h"
#include "core/shader_cache_version.h"
#include "display_ps.hlsl.h"
#include "display_vs.hlsl.h"
#include "frontend-common/postprocessing_shadergen.h"
@ -930,7 +931,7 @@ bool D3D11HostDisplay::SetPostProcessingChain(const std::string_view& config)
m_post_processing_stages.clear();
D3D11::ShaderCache shader_cache;
shader_cache.Open(g_host_interface->GetShaderCacheBasePath(), m_device->GetFeatureLevel(),
shader_cache.Open(g_host_interface->GetShaderCacheBasePath(), m_device->GetFeatureLevel(), SHADER_CACHE_VERSION,
g_settings.gpu_use_debug_device);
FrontendCommon::PostProcessingShaderGen shadergen(HostDisplay::RenderAPI::D3D11, true);

View File

@ -9,6 +9,7 @@
#include "common/vulkan/stream_buffer.h"
#include "common/vulkan/swap_chain.h"
#include "common/vulkan/util.h"
#include "core/shader_cache_version.h"
#include "postprocessing_shadergen.h"
#include <array>
#ifdef WITH_IMGUI
@ -331,7 +332,7 @@ bool VulkanHostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_vie
bool VulkanHostDisplay::InitializeRenderDevice(std::string_view shader_cache_directory, bool debug_device,
bool threaded_presentation)
{
Vulkan::ShaderCache::Create(shader_cache_directory, debug_device);
Vulkan::ShaderCache::Create(shader_cache_directory, SHADER_CACHE_VERSION, debug_device);
if (!CreateResources())
return false;