7#include "io/ConfigManager.h"
8#include "shader/general/format/VertexFormat.h"
17 enum class ShaderType :
int {
28 enum class ShaderCacheInvalidationReason {
29 ENTRY_FUNCTION_NAME_CHANGED,
31 DEFINED_SHADER_MACROS_CHANGED,
32 SHADER_SOURCE_FILE_CHANGED,
33 SHADER_INCLUDE_TREE_CONTENT_CHANGED,
34 COMPILED_BINARY_CHANGED,
42 inline static const std::unordered_map<ShaderCacheInvalidationReason, const char*>
44 {ShaderCacheInvalidationReason::ENTRY_FUNCTION_NAME_CHANGED,
45 "shader entry function name changed"},
46 {ShaderCacheInvalidationReason::SHADER_TYPE_CHANGED,
"shader type changed"},
47 {ShaderCacheInvalidationReason::DEFINED_SHADER_MACROS_CHANGED,
48 "defined shader macros changed"},
49 {ShaderCacheInvalidationReason::SHADER_SOURCE_FILE_CHANGED,
"shader source file changed"},
50 {ShaderCacheInvalidationReason::SHADER_INCLUDE_TREE_CONTENT_CHANGED,
51 "shader include tree content changed"},
52 {ShaderCacheInvalidationReason::COMPILED_BINARY_CHANGED,
53 "previously compiled binary file(s) changed"}};
65 throw std::runtime_error(
"no description is provided for this reason");
232 static std::unordered_map<
235 unordered_map<std::string , std::string >>
248 std::string& sCurrentIncludeChain,
264 unordered_map<std::string , std::string >>
Definition: ShaderDescription.h:40
static const std::unordered_map< ShaderCacheInvalidationReason, const char * > cacheInvalidationReasons
Definition: ShaderDescription.h:43
static const char * getDescription(ShaderCacheInvalidationReason reason)
Definition: ShaderDescription.h:62
Definition: ShaderDescription.h:74
static std::unordered_map< std::string, std::unordered_map< std::string, std::string > > deserializeShaderIncludeTreeHashes(const toml::value &data)
Definition: ShaderDescription.cpp:106
ShaderDescription(ShaderDescription &&other) noexcept=default
std::string sSourceFileHash
Definition: ShaderDescription.h:254
static std::string getFileHash(const std::filesystem::path &pathToFile, const std::string &sShaderName)
Definition: ShaderDescription.cpp:60
void calculateShaderIncludeTreeHashes()
Definition: ShaderDescription.cpp:85
ShaderDescription & operator=(const ShaderDescription &other) noexcept=default
std::string sShaderEntryFunctionName
Definition: ShaderDescription.h:209
toml::value into_toml() const
Definition: ShaderDescription.cpp:41
ShaderDescription & operator=(ShaderDescription &&other) noexcept=default
std::unordered_map< std::string, std::string > definedShaderMacros
Definition: ShaderDescription.h:190
static void serializeShaderIncludeTree(const std::filesystem::path &pathToShaderFile, std::string &sCurrentIncludeChain, toml::value &data)
Definition: ShaderDescription.cpp:202
std::optional< ShaderCacheInvalidationReason > isSerializableDataEqual(ShaderDescription &other)
Definition: ShaderDescription.cpp:140
static std::string_view sInitialIncludeChainText
Definition: ShaderDescription.h:284
ShaderType shaderType
Definition: ShaderDescription.h:199
static const char * getConfigurationFileSectionName()
Definition: ShaderDescription.h:80
ShaderDescription(const ShaderDescription &other) noexcept=default
void from_toml(const toml::value &data)
Definition: ShaderDescription.cpp:28
std::unordered_map< std::string, std::unordered_map< std::string, std::string > > shaderIncludeTreeHashes
Definition: ShaderDescription.h:265
static auto sConfigurationFileSectionName
Definition: ShaderDescription.h:287
std::filesystem::path pathToShaderFile
Definition: ShaderDescription.h:196
std::optional< VertexFormat > vertexFormat
Definition: ShaderDescription.h:206
std::string sShaderName
Definition: ShaderDescription.h:193