The Nebula Device 3: Direct3D9::D3D9ShaderInstance Class Reference

The Nebula Device 3

Direct3D9::D3D9ShaderInstance Class Reference

#include <d3d9shaderinstance.h>

Inheritance diagram for Direct3D9::D3D9ShaderInstance:

Base::ShaderInstanceBase Core::RefCounted CoreGraphics::ShaderInstance

Detailed Description

D3D9 implementation of CoreGraphics::ShaderInstance.

Todo:
lost/reset device handling
(C) 2007 Radon Labs GmbH

Public Member Functions

 D3D9ShaderInstance ()
 constructor
virtual ~D3D9ShaderInstance ()
 destructor
ID3DXEffect * GetD3D9Effect () const
 get pointer to d3d9 effect object
bool SelectActiveVariation (CoreGraphics::ShaderFeature::Mask featureMask)
 select active variation by feature mask
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
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
const Ptr< CoreGraphics::ShaderVariation > & GetActiveVariation () const
 get currently active 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
void OnLostDevice ()
 called by d3d9 shader server when d3d9 device is lost
void OnResetDevice ()
 called by d3d9 shader server when d3d9 device is reset

Member Function Documentation

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

setup the shader instance from its original shader object

This method is called by Shader::CreateInstance() to setup the new shader instance.

Reimplemented from Base::ShaderInstanceBase.

void Base::ShaderInstanceBase::Discard (  )  [inherited]

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.

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.