Nebula
Loading...
Searching...
No Matches
Base::ShaderServerBase Class Reference

#include <shaderserverbase.h>

Detailed Description

The ShaderServer loads all shaders when created, meaning all shaders in the project must be valid and hardware compatible when starting.

A shader only contains an applicable program, but to apply uniform values such as textures and transforms a ShaderState is required.

ShaderStates can be created directly from the shader, however it is recommended to through the shader server. Creating a shader state means that the shader state contains its own setup of values, which when committed will be actually applied within the shader program.

The shader server can also create shared states, which just returns a unique state containing the variable groups, and will modify the same shader state if any variable is applied to it.

Inherits Core::RefCounted.

Inherited by Vulkan::VkShaderServer.

Public Member Functions

 ShaderServerBase ()
 constructor
 
virtual ~ShaderServerBase ()
 destructor
 
bool Open ()
 open the shader server
 
void Close ()
 close the shader server
 
bool IsOpen () const
 return true if the shader server is open
 
bool HasShader (const Resources::ResourceName &resId) const
 return true if a shader exists
 
const Util::Dictionary< Resources::ResourceName, Resources::ResourceId > & GetAllShaders () const
 get all loaded shaders
 
const CoreGraphics::ShaderId GetShader (Resources::ResourceName resId) const
 get shader by name
 
void ResetFeatureBits ()
 reset the current feature bits
 
void SetFeatureBits (CoreGraphics::ShaderFeature::Mask m)
 set shader feature by bit mask
 
void ClearFeatureBits (CoreGraphics::ShaderFeature::Mask m)
 clear shader feature by bit mask
 
CoreGraphics::ShaderFeature::Mask GetFeatureBits () const
 get the current feature mask
 
CoreGraphics::ShaderFeature::Mask FeatureStringToMask (const Util::String &str)
 convert a shader feature string into a feature bit mask
 
Util::String FeatureMaskToString (CoreGraphics::ShaderFeature::Mask mask)
 convert shader feature bit mask into string
 
void LoadShader (const Resources::ResourceName &shdName)
 explicitly loads a shader by resource id
 
void BeforeFrame ()
 update shader server outside of frame
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Protected Attributes

CoreGraphics::ShaderIdentifier shaderIdentifierRegistry
 
CoreGraphics::ShaderFeature shaderFeature
 
CoreGraphics::ShaderFeature::Mask curShaderFeatureBits
 
Util::Dictionary< Resources::ResourceName, Resources::ResourceId > shaders
 
Threading::SafeQueue< Resources::ResourceNamependingShaderReloads
 
Ids::Id32 objectIdShaderVar
 
bool isOpen
 

Private Member Functions

 __DeclareClass (ShaderServerBase)
 
 __DeclareSingleton (ShaderServerBase)
 

Friends

class CoreGraphics::ShaderIdentifier
 
class ShaderBase
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 

Constructor & Destructor Documentation

◆ ShaderServerBase()

Base::ShaderServerBase::ShaderServerBase ( )

constructor

◆ ~ShaderServerBase()

Base::ShaderServerBase::~ShaderServerBase ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Base::ShaderServerBase::__DeclareClass ( ShaderServerBase )
private

◆ __DeclareSingleton()

Base::ShaderServerBase::__DeclareSingleton ( ShaderServerBase )
private

◆ BeforeFrame()

void Base::ShaderServerBase::BeforeFrame ( )

update shader server outside of frame

◆ ClearFeatureBits()

void Base::ShaderServerBase::ClearFeatureBits ( CoreGraphics::ShaderFeature::Mask m)
inline

clear shader feature by bit mask

◆ Close()

void Base::ShaderServerBase::Close ( )

close the shader server

◆ FeatureMaskToString()

Util::String Base::ShaderServerBase::FeatureMaskToString ( CoreGraphics::ShaderFeature::Mask mask)
inline

convert shader feature bit mask into string

◆ FeatureStringToMask()

CoreGraphics::ShaderFeature::Mask Base::ShaderServerBase::FeatureStringToMask ( const Util::String & str)
inline

convert a shader feature string into a feature bit mask

◆ GetAllShaders()

const Util::Dictionary< Resources::ResourceName, Resources::ResourceId > & Base::ShaderServerBase::GetAllShaders ( ) const
inline

get all loaded shaders

◆ GetFeatureBits()

CoreGraphics::ShaderFeature::Mask Base::ShaderServerBase::GetFeatureBits ( ) const
inline

get the current feature mask

◆ GetShader()

const CoreGraphics::ShaderId Base::ShaderServerBase::GetShader ( Resources::ResourceName resId) const
inline

get shader by name

◆ HasShader()

bool Base::ShaderServerBase::HasShader ( const Resources::ResourceName & resId) const
inline

return true if a shader exists

◆ IsOpen()

bool Base::ShaderServerBase::IsOpen ( ) const
inline

return true if the shader server is open

◆ LoadShader()

void Base::ShaderServerBase::LoadShader ( const Resources::ResourceName & shdName)

explicitly loads a shader by resource id

◆ Open()

bool Base::ShaderServerBase::Open ( )

open the shader server

◆ ResetFeatureBits()

void Base::ShaderServerBase::ResetFeatureBits ( )
inline

reset the current feature bits

◆ SetFeatureBits()

void Base::ShaderServerBase::SetFeatureBits ( CoreGraphics::ShaderFeature::Mask m)
inline

set shader feature by bit mask

Friends And Related Symbol Documentation

◆ CoreGraphics::ShaderIdentifier

friend class CoreGraphics::ShaderIdentifier
friend

◆ ShaderBase

friend class ShaderBase
friend

Member Data Documentation

◆ curShaderFeatureBits

CoreGraphics::ShaderFeature::Mask Base::ShaderServerBase::curShaderFeatureBits
protected

◆ isOpen

bool Base::ShaderServerBase::isOpen
protected

◆ objectIdShaderVar

Ids::Id32 Base::ShaderServerBase::objectIdShaderVar
protected

◆ pendingShaderReloads

Threading::SafeQueue<Resources::ResourceName> Base::ShaderServerBase::pendingShaderReloads
protected

◆ shaderFeature

CoreGraphics::ShaderFeature Base::ShaderServerBase::shaderFeature
protected

◆ shaderIdentifierRegistry

CoreGraphics::ShaderIdentifier Base::ShaderServerBase::shaderIdentifierRegistry
protected

◆ shaders

Util::Dictionary<Resources::ResourceName, Resources::ResourceId> Base::ShaderServerBase::shaders
protected

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