The Nebula Device 3: Base::ShaderServerBase Class Reference

The Nebula Device 3

Base::ShaderServerBase Class Reference

#include <shaderserverbase.h>

Inheritance diagram for Base::ShaderServerBase:

Core::RefCounted Direct3D9::D3D9ShaderServer CoreGraphics::ShaderServer

Detailed Description

In Nebula3, all shaders required by an application are loaded at once by the central ShaderServer. The shader server loads all shaders in ShaderServer::Open() from the location defined by the "shaders:" assign.

(C) 2007 Radon Labs GmbH

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::ResourceId &resId) const
 return true if a shader exists
Ptr< CoreGraphics::ShaderInstanceCreateShaderInstance (const Resources::ResourceId &resId)
 create a new shader instance
const Util::Dictionary< Resources::ResourceId,
Ptr< CoreGraphics::Shader > > & 
GetAllShaders () const
 get all loaded shaders
void SetActiveShaderInstance (const Ptr< CoreGraphics::ShaderInstance > &shaderInst)
 set currently active shader instance
const Ptr< CoreGraphics::ShaderInstance > & GetActiveShaderInstance () const
 get currently active shader instance
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 ApplyObjectId (IndexT i)
 apply an object id
bool HasSharedVariableBySemantic (const CoreGraphics::ShaderVariable::Semantic &sem) const
 return true if a shared variable exists by semantic
SizeT GetNumSharedVariables () const
 get number of shared variables
const Ptr< CoreGraphics::ShaderVariable > & GetSharedVariableByIndex (IndexT i) const
 get a shared variable by index
const Ptr< CoreGraphics::ShaderVariable > & GetSharedVariableBySemantic (const CoreGraphics::ShaderVariable::Semantic &sem) const
 get a shared variable by semantic
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

Static Public Member Functions

static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Member Function Documentation

Ptr< ShaderInstance > Base::ShaderServerBase::CreateShaderInstance ( const Resources::ResourceId resId  ) 

create a new shader instance

This creates a clone of a template shader. This is the only method to create a new shader object. When the shader instance is no longer needed, call UnregisterShaderInstance() for proper cleanup.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.