Add content deprecation system that auto-saves assets in Editor that use old data format

This commit is contained in:
Wojtek Figat
2025-01-20 23:46:49 +01:00
parent 1497acef58
commit 8a7ceef288
67 changed files with 751 additions and 427 deletions

View File

@@ -8,6 +8,7 @@
#include "Engine/Graphics/Shaders/GPUShader.h"
#if COMPILE_WITH_SHADER_COMPILER
#include "Engine/Engine/CommandLine.h"
#include "Engine/Content/Deprecated.h"
#include "Engine/Serialization/MemoryReadStream.h"
#endif
#include "Engine/ShadowsOfMordor/AtlasChartsPacker.h"
@@ -98,8 +99,11 @@ bool ShaderAssetBase::initBase(AssetInitData& initData)
#if USE_EDITOR
bool ShaderAssetBase::Save()
bool ShaderAssetBase::SaveShaderAsset() const
{
// Asset is being saved so no longer need to resave deprecated data in it
ContentDeprecated::Clear();
auto parent = GetShaderAsset();
AssetInitData data;
data.SerializedVersion = ShaderStorage::Header::Version;
@@ -296,7 +300,7 @@ bool ShaderAssetBase::LoadShaderCache(ShaderCacheResult& result)
#if USE_EDITOR
// Save chunks to the asset file
if (Save())
if (SaveShaderAsset())
{
LOG(Warning, "Cannot save '{0}'.", parent->ToString());
return true;

View File

@@ -30,15 +30,13 @@ public:
static int32 GetCacheChunkIndex(ShaderProfile profile);
#if USE_EDITOR
/// <summary>
/// Prepare shader compilation options
/// Prepare shader compilation options.
/// </summary>
/// <param name="options">Options</param>
/// <param name="options">The output options.</param>
virtual void InitCompilationOptions(struct ShaderCompilationOptions& options)
{
}
#endif
protected:
@@ -50,13 +48,11 @@ protected:
virtual BinaryAsset* GetShaderAsset() const = 0;
#if USE_EDITOR
/// <summary>
/// Saves this shader asset to the storage container.
/// </summary>
/// <returns>True if failed, otherwise false.</returns>
bool Save();
bool SaveShaderAsset() const;
#endif
/// <summary>
@@ -70,12 +66,10 @@ protected:
DataContainer<byte> Data;
#if COMPILE_WITH_SHADER_COMPILER
/// <summary>
/// The list of files included by the shader source (used by the given cache on the runtime graphics platform shader profile). Paths are absolute and unique.
/// </summary>
Array<String> Includes;
#endif
};
@@ -87,7 +81,6 @@ protected:
bool LoadShaderCache(ShaderCacheResult& result);
#if COMPILE_WITH_SHADER_COMPILER
/// <summary>
/// Registers shader asset for the automated reloads on source includes changes.
/// </summary>
@@ -100,7 +93,6 @@ protected:
/// </summary>
/// <param name="asset">The asset.</param>
void UnregisterForShaderReloads(Asset* asset);
#endif
};

View File

@@ -75,7 +75,7 @@ public:
};
/// <summary>
/// File header, version 19
/// [Deprecated on 13.07.2022, expires on 13.07.2024]
/// [Deprecated on 13.07.2022, expires on 13.07.2024]
/// </summary>
struct Header19
{