// Copyright (c) 2012-2022 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Core/Types/BaseTypes.h" #include "Engine/Core/Enums.h" #include "Engine/Graphics/Config.h" #include "Engine/Graphics/Materials/MaterialInfo.h" #include "../Config.h" class MemoryReadStream; // Shader file data mapping to asset chunks (allows to support shader precompiled for multiple rendering backends) #define SHADER_FILE_CHUNK_MATERIAL_PARAMS 0 #define SHADER_FILE_CHUNK_INTERNAL_D3D_SM5_CACHE 1 #define SHADER_FILE_CHUNK_INTERNAL_D3D_SM4_CACHE 2 #define SHADER_FILE_CHUNK_INTERNAL_GLSL_410_CACHE 3 #define SHADER_FILE_CHUNK_INTERNAL_GLSL_440_CACHE 4 #define SHADER_FILE_CHUNK_INTERNAL_VULKAN_SM5_CACHE 5 #define SHADER_FILE_CHUNK_INTERNAL_GENERIC_CACHE 6 #define SHADER_FILE_CHUNK_INTERNAL_D3D_SM6_CACHE 7 #define SHADER_FILE_CHUNK_VISJECT_SURFACE 14 #define SHADER_FILE_CHUNK_SOURCE 15 /// /// Contains shader data that is used during creating shaders/materials /// class ShaderStorage { public: /// /// Different shader cache storage modes (disabled, inside asset and in project cache) /// DECLARE_ENUM_3(CachingMode, Disabled, AssetInternal, ProjectCache); /// /// Current shaders caching mode to use /// static CachingMode CurrentCachingMode; /// /// Gets caching mode to use for shaders /// /// Caching mode static CachingMode GetCachingMode(); public: /// /// Packed version of the Magic Code for shader files /// static const int32 MagicCode; public: /// /// File header, version 18 /// [Deprecated on 24.07.2019, expires on 10.05.2021] /// struct Header18 { static const int32 Version = 18; /// /// The material version (used by the material assets). /// int32 MaterialVersion; /// /// The material information (used by the material assets). /// MaterialInfo8 MaterialInfo; }; /// /// File header, version 19 /// [Deprecated on 13.07.2022, expires on 13.07.2024] /// struct Header19 { static const int32 Version = 19; union { struct { } Shader; struct { /// /// The material graph version. /// int32 GraphVersion; /// /// The material additional information. /// MaterialInfo9 Info; } Material; struct { /// /// The particle emitter graph version. /// int32 GraphVersion; /// /// The custom particles data size (in bytes). /// int32 CustomDataSize; } ParticleEmitter; }; Header19() { } }; /// /// File header, version 20 /// struct Header20 { static const int32 Version = 20; union { struct { } Shader; struct { /// /// The material graph version. /// int32 GraphVersion; /// /// The material additional information. /// MaterialInfo10 Info; } Material; struct { /// /// The particle emitter graph version. /// int32 GraphVersion; /// /// The custom particles data size (in bytes). /// int32 CustomDataSize; } ParticleEmitter; }; Header20() { } }; /// /// Current header type /// typedef Header20 Header; };