The Nebula Device 3: Base::ShaderInstanceBase Class Reference

The Nebula Device 3

Base::ShaderInstanceBase Class Reference

#include <shaderinstancebase.h>

Inheritance diagram for Base::ShaderInstanceBase:

Core::RefCounted Direct3D9::D3D9ShaderInstance CoreGraphics::ShaderInstance


Detailed Description

A shader instance object is created from a shader and contains a local copy of the original shader state which can be modified through ShaderVariable objects. Shader instance objects are created directly through the shader server.

(C) 2007 Radon Labs GmbH

Public Member Functions

 ShaderInstanceBase ()
 constructor
virtual ~ShaderInstanceBase ()
 destructor
void Discard ()
 discard the shader instance, must be called when instance no longer needed
bool IsValid () const
 return true if this object is valid
const Ptr
< CoreGraphics::Shader > & 
GetOriginalShader () const
 get pointer to original shader which created this instance
bool HasVariableByName (const CoreGraphics::ShaderVariable::Name &n) const
 return true if the shader instance has a variable by name
bool HasVariableBySemantic (const CoreGraphics::ShaderVariable::Semantic &n) const
 return true if shader has variable by semantic
SizeT GetNumVariables () const
 get number of variables
const Ptr
< CoreGraphics::ShaderVariable > & 
GetVariableByIndex (IndexT i) const
 get a variable by index
const Ptr
< CoreGraphics::ShaderVariable > & 
GetVariableByName (const CoreGraphics::ShaderVariable::Name &n) const
 get a variable by name
const Ptr
< CoreGraphics::ShaderVariable > & 
GetVariableBySemantic (const CoreGraphics::ShaderVariable::Semantic &s) const
 get a variable by semantic
bool HasVariation (CoreGraphics::ShaderFeature::Mask featureMask) const
 return true if variation exists by matching feature mask
SizeT GetNumVariations () const
 get number of variations in the shader
const Ptr
< CoreGraphics::ShaderVariation > & 
GetVariationByIndex (IndexT i) const
 get shader variation by index
const Ptr
< CoreGraphics::ShaderVariation > & 
GetVariationByFeatureMask (CoreGraphics::ShaderFeature::Mask featureMask) const
 get shader variation by feature mask
bool SelectActiveVariation (CoreGraphics::ShaderFeature::Mask featureMask)
 select active variation by feature mask, return true if active variation has been changed
const Ptr
< CoreGraphics::ShaderVariation > & 
GetActiveVariation () const
 get currently active variation
void AddPreShader (const Ptr< CoreGraphics::PreShader > &preShader)
 add a pre-shader
void RemovePreShader (const Ptr< CoreGraphics::PreShader > &preShader)
 remove a pre-shader
const Util::Array
< Ptr
< CoreGraphics::PreShader > > & 
GetPreShaders () const
 get array of pre-shaders
SizeT Begin ()
 begin rendering through the currently selected variation, returns no. passes
void BeginPass (IndexT passIndex)
 begin pass
void Commit ()
 commit changes before rendering
void EndPass ()
 end pass
void End ()
 end rendering through variation
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!)

Protected Member Functions

virtual void Setup (const Ptr< CoreGraphics::Shader > &origShader)
 setup the shader instance from its original shader object
virtual void Cleanup ()
 cleanup the shader instance

Member Function Documentation

void Base::ShaderInstanceBase::Discard (  ) 

discard the shader instance, must be called when instance no longer needed

This method must be called when the object is no longer needed for proper cleanup.

void Base::ShaderInstanceBase::Setup ( const Ptr< CoreGraphics::Shader > &  origShader  )  [protected, virtual]

setup the shader instance from its original shader object

Override this method in an API-specific subclass to setup the shader instance, and call the parent class for proper setup.

Reimplemented in Direct3D9::D3D9ShaderInstance.

void Base::ShaderInstanceBase::Cleanup (  )  [protected, virtual]

cleanup the shader instance

Override this method in an API-specific subclass to undo the setup in OnInstantiate(), then call parent class to finalize the cleanup.

Reimplemented in Direct3D9::D3D9ShaderInstance.

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.