"L. Spiro Engine"
|
A DirectX 11 shader. More...
#include <LSGDirectX11Shader.h>
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 | |
CDirectX11VertexShader * | m_pdx11vsVertexShader |
CDirectX11PixelShader * | m_pdx11psPixelShader |
CDirectX11ShaderManager * | m_pdx11smShaderManager |
CVectorPoD < LSG_DX11_SHADER_HANDLE > | m_vHandles |
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.
typedef struct lsg::CDirectX11Shader::LSG_DX11_SHADER_HANDLE * lsg::CDirectX11Shader::LPLSG_DX11_SHADER_HANDLE [protected] |
Data for a shader handle.
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.
_pvSysValue | A value with special system meaning. |
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.
_pcName | Name of the variable whose handle is to be obtained. |
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.
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.
_sError | The returned error string if there is an error. |
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 | ( | ) |
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.
_hHandle | Handle to the value to set in the shader. |
_bValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_pbValues | New values. |
_ui32Total | Total ints to set. |
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.
_hHandle | Handle to the value to set in the shader. |
_fValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_pfValues | New values. |
_ui32Total | Total floats to set. |
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.
_hHandle | Handle to the value to set in the shader. |
_iValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_piValues | New values. |
_ui32Total | Total ints to set. |
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.
_hHandle | Handle to the value to set in the shader. |
_gmValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_gmValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_gmValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_pmValues | New values. |
_ui32Total | Total ints to set. |
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.
_hHandle | Handle to the value to set in the shader. |
_vValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_vValue | New values. |
_ui32Total | Total ints to set. |
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.
_hHandle | Handle to the value to set in the shader. |
_vValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_vValue | New values. |
_ui32Total | Total ints to set. |
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.
_hHandle | Handle to the value to set in the shader. |
_vValue | New value. |
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.
_hHandle | Handle to the value to set in the shader. |
_vValue | New values. |
_ui32Total | Total ints to set. |
Implements lsg::CShaderBase.
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.
CVectorPoD<LSG_DX11_SHADER_HANDLE> lsg::CDirectX11Shader::m_vHandles [protected] |
Array of handles. The handles we give out are indices into this array.