Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::ShaderModule Class Reference

#include <ShaderProgram.h>

+ Inheritance diagram for Divide::ShaderModule:

Public Member Functions

 ShaderModule (GFXDevice &context, const std::string_view name, U32 generation)
 
virtual ~ShaderModule () override
 
void registerParent (ShaderProgram *parent)
 
void deregisterParent (ShaderProgram *parent)
 
 PROPERTY_R (Str< 256 >, name)
 
 PROPERTY_R (bool, valid, false)
 
 PROPERTY_R (bool, inUse, true)
 
 PROPERTY_R (U32, generation, 0u)
 
 PROPERTY_R (U64, lastUsedFrame, U64_MAX - MAX_FRAME_LIFETIME - 1u)
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 
- Public Member Functions inherited from Divide::GraphicsResource
virtual ~GraphicsResource ()
 
GFXDevicecontext () const noexcept
 
U64 nameHash () const noexcept
 
- Public Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
- Public Member Functions inherited from Divide::NonMovable
 NonMovable (NonMovable &&)=delete
 
NonMovableoperator= (NonMovable &&)=delete
 
 NonMovable (const NonMovable &)=default
 
NonMovableoperator= (const NonMovable &)=default
 

Static Public Member Functions

static ShaderModuleGetShader (const std::string_view name)
 Returns a reference to an already loaded shader, null otherwise.
 
static void Idle (bool fast)
 
static void InitStaticData ()
 
static void DestroyStaticData ()
 
- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 

Protected Types

using ShaderMap = hashMap< U64, ShaderModule_uptr >
 

Static Protected Member Functions

static ShaderModuleGetShaderLocked (const std::string_view name)
 

Protected Attributes

Mutex _parentLock
 
eastl::fixed_vector< ShaderProgram *, 4, true > _parents
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 
- Protected Attributes inherited from Divide::GraphicsResource
GFXDevice_context
 

Static Protected Attributes

static constexpr U32 MAX_FRAME_LIFETIME = Config::TARGET_FRAME_RATE * 10
 
static std::atomic_bool s_modulesRemoved
 Shader cache.
 
static ShaderMap s_shaderNameMap
 
static SharedMutex s_shaderNameLock
 

Additional Inherited Members

- Public Types inherited from Divide::GraphicsResource
enum class  Type : U8 {
  RENDER_TARGET , SHADER_BUFFER , BUFFER , SHADER ,
  SHADER_PROGRAM , TEXTURE , COUNT
}
 
- Protected Member Functions inherited from Divide::GraphicsResource
 GraphicsResource (GFXDevice &context, Type type, I64 GUID, U64 nameHash)
 
- Protected Member Functions inherited from Divide::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 
- Protected Member Functions inherited from Divide::NonMovable
 NonMovable ()=default
 
 ~NonMovable ()=default
 

Detailed Description

Definition at line 72 of file ShaderProgram.h.

Member Typedef Documentation

◆ ShaderMap

using Divide::ShaderModule::ShaderMap = hashMap<U64, ShaderModule_uptr>
protected

Definition at line 75 of file ShaderProgram.h.

Constructor & Destructor Documentation

◆ ShaderModule()

Divide::ShaderModule::ShaderModule ( GFXDevice context,
const std::string_view  name,
U32  generation 
)
explicit

Definition at line 832 of file ShaderProgram.cpp.

◆ ~ShaderModule()

Divide::ShaderModule::~ShaderModule ( )
overridevirtual

Definition at line 840 of file ShaderProgram.cpp.

Member Function Documentation

◆ deregisterParent()

void Divide::ShaderModule::deregisterParent ( ShaderProgram parent)

Definition at line 861 of file ShaderProgram.cpp.

◆ DestroyStaticData()

void Divide::ShaderModule::DestroyStaticData ( )
static

Definition at line 808 of file ShaderProgram.cpp.

◆ GetShader()

ShaderModule * Divide::ShaderModule::GetShader ( const std::string_view  name)
static

Returns a reference to an already loaded shader, null otherwise.

Definition at line 814 of file ShaderProgram.cpp.

◆ GetShaderLocked()

ShaderModule * Divide::ShaderModule::GetShaderLocked ( const std::string_view  name)
staticprotected

Definition at line 820 of file ShaderProgram.cpp.

◆ Idle()

void Divide::ShaderModule::Idle ( bool  fast)
static

Definition at line 775 of file ShaderProgram.cpp.

◆ InitStaticData()

void Divide::ShaderModule::InitStaticData ( )
static

Definition at line 803 of file ShaderProgram.cpp.

◆ PROPERTY_R() [1/5]

Divide::ShaderModule::PROPERTY_R ( bool  ,
inUse  ,
true   
)

◆ PROPERTY_R() [2/5]

Divide::ShaderModule::PROPERTY_R ( bool  ,
valid  ,
false   
)

◆ PROPERTY_R() [3/5]

Divide::ShaderModule::PROPERTY_R ( Str< 256 >  ,
name   
)

◆ PROPERTY_R() [4/5]

Divide::ShaderModule::PROPERTY_R ( U32  ,
generation  ,
0u   
)

◆ PROPERTY_R() [5/5]

Divide::ShaderModule::PROPERTY_R ( U64  ,
lastUsedFrame  ,
U64_MAX - MAX_FRAME_LIFETIME 1u 
)

◆ registerParent()

void Divide::ShaderModule::registerParent ( ShaderProgram parent)

Definition at line 844 of file ShaderProgram.cpp.

Member Data Documentation

◆ _parentLock

Mutex Divide::ShaderModule::_parentLock
protected

Definition at line 107 of file ShaderProgram.h.

◆ _parents

eastl::fixed_vector<ShaderProgram*, 4, true> Divide::ShaderModule::_parents
protected

Definition at line 108 of file ShaderProgram.h.

◆ MAX_FRAME_LIFETIME

constexpr U32 Divide::ShaderModule::MAX_FRAME_LIFETIME = Config::TARGET_FRAME_RATE * 10
staticconstexprprotected

Definition at line 78 of file ShaderProgram.h.

◆ s_modulesRemoved

std::atomic_bool Divide::ShaderModule::s_modulesRemoved
staticprotected

Shader cache.

Definition at line 112 of file ShaderProgram.h.

◆ s_shaderNameLock

SharedMutex Divide::ShaderModule::s_shaderNameLock
staticprotected

Definition at line 114 of file ShaderProgram.h.

◆ s_shaderNameMap

NO_DESTROY ShaderModule::ShaderMap Divide::ShaderModule::s_shaderNameMap
staticprotected

Definition at line 113 of file ShaderProgram.h.


The documentation for this class was generated from the following files: