"L. Spiro Engine"
|
The base class for shaders. More...
#include <LSGShaderBase.h>
Classes | |
struct | LSG_DEFINE |
struct | LSG_INCLUDES |
struct | LSG_PREPROC_DEFINE |
Public Types | |
enum | LSG_SHADER_ERRORS { LSG_SE_SUCCESS, LSG_SE_INVALIDINPUT, LSG_SE_STREAMERROR, LSG_SE_PARSERERROR, LSG_SE_TRANSLATIONRERROR, LSG_SE_FILENOTFOUND, LSG_SE_OUTOFMEMORY, LSG_SE_SYNTAX, LSG_SE_INCLUDERECURSE, LSG_SE_INVALIDSHADERTYPE, LSG_SE_GFXAPIERROR, LSG_SE_NOENDIF, LSG_SE_PREPROC } |
typedef LSUINT32 | LSG_HANDLE |
typedef struct lsg::CShaderBase::LSG_DEFINE * | LPLSG_DEFINE |
typedef struct lsg::CShaderBase::LSG_DEFINE | LPCLSG_DEFINE |
Public Member Functions | |
LSVOID LSE_CALL | Reset () |
virtual LSUINT64 LSE_CALL | GetId () const |
LSG_SHADER_ERRORS LSE_CALL | Compile (CString &_sError) |
LSG_SHADER_ERRORS LSE_CALL | CompileFromFiles (const LSCHAR *_pcVertexFile, const LSCHAR *_pcPixelFile, CString *_psError=NULL) |
LSBOOL LSE_CALL | SetVertexShader (const LSCHAR *_pcShader, LSUINT32 _ui32Length=0) |
LSBOOL LSE_CALL | SetPixelShader (const LSCHAR *_pcShader, LSUINT32 _ui32Length=0) |
LSG_SHADER_ERRORS LSE_CALL | SetShaderFromFile (const LSCHAR *_pcPath, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType, CString &_sError) |
LSG_SHADER_ERRORS LSE_CALL | SetShaderFromMemory (const LSUINT8 *_pui8Src, LSUINT32 _ui32Length, const LSCHAR *_pcPath, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType, CString &_sError) |
LSBOOL LSE_CALL | SetMacros (const LSG_DEFINE *_pdDefines, LSUINT32 _ui32Total, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType) |
virtual LSBOOL LSE_CALL | Activate (LSVOID *_pvSysValue)=0 |
virtual LSVOID LSE_CALL | Deactivate ()=0 |
virtual LSVOID LSE_CALL | PreRender () |
virtual LSG_HANDLE LSE_CALL | GetConstantByName (const LSCHAR *_pcName)=0 |
virtual LSBOOL LSE_CALL | SetFloat (LSG_HANDLE _hHandle, LSFLOAT _fValue)=0 |
virtual LSBOOL LSE_CALL | SetFloatArray (LSG_HANDLE _hHandle, const LSFLOAT *_pfValues, LSUINT32 _ui32Total)=0 |
virtual LSBOOL LSE_CALL | SetInt (LSG_HANDLE _hHandle, LSINT32 _iValue)=0 |
virtual LSBOOL LSE_CALL | SetIntArray (LSG_HANDLE _hHandle, const LSINT32 *_piValues, LSUINT32 _ui32Total)=0 |
virtual LSBOOL LSE_CALL | SetBool (LSG_HANDLE _hHandle, LSBOOL _bValue)=0 |
virtual LSBOOL LSE_CALL | SetBoolArray (LSG_HANDLE _hHandle, const LSBOOL *_pbValues, LSUINT32 _ui32Total)=0 |
virtual LSBOOL LSE_CALL | SetVector2 (LSG_HANDLE _hHandle, const CVector2 &_vValue)=0 |
virtual LSBOOL LSE_CALL | SetVector2Array (LSG_HANDLE _hHandle, const CVector2 *_pvValues, LSUINT32 _ui32Total)=0 |
virtual LSBOOL LSE_CALL | SetVector3 (LSG_HANDLE _hHandle, const CVector3 &_vValue)=0 |
virtual LSBOOL LSE_CALL | SetVector3Array (LSG_HANDLE _hHandle, const CVector3 *_pvValues, LSUINT32 _ui32Total)=0 |
virtual LSBOOL LSE_CALL | SetVector4 (LSG_HANDLE _hHandle, const CVector4 &_vValue)=0 |
virtual LSBOOL LSE_CALL | SetVector4Array (LSG_HANDLE _hHandle, const CVector4 *_pvValues, LSUINT32 _ui32Total)=0 |
virtual LSBOOL LSE_CALL | SetMatrix2x2 (LSG_HANDLE _hHandle, const CMatrix2x2 &_mValue)=0 |
virtual LSBOOL LSE_CALL | SetMatrix3x3 (LSG_HANDLE _hHandle, const CMatrix3x3 &_mValue)=0 |
virtual LSBOOL LSE_CALL | SetMatrix4x4 (LSG_HANDLE _hHandle, const CMatrix4x4 &_mValue)=0 |
virtual LSBOOL LSE_CALL | SetMatrix4x4Array (LSG_HANDLE _hHandle, const CMatrix4x4 *_pmValues, LSUINT32 _ui32Total)=0 |
Static Public Member Functions | |
static LSBOOL LSE_CALL | AddSearchPath (const LSCHAR *_pcPath) |
static LSVOID LSE_CALL | RemoveSearchPath (const LSCHAR *_pcPath) |
static LSUINT32 LSE_CALL | TotalSearchPaths () |
static const CString &LSE_CALL | GetSearchPath (LSUINT32 _ui32Index) |
Protected Types | |
enum | LSG_CLEAR_STATE { LSG_CS_NONE, LSG_CS_CLEAR, LSG_CS_SEEKING_ENDIF } |
typedef struct lsg::CShaderBase::LSG_INCLUDES * | LPLSG_INCLUDES |
typedef struct lsg::CShaderBase::LSG_INCLUDES | LPCLSG_INCLUDES |
typedef struct lsg::CShaderBase::LSG_PREPROC_DEFINE * | LPLSG_PREPROC_DEFINE |
typedef struct lsg::CShaderBase::LSG_PREPROC_DEFINE | LPCLSG_PREPROC_DEFINE |
typedef CMap< CString, LSUINT32 > | CIncludeSet |
Protected Member Functions | |
LSVOID LSE_CALL | ResetParsers () |
LSG_SHADER_ERRORS LSE_CALL | Compile (const LSCHAR *_pcShader, LSUINT32 _ui32Length, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType, CString &_sError) |
LSG_SHADER_ERRORS LSE_CALL | CompileFromFile (const LSCHAR *_pcPath, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType, CString &_sError) |
LSG_SHADER_ERRORS LSE_CALL | CompileFromFile (const LSCHAR *_pcPath, CStringList &_slData, LSUINT32 _ui32Line, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType, CIncludeSet &_isIncludes, CPreProc::LSG_MACROS &_mMacros, CString &_sError) |
LSG_SHADER_ERRORS LSE_CALL | CompileFromMemory (const LSUINT8 *_pui8Src, LSUINT32 _ui32Length, const LSCHAR *_pcPath, CStringList &_slData, LSUINT32 _ui32Line, CShaderLanguageParser::LSG_SHADER_TYPES _stShaderType, CIncludeSet &_isIncludes, CPreProc::LSG_MACROS &_mMacros, CString &_sError) |
virtual LSG_SHADER_ERRORS LSE_CALL | PostCompile (CString &_sError) |
virtual LSVOID LSE_CALL | CreateTranslator ()=0 |
virtual LSVOID LSE_CALL | DestroyTranslator ()=0 |
Static Protected Member Functions | |
static CString LSE_CALL | GetFilePart (const CString &_sDirective) |
static CString LSE_CALL | FindHeader (const LSCHAR *_pcIncluder, const CString &_sFileToInclude) |
static LSBOOL LSE_CALL | ParseDefine (const CString &_sLine, CPreProc::LSG_MACROS &_mMacros) |
static LSVOID LSE_CALL | RemoveComments (CStringList &_slText) |
static LSVOID LSE_CALL | SkipString (const CString &_sLine, LSUINT32 &_ui32Pos) |
static LSBOOL LSE_CALL | ExpandMacros (CString &_sString, const CPreProc::LSG_MACROS &_mMacros, CString &_sError) |
static LSBOOL LSE_CALL | ExpandMacros (CString &_sString, const CPreProc::LSG_MACROS &_mMacros, const CSet< CString > &_sUsedValues, CString &_sError) |
static LSBOOL LSE_CALL | GetMacroParms (const CString &_sString, LSUINT32 _ui32Pos, LSUINT32 &_ui32NewPos, CVector< CString > &_vRet) |
static LSBOOL LSE_CALL | GetMacroReplacementString (LSUINT32 _ui32MacroIndex, CVector< CString > &_vParms, const CPreProc::LSG_MACROS &_mMacros, const CSet< CString > &_sUsedValues, CString &_sRet, CString &_sError) |
Protected Attributes | |
CShaderParserWrapper * | m_pspwParser |
CShaderLexer * | m_pslLexer |
CVector< LSG_PREPROC_DEFINE > | m_vDefs [CShaderLanguageParser::LSG_ST_TOTAL] |
CString | m_sVertexShader |
CString | m_sPixelShader |
CString | m_sFinalVertex |
CString | m_sFinalPixel |
CShaderTranslationProcessorBase::LSG_ERROR_CODES | m_ecTranslationResult |
CShaderTranslationProcessorBase * | m_pstpbTranslator |
CShaderTranslationProcessorBase::LSG_UNIFORM_SEMANTIC_LIST | m_uslSemantics [CShaderLanguageParser::LSG_ST_TOTAL] |
CShaderTranslationProcessorBase::LSG_UNIFORM_LIST | m_ulUniforms [CShaderLanguageParser::LSG_ST_TOTAL] |
CShaderTranslationProcessorBase::LSG_ATTRIBUTE_LIST | m_ulAttributes [CShaderLanguageParser::LSG_ST_TOTAL] |
Static Protected Attributes | |
static CStringList | m_slHeaderPaths |
The base class for shaders.
Class CShaderBase Description: The base class for shaders. This is overridden by classes specific to a given graphics API.
typedef CMap<CString, LSUINT32> lsg::CShaderBase::CIncludeSet [protected] |
Included files.
typedef struct lsg::CShaderBase::LSG_DEFINE * lsg::CShaderBase::LPLSG_DEFINE |
A preprocessor define.
typedef struct lsg::CShaderBase::LSG_INCLUDES * lsg::CShaderBase::LPLSG_INCLUDES [protected] |
Included files.
typedef struct lsg::CShaderBase::LSG_PREPROC_DEFINE * lsg::CShaderBase::LPLSG_PREPROC_DEFINE [protected] |
Preprocessor defines.
typedef LSUINT32 lsg::CShaderBase::LSG_HANDLE |
A uniform handle.
enum lsg::CShaderBase::LSG_CLEAR_STATE [protected] |
Clear states for internal use.
Error codes returned by the parser.
virtual LSBOOL LSE_CALL lsg::CShaderBase::Activate | ( | LSVOID * | _pvSysValue | ) | [pure 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. |
Implemented in lsg::CDirectX11Shader, and lsg::CShader.
static LSBOOL LSE_CALL lsg::CShaderBase::AddSearchPath | ( | const LSCHAR * | _pcPath | ) | [static] |
Add a folder to search for headers when #include and #import directives are reached in shader files.
_pcPath | The UTF-8 path of the folder to include in the search routine when seeking headers. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::Compile | ( | CString & | _sError | ) |
Parse the set shaders. In the case of OpenGL and DirectX, the shaders are converted to either GLSL or HLSL, respectively, and sent to the respective sub-compiler, which may throw its own errors. These errors are sent back through _sError, and may contain code not present in the original shaders. This is due to the conversion. The engine compiler does its best to maintain synchrony, but this is not always possible. The primary guarantee of the compiler is that any shader recognized as valid by this compiler will be valid and run in the same manner on all supported platforms.
_sError | The returned error string if there is an error. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::Compile | ( | const LSCHAR * | _pcShader, |
LSUINT32 | _ui32Length, | ||
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType, | ||
CString & | _sError | ||
) | [protected] |
Parse a shader. The shader must be in finalized format. That is, #include directives must have been fully expanded and all the parts for the shader included in the given string. The string must be NULL-terminated if _ui32Length is 0. New-lines can consist of either
pairs or just
. Specifically, is ignored entirely. In the case of OpenGL and DirectX, the shader is converted to either GLSL or HLSL, respectively, and sent to the respective sub-compiler, which may throw its own errors. These errors are sent back through _sError, and may contain code not present in the original shader. This is due to the conversion. The engine compiler does its best to maintain synchrony, but this is not always possible. The primary guarantee of the compiler is that any shader recognized as valid by this compiler will be valid and run in the same manner on all supported platforms.
_pcShader | The shader to compile. |
_ui32Length | The length of the string to which _pcShader points or 0 if _pcShader is NULL-terminated. |
_stShaderType | Type of the shader. |
_sError | The returned error string if there is an error. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::CompileFromFile | ( | const LSCHAR * | _pcPath, |
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType, | ||
CString & | _sError | ||
) | [protected] |
Compile a shader from a file. The path must be in UTF-8 format. The file data is treated as UTF-8.
_pcPath | The path to the file to compile. |
_stShaderType | Type of the shader. |
_sError | The returned error string if there is an error. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::CompileFromFile | ( | const LSCHAR * | _pcPath, |
CStringList & | _slData, | ||
LSUINT32 | _ui32Line, | ||
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType, | ||
CIncludeSet & | _isIncludes, | ||
CPreProc::LSG_MACROS & | _mMacros, | ||
CString & | _sError | ||
) | [protected] |
Compile a shader from a file. The path must be in UTF-8 format. The file data is treated as UTF-8.
_pcPath | The path to the file to compile. |
_slData | String list to which the file data is added. |
_ui32Line | Line at which the file data is added. |
_stShaderType | Type of the shader. |
_isIncludes | Set of included files. |
_mMacros | Defines macros. |
_sError | The returned error string if there is an error. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::CompileFromFiles | ( | const LSCHAR * | _pcVertexFile, |
const LSCHAR * | _pcPixelFile, | ||
CString * | _psError = NULL |
||
) |
Sets and parses shaders from the provided files.
_pcVertexFile | The vertex shader file to compile. |
_pcPixelFile | The pixel shader file to compile. |
_psError | The returned error if any. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::CompileFromMemory | ( | const LSUINT8 * | _pui8Src, |
LSUINT32 | _ui32Length, | ||
const LSCHAR * | _pcPath, | ||
CStringList & | _slData, | ||
LSUINT32 | _ui32Line, | ||
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType, | ||
CIncludeSet & | _isIncludes, | ||
CPreProc::LSG_MACROS & | _mMacros, | ||
CString & | _sError | ||
) | [protected] |
Compile a shader from memory. Performs preprocessing.
_pui8Src | The code to compile. |
_ui32Length | Length of the buffered code to compile. |
_pcPath | The path to the code being compiled. May be NULL if there is no source file. |
_slData | String list to which the file data is added. |
_ui32Line | Line at which the file data is added. |
_stShaderType | Type of shader being compiled. |
_isIncludes | Set of included files. |
_mMacros | Defines macros. |
_sError | The returned error string if there is an error. |
virtual LSVOID LSE_CALL lsg::CShaderBase::CreateTranslator | ( | ) | [protected, pure virtual] |
Create a new translator. Must be overridden.
Implemented in lsg::CDirectX11Shader.
virtual LSVOID LSE_CALL lsg::CShaderBase::Deactivate | ( | ) | [pure virtual] |
Deactivation callback. Calls by the system when the shader is deactivated.
Implemented in lsg::CDirectX11Shader.
virtual LSVOID LSE_CALL lsg::CShaderBase::DestroyTranslator | ( | ) | [protected, pure virtual] |
Destroys the translator. Must be overridden.
Implemented in lsg::CDirectX11Shader.
static LSBOOL LSE_CALL lsg::CShaderBase::ExpandMacros | ( | CString & | _sString, |
const CPreProc::LSG_MACROS & | _mMacros, | ||
CString & | _sError | ||
) | [static, protected] |
Replace all macros in a given string.
_sString | The string in which to expand macros. |
_mMacros | The macro dictionary. |
_sError | The error string if the return is false. |
static LSBOOL LSE_CALL lsg::CShaderBase::ExpandMacros | ( | CString & | _sString, |
const CPreProc::LSG_MACROS & | _mMacros, | ||
const CSet< CString > & | _sUsedValues, | ||
CString & | _sError | ||
) | [static, protected] |
Replace all macros in a given string.
_sString | The string in which to expand macros. |
_mMacros | The macro dictionary. |
_sUsedValues | Values that have already been expanded. |
_sError | The error string if the return is false. |
static CString LSE_CALL lsg::CShaderBase::FindHeader | ( | const LSCHAR * | _pcIncluder, |
const CString & | _sFileToInclude | ||
) | [static, protected] |
Find a header file. Searches first the relative path from the main includer, then each of the search paths set by the engine user.
_pcIncluder | Path to the file that is including the |
_sFileToInclude | The file to include. |
virtual LSG_HANDLE LSE_CALL lsg::CShaderBase::GetConstantByName | ( | const LSCHAR * | _pcName | ) | [pure virtual] |
Get a handle for a uniform variable in the shader.
_pcName | Name of the variable whose handle is to be obtained. |
Implemented in lsg::CDirectX11Shader.
static CString LSE_CALL lsg::CShaderBase::GetFilePart | ( | const CString & | _sDirective | ) | [static, protected] |
Get the file part of an #include or #import directive.
_sDirective | The line to scan for the file name. |
virtual LSUINT64 LSE_CALL lsg::CShaderBase::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 causes the fixed-function pipeline to become activated (if the fixed-function pipeline is supported). Because this base class cannot perform the hardware-specific operations, it always returns 0. It is up to the specialization classes to return a valid ID.
Reimplemented in lsg::CDirectX11Shader.
static LSBOOL LSE_CALL lsg::CShaderBase::GetMacroParms | ( | const CString & | _sString, |
LSUINT32 | _ui32Pos, | ||
LSUINT32 & | _ui32NewPos, | ||
CVector< CString > & | _vRet | ||
) | [static, protected] |
Get the parameters for a function-style macro. If no parameters are given, returns false.
_psString | The string from which to extract function-style macro parameters. |
_ui32Pos | The position at which to begin the extraction. |
_ui32NewPos | The position after successful extraction. |
_vRet | The returned parameters, as strings. |
static LSBOOL LSE_CALL lsg::CShaderBase::GetMacroReplacementString | ( | LSUINT32 | _ui32MacroIndex, |
CVector< CString > & | _vParms, | ||
const CPreProc::LSG_MACROS & | _mMacros, | ||
const CSet< CString > & | _sUsedValues, | ||
CString & | _sRet, | ||
CString & | _sError | ||
) | [static, protected] |
Get the replacement string for a given macro and optional parameters. Returns false if there is an error expanding the macro.
_ui32MacroIndex | Index of the macro to expand. |
_vParms | Optional macro parameters. If this does not match the number of parameters the macro receives, false is returned. |
_mMacros | The macro dictionary. |
_sUsedValues | Values that have already been expanded. Allows recursion to be avoided. |
_sRet | The returned fully expanded string. |
_sError | The error report string if there is an error during macro expansion. |
static const CString& LSE_CALL lsg::CShaderBase::GetSearchPath | ( | LSUINT32 | _ui32Index | ) | [static] |
Get a header search path by index.
_ui32Index | Index of the header search path to get. |
static LSBOOL LSE_CALL lsg::CShaderBase::ParseDefine | ( | const CString & | _sLine, |
CPreProc::LSG_MACROS & | _mMacros | ||
) | [static, protected] |
Handle a #define.
_sLine | The text after "#define". Parsed to determin the name, parameters, and definition of a macro. |
_mMacros | Set of macros to which to add the new macro. |
virtual LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::PostCompile | ( | CString & | _sError | ) | [protected, virtual] |
Post compile. If all shaders are compiled successfully, this is called, meant to be overridden by the classes that specialize towards specific graphics API's.
_sError | The returned error string if there is an error. |
Reimplemented in lsg::CDirectX11Shader, and lsg::CShader.
virtual LSVOID LSE_CALL lsg::CShaderBase::PreRender | ( | ) | [virtual] |
Called once prior to each render.
Reimplemented in lsg::CDirectX11Shader.
static LSVOID LSE_CALL lsg::CShaderBase::RemoveComments | ( | CStringList & | _slText | ) | [static, protected] |
Remove comments from code.
_slText | The text from which to remove comments. |
static LSVOID LSE_CALL lsg::CShaderBase::RemoveSearchPath | ( | const LSCHAR * | _pcPath | ) | [static] |
Remove a folder from the paths to search for headers when #include and #import directives are reached in shader files.
_pcPath | The UTF-8 path of the folder to remove from the search routine when seeking headers. |
LSVOID LSE_CALL lsg::CShaderBase::Reset | ( | ) |
Reset everything.
Reimplemented in lsg::CDirectX11Shader, and lsg::CShader.
LSVOID LSE_CALL lsg::CShaderBase::ResetParsers | ( | ) | [protected] |
Reset only the parser classes. Retains the shader texts.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetBool | ( | LSG_HANDLE | _hHandle, |
LSBOOL | _bValue | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetBoolArray | ( | LSG_HANDLE | _hHandle, |
const LSBOOL * | _pbValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetFloat | ( | LSG_HANDLE | _hHandle, |
LSFLOAT | _fValue | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetFloatArray | ( | LSG_HANDLE | _hHandle, |
const LSFLOAT * | _pfValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetInt | ( | LSG_HANDLE | _hHandle, |
LSINT32 | _iValue | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetIntArray | ( | LSG_HANDLE | _hHandle, |
const LSINT32 * | _piValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
LSBOOL LSE_CALL lsg::CShaderBase::SetMacros | ( | const LSG_DEFINE * | _pdDefines, |
LSUINT32 | _ui32Total, | ||
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType | ||
) |
Set preprocessor macros for a given shader type.
_pdDefines | The preprocessor macros. |
_ui32Total | Total macros. |
_stShaderType | The shader type to which to assign the macros. |
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetMatrix2x2 | ( | LSG_HANDLE | _hHandle, |
const CMatrix2x2 & | _mValue | ||
) | [pure virtual] |
Set a 2-by-2 matrix in a shader. Shader must be active.
_hHandle | Handle to the value to set in the shader. |
_mValue | New value. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetMatrix3x3 | ( | LSG_HANDLE | _hHandle, |
const CMatrix3x3 & | _mValue | ||
) | [pure virtual] |
Set a 3-by-3 matrix in a shader. Shader must be active.
_hHandle | Handle to the value to set in the shader. |
_mValue | New value. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetMatrix4x4 | ( | LSG_HANDLE | _hHandle, |
const CMatrix4x4 & | _mValue | ||
) | [pure virtual] |
Set a 4-by-4 matrix in a shader. Shader must be active.
_hHandle | Handle to the value to set in the shader. |
_mValue | New value. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetMatrix4x4Array | ( | LSG_HANDLE | _hHandle, |
const CMatrix4x4 * | _pmValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
LSBOOL LSE_CALL lsg::CShaderBase::SetPixelShader | ( | const LSCHAR * | _pcShader, |
LSUINT32 | _ui32Length = 0 |
||
) |
Set the pixel shader. The shader must be in finalized format. That is, #include directives must have been fully expanded and all the parts for the shader included in the given string. The string must be NULL-terminated if _ui32Length is 0. New-lines can consist of either
pairs or just
. Specifically, is ignored entirely.
_pcShader | The shader to set. |
_ui32Length | The length of the string to which _pcShader points or 0 if _pcShader is NULL-terminated. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::SetShaderFromFile | ( | const LSCHAR * | _pcPath, |
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType, | ||
CString & | _sError | ||
) |
Load a shader from a file. Whether the shader is vertex or pixel must be specified. Proper workflow is to load both the vertex and pixel shaders, then compile, then use.
_pcPath | The path to the file to compile. |
_stShaderType | Type of the shader. |
_sError | The returned error string if there is an error. |
LSG_SHADER_ERRORS LSE_CALL lsg::CShaderBase::SetShaderFromMemory | ( | const LSUINT8 * | _pui8Src, |
LSUINT32 | _ui32Length, | ||
const LSCHAR * | _pcPath, | ||
CShaderLanguageParser::LSG_SHADER_TYPES | _stShaderType, | ||
CString & | _sError | ||
) |
Load a shader from from memory. Whether the shader is vertex or pixel must be specified. Proper workflow is to load both the vertex and pixel shaders, then compile, then use.
_pui8Src | The code to compile. |
_ui32Length | Length of the buffered code to compile. |
_pcPath | The path to the code being compiled. May be NULL if there is no source file. |
_stShaderType | Type of shader being compiled. |
_sError | The returned error string if there is an error. |
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetVector2 | ( | LSG_HANDLE | _hHandle, |
const CVector2 & | _vValue | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetVector2Array | ( | LSG_HANDLE | _hHandle, |
const CVector2 * | _pvValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetVector3 | ( | LSG_HANDLE | _hHandle, |
const CVector3 & | _vValue | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetVector3Array | ( | LSG_HANDLE | _hHandle, |
const CVector3 * | _pvValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetVector4 | ( | LSG_HANDLE | _hHandle, |
const CVector4 & | _vValue | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
virtual LSBOOL LSE_CALL lsg::CShaderBase::SetVector4Array | ( | LSG_HANDLE | _hHandle, |
const CVector4 * | _pvValues, | ||
LSUINT32 | _ui32Total | ||
) | [pure 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. |
Implemented in lsg::CDirectX11Shader.
LSBOOL LSE_CALL lsg::CShaderBase::SetVertexShader | ( | const LSCHAR * | _pcShader, |
LSUINT32 | _ui32Length = 0 |
||
) |
Set the vertex shader. The shader must be in finalized format. That is, #include directives must have been fully expanded and all the parts for the shader included in the given string. The string must be NULL-terminated if _ui32Length is 0. New-lines can consist of either
pairs or just
. Specifically, is ignored entirely.
_pcShader | The shader to set. |
_ui32Length | The length of the string to which _pcShader points or 0 if _pcShader is NULL-terminated. |
static LSVOID LSE_CALL lsg::CShaderBase::SkipString | ( | const CString & | _sLine, |
LSUINT32 & | _ui32Pos | ||
) | [static, protected] |
Skip strings in code.
_sString | The string containing the string to skip. |
_ui32Pos | The position of the string to skip. Upon returning, this holds the new position from where parsing can continue. |
static LSUINT32 LSE_CALL lsg::CShaderBase::TotalSearchPaths | ( | ) | [static] |
Get the total number of header search paths.
CShaderTranslationProcessorBase::LSG_ERROR_CODES lsg::CShaderBase::m_ecTranslationResult [protected] |
The result of translation.
CShaderLexer* lsg::CShaderBase::m_pslLexer [protected] |
The lexer. Can be deleted when done compiling.
CShaderParserWrapper* lsg::CShaderBase::m_pspwParser [protected] |
The syntax parser. Can be deleted when done compiling.
The translator.
CString lsg::CShaderBase::m_sFinalPixel [protected] |
The final form of the pixel shader.
CString lsg::CShaderBase::m_sFinalVertex [protected] |
The final form of the vertex shader.
CStringList lsg::CShaderBase::m_slHeaderPaths [static, protected] |
Paths to search for header files.
CString lsg::CShaderBase::m_sPixelShader [protected] |
The pixel shader text (in final form). Length() is 0 if there is none.
CString lsg::CShaderBase::m_sVertexShader [protected] |
The vertex shader text (in final form). Length() is 0 if there is none.
CShaderTranslationProcessorBase::LSG_ATTRIBUTE_LIST lsg::CShaderBase::m_ulAttributes[CShaderLanguageParser::LSG_ST_TOTAL] [protected] |
Uniform globals in the shaders.
CShaderTranslationProcessorBase::LSG_UNIFORM_LIST lsg::CShaderBase::m_ulUniforms[CShaderLanguageParser::LSG_ST_TOTAL] [protected] |
Uniform globals in the shaders.
CShaderTranslationProcessorBase::LSG_UNIFORM_SEMANTIC_LIST lsg::CShaderBase::m_uslSemantics[CShaderLanguageParser::LSG_ST_TOTAL] [protected] |
Global semantics in the shaders.
CVector<LSG_PREPROC_DEFINE> lsg::CShaderBase::m_vDefs[CShaderLanguageParser::LSG_ST_TOTAL] [protected] |
Definitions for the shaders.