mirror of https://github.com/PCSX2/pcsx2.git
GS: Unify shader cache versions across renderers
It's not often that we make a change unique to one API. This way, you only have to bump the version in one location, instead of four.
This commit is contained in:
parent
44c8974aba
commit
44bad588b4
|
@ -241,6 +241,7 @@ set(pcsx2Headers
|
|||
R5900.h
|
||||
R5900OpcodeTables.h
|
||||
SaveState.h
|
||||
ShaderCacheVersion.h
|
||||
Sifcmd.h
|
||||
Sif.h
|
||||
SingleRegisterTypes.h
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include "VulkanHostDisplay.h"
|
||||
#include "ShaderCacheVersion.h"
|
||||
#include "common/Align.h"
|
||||
#include "common/Assertions.h"
|
||||
#include "common/Console.h"
|
||||
|
@ -15,8 +16,6 @@
|
|||
#include "imgui_impl_vulkan.h"
|
||||
#include <array>
|
||||
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 4;
|
||||
|
||||
class VulkanHostDisplayTexture : public HostDisplayTexture
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "GS/GSUtil.h"
|
||||
#include "Host.h"
|
||||
#include "HostDisplay.h"
|
||||
#include "ShaderCacheVersion.h"
|
||||
#include "common/StringUtil.h"
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
@ -91,14 +92,14 @@ bool GSDevice11::Create()
|
|||
|
||||
if (!GSConfig.DisableShaderCache)
|
||||
{
|
||||
if (!m_shader_cache.Open(EmuFolders::Cache, m_dev->GetFeatureLevel(), SHADER_VERSION, GSConfig.UseDebugDevice))
|
||||
if (!m_shader_cache.Open(EmuFolders::Cache, m_dev->GetFeatureLevel(), SHADER_CACHE_VERSION, GSConfig.UseDebugDevice))
|
||||
{
|
||||
Console.Warning("Shader cache failed to open.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_shader_cache.Open({}, m_dev->GetFeatureLevel(), SHADER_VERSION, GSConfig.UseDebugDevice);
|
||||
m_shader_cache.Open({}, m_dev->GetFeatureLevel(), SHADER_CACHE_VERSION, GSConfig.UseDebugDevice);
|
||||
Console.WriteLn("Not using shader cache.");
|
||||
}
|
||||
|
||||
|
|
|
@ -108,9 +108,6 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
// Increment this constant whenever shaders change, to invalidate user's shader cache.
|
||||
static constexpr u32 SHADER_VERSION = 1;
|
||||
|
||||
static constexpr u32 MAX_TEXTURES = 4;
|
||||
static constexpr u32 MAX_SAMPLERS = 2;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "GS/GSUtil.h"
|
||||
#include "Host.h"
|
||||
#include "HostDisplay.h"
|
||||
#include "ShaderCacheVersion.h"
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
|
||||
|
@ -113,14 +114,14 @@ bool GSDevice12::Create()
|
|||
|
||||
if (!GSConfig.DisableShaderCache)
|
||||
{
|
||||
if (!m_shader_cache.Open(EmuFolders::Cache, g_d3d12_context->GetFeatureLevel(), SHADER_VERSION, GSConfig.UseDebugDevice))
|
||||
if (!m_shader_cache.Open(EmuFolders::Cache, g_d3d12_context->GetFeatureLevel(), SHADER_CACHE_VERSION, GSConfig.UseDebugDevice))
|
||||
{
|
||||
Console.Warning("Shader cache failed to open.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_shader_cache.Open({}, g_d3d12_context->GetFeatureLevel(), SHADER_VERSION, GSConfig.UseDebugDevice);
|
||||
m_shader_cache.Open({}, g_d3d12_context->GetFeatureLevel(), SHADER_CACHE_VERSION, GSConfig.UseDebugDevice);
|
||||
Console.WriteLn("Not using shader cache.");
|
||||
}
|
||||
|
||||
|
|
|
@ -133,8 +133,6 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
static constexpr u32 SHADER_VERSION = 1;
|
||||
|
||||
ComPtr<ID3D12RootSignature> m_tfx_root_signature;
|
||||
ComPtr<ID3D12RootSignature> m_utility_root_signature;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "GS/GSUtil.h"
|
||||
#include "Host.h"
|
||||
#include "HostDisplay.h"
|
||||
#include "ShaderCacheVersion.h"
|
||||
#include <cinttypes>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
@ -206,7 +207,7 @@ bool GSDeviceOGL::Create()
|
|||
|
||||
if (!theApp.GetConfigB("disable_shader_cache"))
|
||||
{
|
||||
if (!m_shader_cache.Open(false, EmuFolders::Cache, SHADER_VERSION))
|
||||
if (!m_shader_cache.Open(false, EmuFolders::Cache, SHADER_CACHE_VERSION))
|
||||
Console.Warning("Shader cache failed to open.");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -211,9 +211,6 @@ public:
|
|||
static int m_shader_reg;
|
||||
|
||||
private:
|
||||
// Increment this constant whenever shaders change, to invalidate user's program binary cache.
|
||||
static constexpr u32 SHADER_VERSION = 3;
|
||||
|
||||
static FILE* m_debug_gl_file;
|
||||
|
||||
bool m_disable_hw_gl_draw;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/* PCSX2 - PS2 Emulator for PCs
|
||||
* Copyright (C) 2002-2022 PCSX2 Dev Team
|
||||
*
|
||||
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU Lesser General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with PCSX2.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/// Version number for GS and other shaders. Increment whenever any of the contents of the
|
||||
/// shaders change, to invalidate the cache.
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 10;
|
|
@ -869,6 +869,7 @@
|
|||
<ClInclude Include="PAD\Windows\WndProcEater.h" />
|
||||
<ClInclude Include="PAD\Windows\XInputEnum.h" />
|
||||
<ClInclude Include="PerformanceMetrics.h" />
|
||||
<ClInclude Include="ShaderCacheVersion.h" />
|
||||
<ClInclude Include="SPU2\Config.h" />
|
||||
<ClInclude Include="SPU2\Global.h" />
|
||||
<ClInclude Include="SPU2\interpolate_table.h" />
|
||||
|
|
|
@ -2996,6 +2996,9 @@
|
|||
<ClInclude Include="Frontend\ImGuiOverlays.h">
|
||||
<Filter>Host</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShaderCacheVersion.h">
|
||||
<Filter>System\Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="windows\wxResources.rc">
|
||||
|
@ -3158,4 +3161,4 @@
|
|||
<Filter>AppHost\Resources</Filter>
|
||||
</Manifest>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -566,6 +566,7 @@
|
|||
<ClInclude Include="Recording\InputRecordingFile.h" />
|
||||
<ClInclude Include="Recording\PadData.h" />
|
||||
<ClInclude Include="Recording\Utilities\InputRecordingLogger.h" />
|
||||
<ClInclude Include="ShaderCacheVersion.h" />
|
||||
<ClInclude Include="SPU2\Config.h" />
|
||||
<ClInclude Include="SPU2\Global.h" />
|
||||
<ClInclude Include="SPU2\Host\Config.h" />
|
||||
|
|
Loading…
Reference in New Issue