Nameless Engine
|
#include <ShaderPack.h>
Classes | |
struct | InternalResources |
Public Member Functions | |
ShaderPack (const ShaderPack &)=delete | |
ShaderPack & | operator= (const ShaderPack &)=delete |
bool | releaseShaderPackDataFromMemoryIfLoaded () |
std::shared_ptr< Shader > | getShader (const std::set< ShaderMacro > &shaderConfiguration) |
std::string | getShaderName () const |
ShaderType | getShaderType () |
std::pair< std::mutex, InternalResources > * | getInternalResources () |
Static Public Member Functions | |
static std::variant< std::shared_ptr< ShaderPack >, std::string, Error > | compileShaderPack (Renderer *pRenderer, const ShaderDescription &shaderDescription) |
static std::variant< std::shared_ptr< ShaderPack >, Error > | createFromCache (Renderer *pRenderer, const ShaderDescription &shaderDescription, std::optional< ShaderCacheInvalidationReason > &cacheInvalidationReason) |
Private Member Functions | |
ShaderPack (const std::string &sShaderName, ShaderType shaderType) | |
Static Private Member Functions | |
static void | addEngineMacrosToShaderDescription (ShaderDescription &description, const std::set< ShaderMacro > &shaderConfigurationMacros, Renderer *pRenderer) |
Private Attributes | |
std::pair< std::mutex, InternalResources > | mtxInternalResources |
std::string | sShaderName |
ShaderType | shaderType |
Friends | |
class | ShaderManager |
Represents a group of different variants of one shader (typically this means one shader compiled with different combinations of predefined macros).
|
private |
Constructor to create an empty shader pack.
sShaderName | Initial name of the shader. |
shaderType | Type of shaders this pack stores. |
|
staticprivate |
Adds additional defined macros to shader description that engine shaders expect.
description | Shader description to modify. |
shaderConfigurationMacros | Macros of the current shader configuration to add. |
pRenderer | Used renderer. |
|
static |
Compiles a shader pack.
pRenderer | Used renderer. |
shaderDescription | Description that describes the shader and how the shader should be compiled. |
|
static |
Creates a new shader pack using shader cache on the disk.
pRenderer | Used renderer. |
shaderDescription | Description that describes the shader and how the shader should be compiled. Used for cache invalidation. |
cacheInvalidationReason | Will be not empty if cache was invalidated. Used for testing. |
std::pair< std::mutex, ShaderPack::InternalResources > * ne::ShaderPack::getInternalResources | ( | ) |
Returns internal resources that this shader pack uses.
std::shared_ptr< Shader > ne::ShaderPack::getShader | ( | const std::set< ShaderMacro > & | shaderConfiguration | ) |
Returns a shader that matches the the specified shader configuration.
shaderConfiguration | Macros that must be defined for the shader. |
std::string ne::ShaderPack::getShaderName | ( | ) | const |
Returns unique name of this shader.
ShaderType ne::ShaderPack::getShaderType | ( | ) |
Returns type of this shader.
bool ne::ShaderPack::releaseShaderPackDataFromMemoryIfLoaded | ( | ) |
Releases underlying shader bytecode for each shader from memory (this object will not be deleted) if the shader bytecode was loaded into memory. Next time this shader will be needed it will be loaded from disk.
false
if at least one shader variant was released from memory, true
if all variants were not loaded into memory.
|
private |
Used data.
|
private |
Type of shaders this pack stores.
|
private |
Initial shader name (without configuration text).