Nameless Engine
|
#include <ShaderCacheManager.h>
Classes | |
struct | GlobalShaderCacheParameterNames |
Public Member Functions | |
ShaderCacheManager (const ShaderCacheManager &)=delete | |
ShaderCacheManager & | operator= (const ShaderCacheManager &)=delete |
std::optional< Error > | refreshShaderCache () |
Protected Member Functions | |
ShaderCacheManager (Renderer *pRenderer) | |
virtual std::optional< std::string > | isLanguageSpecificGlobalCacheOutdated (const ConfigManager &cacheConfig)=0 |
virtual std::optional< Error > | writeLanguageSpecificParameters (ConfigManager &cacheConfig)=0 |
Private Member Functions | |
std::optional< Error > | createNewShaderCache () |
std::optional< std::string > | isGlobalShaderCacheOutdated (const ConfigManager &cacheConfig) |
Static Private Member Functions | |
static std::unique_ptr< ShaderCacheManager > | create (Renderer *pRenderer) |
Private Attributes | |
Renderer *const | pRenderer = nullptr |
Static Private Attributes | |
static constexpr std::string_view | sGlobalShaderCacheInfoFileName = ".shader_cache.toml" |
Friends | |
class | ShaderManager |
Responsible for validating shader cache, reading and updating the cache.
|
protected |
Only used internally, use create to create objects of this type.
pRenderer | Used renderer. |
|
staticprivate |
Creates a new render-specific cache manager.
pRenderer | Used renderer. |
|
private |
Deletes the current shader cache directory (if exists) and creates a new one with a new config that stores renderer's parameters.
|
private |
Makes sure that the cache was generated using the same parameters as the current renderer's state and that the cache can be safely used.
cacheConfig | Config that stores global cache parameters. |
|
protectedpure virtual |
Makes sure that the cache was generated using the same parameters as the current renderer's state and that the cache can be safely used. This function checks shader language specific parameters that might have changed.
cacheConfig | Config that stores global cache parameters. |
Implemented in ne::GlslShaderCacheManager, and ne::HlslShaderCacheManager.
std::optional< Error > ne::ShaderCacheManager::refreshShaderCache | ( | ) |
Checks if any of the global shader cache parameters changed (such as build mode, shader model, etc.). If changed deletes the whole shader cache directory (including caches of previously compiled shaders) and creates a fresh new shader cache directory with up to date global parameters file.
|
protectedpure virtual |
Writes shader language specific parameters that affect shader cache into the specified config.
cacheConfig | Config that stores global cache parameters. |
Implemented in ne::GlslShaderCacheManager, and ne::HlslShaderCacheManager.
|
private |
Used renderer.
|
staticconstexprprivate |
Name of the file used to store global shader cache information. Global shader cache information is used to determine if the shader cache is valid or not (needs to be recompiled or not).
Starts with a dot on purpose (because no shader can start with a dot - reserved for internal use).