Fix loading shader cache when opened with different engine version
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
"Major": 1,
|
"Major": 1,
|
||||||
"Minor": 7,
|
"Minor": 7,
|
||||||
"Revision": 2,
|
"Revision": 2,
|
||||||
"Build": 6408
|
"Build": 6409
|
||||||
},
|
},
|
||||||
"Company": "Flax",
|
"Company": "Flax",
|
||||||
"Copyright": "Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.",
|
"Copyright": "Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.",
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "Engine/Graphics/Shaders/GPUShader.h"
|
#include "Engine/Graphics/Shaders/GPUShader.h"
|
||||||
#include "Engine/Graphics/Materials/MaterialShader.h"
|
#include "Engine/Graphics/Materials/MaterialShader.h"
|
||||||
#include "Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.h"
|
#include "Engine/Particles/Graph/GPU/ParticleEmitterGraph.GPU.h"
|
||||||
|
#include "FlaxEngine.Gen.h"
|
||||||
|
|
||||||
const Char* ShaderProfileCacheDirNames[] =
|
const Char* ShaderProfileCacheDirNames[] =
|
||||||
{
|
{
|
||||||
@@ -179,6 +180,7 @@ bool ShaderCacheManagerService::Init()
|
|||||||
// Validate the database cache version (need to recompile all shaders on shader cache format change)
|
// Validate the database cache version (need to recompile all shaders on shader cache format change)
|
||||||
struct CacheVersion
|
struct CacheVersion
|
||||||
{
|
{
|
||||||
|
int32 EngineVersion = -1;
|
||||||
int32 ShaderCacheVersion = -1;
|
int32 ShaderCacheVersion = -1;
|
||||||
int32 MaterialGraphVersion = -1;
|
int32 MaterialGraphVersion = -1;
|
||||||
int32 ParticleGraphVersion = -1;
|
int32 ParticleGraphVersion = -1;
|
||||||
@@ -193,7 +195,8 @@ bool ShaderCacheManagerService::Init()
|
|||||||
LOG(Warning, "Failed to read the shaders cache database version file.");
|
LOG(Warning, "Failed to read the shaders cache database version file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cacheVersion.ShaderCacheVersion != GPU_SHADER_CACHE_VERSION
|
if (cacheVersion.EngineVersion != FLAXENGINE_VERSION_BUILD
|
||||||
|
|| cacheVersion.ShaderCacheVersion != GPU_SHADER_CACHE_VERSION
|
||||||
|| cacheVersion.MaterialGraphVersion != MATERIAL_GRAPH_VERSION
|
|| cacheVersion.MaterialGraphVersion != MATERIAL_GRAPH_VERSION
|
||||||
|| cacheVersion.ParticleGraphVersion != PARTICLE_GPU_GRAPH_VERSION
|
|| cacheVersion.ParticleGraphVersion != PARTICLE_GPU_GRAPH_VERSION
|
||||||
)
|
)
|
||||||
@@ -209,6 +212,7 @@ bool ShaderCacheManagerService::Init()
|
|||||||
LOG(Error, "Failed to createe the shaders cache database directory.");
|
LOG(Error, "Failed to createe the shaders cache database directory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cacheVersion.EngineVersion = FLAXENGINE_VERSION_BUILD;
|
||||||
cacheVersion.ShaderCacheVersion = GPU_SHADER_CACHE_VERSION;
|
cacheVersion.ShaderCacheVersion = GPU_SHADER_CACHE_VERSION;
|
||||||
cacheVersion.MaterialGraphVersion = MATERIAL_GRAPH_VERSION;
|
cacheVersion.MaterialGraphVersion = MATERIAL_GRAPH_VERSION;
|
||||||
cacheVersion.ParticleGraphVersion = PARTICLE_GPU_GRAPH_VERSION;
|
cacheVersion.ParticleGraphVersion = PARTICLE_GPU_GRAPH_VERSION;
|
||||||
|
|||||||
Reference in New Issue
Block a user