Pyrogenesis trunk
|
Shader manager: loads and caches shader programs. More...
#include <ShaderManager.h>
Classes | |
struct | CacheKey |
struct | EffectCacheKey |
Key for effect cache lookups. More... | |
struct | EffectCacheKeyHash |
Public Types | |
using | PipelineStateDescCallback = CShaderTechnique::PipelineStateDescCallback |
Load a shader effect with the pipeline state description overwriting. More... | |
Public Member Functions | |
CShaderManager (Renderer::Backend::IDevice *device) | |
~CShaderManager () | |
CShaderTechniquePtr | LoadEffect (CStrIntern name, const CShaderDefines &defines) |
Load a shader effect. More... | |
CShaderTechniquePtr | LoadEffect (CStrIntern name) |
Load a shader effect, with empty defines. More... | |
CShaderTechniquePtr | LoadEffect (CStrIntern name, const CShaderDefines &defines, const PipelineStateDescCallback &callback) |
size_t | GetNumEffectsLoaded () const |
Returns the number of shader effects that are currently loaded. More... | |
Private Types | |
using | EffectCacheMap = std::unordered_map< EffectCacheKey, CShaderTechniquePtr, EffectCacheKeyHash > |
template<typename T > | |
using | HotloadFilesMap = std::unordered_map< VfsPath, std::set< std::weak_ptr< T >, std::owner_less< std::weak_ptr< T > > > > |
Private Member Functions | |
CShaderProgramPtr | LoadProgram (const CStr &name, const CShaderDefines &defines) |
Load a shader program. More... | |
bool | LoadTechnique (CShaderTechniquePtr &tech) |
Status | ReloadChangedFile (const VfsPath &path) |
void | AddTechniqueFileDependency (const CShaderTechniquePtr &technique, const VfsPath &path) |
Associates the file with the technique to be reloaded if the file has changed. More... | |
void | AddProgramFileDependency (const CShaderProgramPtr &program, const VfsPath &path) |
Associates the file with the program to be reloaded if the file has changed. More... | |
Static Private Member Functions | |
static Status | ReloadChangedFileCB (void *param, const VfsPath &path) |
Private Attributes | |
Renderer::Backend::IDevice * | m_Device = nullptr |
std::map< CacheKey, CShaderProgramPtr > | m_ProgramCache |
EffectCacheMap | m_EffectCache |
HotloadFilesMap< CShaderTechnique > | m_HotloadTechniques |
HotloadFilesMap< CShaderProgram > | m_HotloadPrograms |
Shader manager: loads and caches shader programs.
For a high-level overview of shaders and materials, see http://trac.wildfiregames.com/wiki/MaterialSystem
|
private |
|
private |
Load a shader effect with the pipeline state description overwriting.
TODO: we should set all needed states in XML.
CShaderManager::CShaderManager | ( | Renderer::Backend::IDevice * | device | ) |
CShaderManager::~CShaderManager | ( | ) |
|
private |
Associates the file with the program to be reloaded if the file has changed.
|
private |
Associates the file with the technique to be reloaded if the file has changed.
size_t CShaderManager::GetNumEffectsLoaded | ( | ) | const |
Returns the number of shader effects that are currently loaded.
CShaderTechniquePtr CShaderManager::LoadEffect | ( | CStrIntern | name | ) |
Load a shader effect, with empty defines.
CShaderTechniquePtr CShaderManager::LoadEffect | ( | CStrIntern | name, |
const CShaderDefines & | defines | ||
) |
Load a shader effect.
Effects can be implemented via many techniques; this returns the best usable technique.
name | name of effect XML specification (file is loaded from shaders/effects/${name}.xml) |
defines | key/value set of preprocessor definitions |
CShaderTechniquePtr CShaderManager::LoadEffect | ( | CStrIntern | name, |
const CShaderDefines & | defines, | ||
const PipelineStateDescCallback & | callback | ||
) |
|
private |
Load a shader program.
name | name of shader XML specification (file is loaded from shaders/${name}.xml) |
defines | key/value set of preprocessor definitions |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |