"L. Spiro Engine"
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

lsg::CDirectX11Shader Class Reference

A DirectX 11 shader. More...

#include <LSGDirectX11Shader.h>

Inheritance diagram for lsg::CDirectX11Shader:
lsg::CShaderBase lsg::CShader

List of all members.

Classes

struct  LSG_DX11_SHADER_HANDLE

Public Member Functions

LSVOID LSE_CALL Reset ()
virtual LSUINT64 LSE_CALL GetId () const
virtual LSBOOL LSE_CALL Activate (LSVOID *_pvSysValue)
virtual LSVOID LSE_CALL Deactivate ()
virtual LSVOID LSE_CALL PreRender ()
virtual LSG_HANDLE LSE_CALL GetConstantByName (const LSCHAR *_pcName)
virtual LSBOOL LSE_CALL SetFloat (CShaderBase::LSG_HANDLE _hHandle, LSFLOAT _fValue)
virtual LSBOOL LSE_CALL SetFloatArray (LSG_HANDLE _hHandle, const LSFLOAT *_pfValues, LSUINT32 _ui32Total)
virtual LSBOOL LSE_CALL SetInt (LSG_HANDLE _hHandle, LSINT32 _iValue)
virtual LSBOOL LSE_CALL SetIntArray (LSG_HANDLE _hHandle, const LSINT32 *_piValues, LSUINT32 _ui32Total)
virtual LSBOOL LSE_CALL SetBool (LSG_HANDLE _hHandle, LSBOOL _bValue)
virtual LSBOOL LSE_CALL SetBoolArray (LSG_HANDLE _hHandle, const LSBOOL *_pbValues, LSUINT32 _ui32Total)
virtual LSBOOL LSE_CALL SetVector2 (LSG_HANDLE _hHandle, const CVector2 &_vValue)
virtual LSBOOL LSE_CALL SetVector2Array (LSG_HANDLE _hHandle, const CVector2 *_pvValues, LSUINT32 _ui32Total)
virtual LSBOOL LSE_CALL SetVector3 (LSG_HANDLE _hHandle, const CVector3 &_vValue)
virtual LSBOOL LSE_CALL SetVector3Array (LSG_HANDLE _hHandle, const CVector3 *_pvValues, LSUINT32 _ui32Total)
virtual LSBOOL LSE_CALL SetVector4 (LSG_HANDLE _hHandle, const CVector4 &_vValue)
virtual LSBOOL LSE_CALL SetVector4Array (LSG_HANDLE _hHandle, const CVector4 *_pvValues, LSUINT32 _ui32Total)
virtual LSBOOL LSE_CALL SetMatrix2x2 (LSG_HANDLE _hHandle, const CMatrix2x2 &_gmValue)
virtual LSBOOL LSE_CALL SetMatrix3x3 (LSG_HANDLE _hHandle, const CMatrix3x3 &_gmValue)
virtual LSBOOL LSE_CALL SetMatrix4x4 (LSG_HANDLE _hHandle, const CMatrix4x4 &_gmValue)
virtual LSBOOL LSE_CALL SetMatrix4x4Array (LSG_HANDLE _hHandle, const CMatrix4x4 *_pmValues, LSUINT32 _ui32Total)

Protected Types

typedef struct
lsg::CDirectX11Shader::LSG_DX11_SHADER_HANDLE
LPLSG_DX11_SHADER_HANDLE
typedef struct
lsg::CDirectX11Shader::LSG_DX11_SHADER_HANDLE 
LPCLSG_DX11_SHADER_HANDLE

Protected Member Functions

virtual LSVOID LSE_CALL CreateTranslator ()
virtual LSVOID LSE_CALL DestroyTranslator ()
virtual LSG_SHADER_ERRORS LSE_CALL PostCompile (CString &_sError)

Protected Attributes

CDirectX11VertexShaderm_pdx11vsVertexShader
CDirectX11PixelShaderm_pdx11psPixelShader
CDirectX11ShaderManagerm_pdx11smShaderManager
CVectorPoD
< LSG_DX11_SHADER_HANDLE
m_vHandles

Detailed Description

A DirectX 11 shader.

Class CDirectX11Shader Description: A DirectX 11 shader. Shaders in DirectX 11 are normally considered to be specifically a vertex shader or a pixel shader (etc.), but here a single vertex, pixel, and geometry shader are treated as one, matching shader behavior in OpenGL. Vertex, pixel, and geometry shaders are called shader parts here, with the shader being the result of combining them. Shader parts are optionally shared. The DirectX shader part manager prevents duplicate shader parts and handles sharing. Sharing can be disabled for debugging purposes.


Member Typedef Documentation

Data for a shader handle.


Member Function Documentation

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::Activate ( LSVOID *  _pvSysValue) [virtual]

Activation callback. A system value is passed that is to be used internally and changes meaning depending on the graphics API.

Parameters:
_pvSysValueA value with special system meaning.
Returns:
Returns false if there is a failure to apply the shader via the current graphics API.

Implements lsg::CShaderBase.

Reimplemented in lsg::CShader.

virtual LSVOID LSE_CALL lsg::CDirectX11Shader::CreateTranslator ( ) [protected, virtual]

Create a new translator of type CDirectX9ShaderTranslator.

Implements lsg::CShaderBase.

virtual LSVOID LSE_CALL lsg::CDirectX11Shader::Deactivate ( ) [virtual]

Deactivation callback. Calls by the system when the shader is deactivated.

Implements lsg::CShaderBase.

virtual LSVOID LSE_CALL lsg::CDirectX11Shader::DestroyTranslator ( ) [protected, virtual]

Destroys the CDirectX9ShaderTranslator translator.

Implements lsg::CShaderBase.

virtual LSG_HANDLE LSE_CALL lsg::CDirectX11Shader::GetConstantByName ( const LSCHAR *  _pcName) [virtual]

Get a handle for a uniform variable in the shader.

Parameters:
_pcNameName of the variable whose handle is to be obtained.
Returns:
Returns the handle to the given variable or ~0UL if the given name does not exist.

Implements lsg::CShaderBase.

virtual LSUINT64 LSE_CALL lsg::CDirectX11Shader::GetId ( ) const [virtual]

Get the uniqe ID of this shader. The ID is 0 if the shader is not actually ready to be activated (that is, has not been compiled and registered with the graphics API). Activating a shader with a 0 ID is the same as deactivating shaders.

Returns:
Returns the unique ID for this shader.

Reimplemented from lsg::CShaderBase.

virtual LSG_SHADER_ERRORS LSE_CALL lsg::CDirectX11Shader::PostCompile ( CString &  _sError) [protected, virtual]

Post compile. We use this to create Direct3D 11 compiled shader parts.

Parameters:
_sErrorThe returned error string if there is an error.
Returns:
Returns an error code or LSG_SE_SUCCESS.

Reimplemented from lsg::CShaderBase.

Reimplemented in lsg::CShader.

virtual LSVOID LSE_CALL lsg::CDirectX11Shader::PreRender ( ) [virtual]

Called once prior to each render.

Reimplemented from lsg::CShaderBase.

LSVOID LSE_CALL lsg::CDirectX11Shader::Reset ( )

Reset everything.

Reimplemented from lsg::CShaderBase.

Reimplemented in lsg::CShader.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetBool ( LSG_HANDLE  _hHandle,
LSBOOL  _bValue 
) [virtual]

Set a single scalar value in the shader of type bool. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_bValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetBoolArray ( LSG_HANDLE  _hHandle,
const LSBOOL *  _pbValues,
LSUINT32  _ui32Total 
) [virtual]

Set an array of scalar values in the shader of type bool. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_pbValuesNew values.
_ui32TotalTotal ints to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetFloat ( CShaderBase::LSG_HANDLE  _hHandle,
LSFLOAT  _fValue 
) [virtual]

Set a single scalar value in the shader of type float. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_fValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetFloatArray ( LSG_HANDLE  _hHandle,
const LSFLOAT *  _pfValues,
LSUINT32  _ui32Total 
) [virtual]

Set an array of scalar values in the shader of type float. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_pfValuesNew values.
_ui32TotalTotal floats to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetInt ( LSG_HANDLE  _hHandle,
LSINT32  _iValue 
) [virtual]

Set a single scalar value in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_iValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetIntArray ( LSG_HANDLE  _hHandle,
const LSINT32 *  _piValues,
LSUINT32  _ui32Total 
) [virtual]

Set an array of scalar values in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_piValuesNew values.
_ui32TotalTotal ints to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetMatrix2x2 ( LSG_HANDLE  _hHandle,
const CMatrix2x2 &  _gmValue 
) [virtual]

Set a 2-by-2 matrix in a shader. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_gmValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetMatrix3x3 ( LSG_HANDLE  _hHandle,
const CMatrix3x3 &  _gmValue 
) [virtual]

Set a 3-by-3 matrix in a shader. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_gmValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetMatrix4x4 ( LSG_HANDLE  _hHandle,
const CMatrix4x4 &  _gmValue 
) [virtual]

Set a 4-by-4 matrix in a shader. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_gmValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetMatrix4x4Array ( LSG_HANDLE  _hHandle,
const CMatrix4x4 *  _pmValues,
LSUINT32  _ui32Total 
) [virtual]

Set an array of 4-by-4 matrices in a shader. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_pmValuesNew values.
_ui32TotalTotal ints to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetVector2 ( LSG_HANDLE  _hHandle,
const CVector2 &  _vValue 
) [virtual]

Set a 2-dimensional vector in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_vValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetVector2Array ( LSG_HANDLE  _hHandle,
const CVector2 *  _pvValues,
LSUINT32  _ui32Total 
) [virtual]

Set a 2-dimensional vector array in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_vValueNew values.
_ui32TotalTotal ints to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetVector3 ( LSG_HANDLE  _hHandle,
const CVector3 &  _vValue 
) [virtual]

Set a 3-dimensional vector in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_vValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetVector3Array ( LSG_HANDLE  _hHandle,
const CVector3 *  _pvValues,
LSUINT32  _ui32Total 
) [virtual]

Set a 3-dimensional vector array in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_vValueNew values.
_ui32TotalTotal ints to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetVector4 ( LSG_HANDLE  _hHandle,
const CVector4 &  _vValue 
) [virtual]

Set a 4-dimensional vector in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_vValueNew value.
Returns:
Returns true if the value was set in the shader.

Implements lsg::CShaderBase.

virtual LSBOOL LSE_CALL lsg::CDirectX11Shader::SetVector4Array ( LSG_HANDLE  _hHandle,
const CVector4 *  _pvValues,
LSUINT32  _ui32Total 
) [virtual]

Set a 4-dimensional vector array in the shader of type int. Shader must be active.

Parameters:
_hHandleHandle to the value to set in the shader.
_vValueNew values.
_ui32TotalTotal ints to set.
Returns:
Returns true if the values were set in the shader.

Implements lsg::CShaderBase.


Member Data Documentation

The pixel shader, if any. There must be a vertex shader if there is a pixel shader.

The shader manager.

The vertex shader if any. There must be a pixel shader if there is a vertex shader.

Array of handles. The handles we give out are indices into this array.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator