627 lines
22 KiB
C++
627 lines
22 KiB
C++
/**************************************************************************
|
|
/* File: ShaderDescriptor.h
|
|
/* Author: Francisco Cabrita
|
|
/*
|
|
/* Virtools SDK
|
|
/* Copyright (c) Virtools 2004, All Rights Reserved.
|
|
/**************************************************************************/
|
|
#ifndef ShaderDescriptor_H
|
|
#define ShaderDescriptor_H "$Id:$"
|
|
|
|
|
|
namespace ShaderDescriptor {
|
|
|
|
using namespace ShaderDescriptor_Base;
|
|
|
|
class Manager;
|
|
class Shader;
|
|
#if defined(_XBOX) && (_XBOX_VER<200)
|
|
//--- Class Enum (refer to D3DXPT enum)
|
|
enum {
|
|
ParamClassCount = 0
|
|
};
|
|
|
|
//--- Type Enum (refer to D3DXPT enum)
|
|
enum {
|
|
ParamTypeCount = D3DXPT_PIXELSHADER+1
|
|
};
|
|
#else
|
|
//--- Class Enum (refer to D3DXPT enum)
|
|
enum {
|
|
ParamClassCount = D3DXPC_STRUCT+1
|
|
};
|
|
|
|
//--- Type Enum (refer to D3DXPT enum)
|
|
enum {
|
|
ParamTypeCount = D3DXPT_VERTEXFRAGMENT+1
|
|
};
|
|
#endif
|
|
|
|
//--- Structure passed to the Meaning Processing Callback
|
|
struct MeaningProcessingInfo {
|
|
|
|
MeaningProcessingInfo();
|
|
MeaningProcessingInfo( CK3dEntity* iEnt, CKMaterial* iMat, ID3DXEffect* iFx, CKRenderContext* iRC, CKMaterialShader* iMatShader, Shader* iShader, CKParameter* iParam ) :
|
|
ent(iEnt), mat(iMat), fx(iFx), rc(iRC), matShader(iMatShader), shader(iShader), param(iParam) {};
|
|
|
|
CK3dEntity* ent;
|
|
CKMaterial* mat;
|
|
ID3DXEffect* fx;
|
|
CKRenderContext* rc;
|
|
CKMaterialShader* matShader;
|
|
Shader* shader;
|
|
CKParameter* param;
|
|
};
|
|
|
|
//--- Structure passed to the Meaning Instantiator
|
|
struct MeaningInstantiatorInfo {
|
|
|
|
MeaningInstantiatorInfo();
|
|
|
|
MeaningInstantiatorInfo( ID3DXEffect* iFx, D3DXHANDLE iHandle, Manager* iSDM, Shader* iShader ) :
|
|
fx(iFx), h(iHandle), sdm(iSDM), semIndex(Sem_Unknown), shader(iShader), paramIndex(0) {
|
|
};
|
|
|
|
MeaningInstantiatorInfo( ID3DXEffect* iFx, D3DXHANDLE iHandle, Manager* iSDM, Shader* iShader,
|
|
const D3DXPARAMETER_DESC& iParamDesc )
|
|
{
|
|
MeaningInstantiatorInfo( iFx, iHandle, iSDM, iShader );
|
|
paramDesc = iParamDesc;
|
|
}
|
|
|
|
|
|
ID3DXEffect* fx;
|
|
D3DXHANDLE h;
|
|
Manager* sdm;
|
|
Shader* shader;
|
|
|
|
union {
|
|
int paramIndex;
|
|
int functionIndex;
|
|
int techIndex;
|
|
};
|
|
|
|
union {
|
|
D3DXPARAMETER_DESC paramDesc;
|
|
#if DIRECT3D_VERSION>=0x0900
|
|
D3DXFUNCTION_DESC functionDesc;
|
|
#endif
|
|
D3DXTECHNIQUE_DESC techDesc;
|
|
D3DXPASS_DESC passDesc;
|
|
};
|
|
|
|
union {
|
|
int semIndex;
|
|
};
|
|
|
|
};
|
|
|
|
/***************************************************************************
|
|
__ __ _
|
|
| \/ | ___ __ _ _ __ (_)_ __ __ _
|
|
| |\/| |/ _ \/ _` | '_ \| | '_ \ / _` |
|
|
| | | | __/ (_| | | | | | | | | (_| |
|
|
|_| |_|\___|\__,_|_| |_|_|_| |_|\__, |
|
|
|___/
|
|
***************************************************************************/
|
|
class Meaning {
|
|
public:
|
|
|
|
virtual void PostIntantiationCallBack( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI ) = 0;
|
|
|
|
D3DXHANDLE m_D3DHandle;
|
|
|
|
union {
|
|
D3DXPARAMETER_DESC m_ParamDesc;
|
|
#if DIRECT3D_VERSION>=0x0900
|
|
D3DXFUNCTION_DESC m_FunctionDesc;
|
|
#endif
|
|
D3DXTECHNIQUE_DESC m_TechDesc;
|
|
D3DXPASS_DESC m_PassDesc;
|
|
};
|
|
};
|
|
|
|
/***************************************************************************
|
|
____
|
|
| _ \ __ _ _ __ __ _ _ __ ___
|
|
| |_) / _` | '__/ _` | '_ ` _ \
|
|
| __/ (_| | | | (_| | | | | | |
|
|
|_|__ \__,_|_| \__,_|_| |_| |_|
|
|
|
|
**************************************************************************/
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Standard Param (To Derived)
|
|
//--------------------------------------------------------------------------------
|
|
class ParamMeaning : public Meaning {
|
|
public:
|
|
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI ){};
|
|
virtual void PostIntantiationCallBack( const MeaningInstantiatorInfo& iMPI );
|
|
|
|
//--- Convenient Function
|
|
void SetValueByCastingVectorParam( const MeaningProcessingInfo& iMPI, int iInputSize, const void* value );
|
|
void SetValueByMatrix( const MeaningProcessingInfo& iMPI, const VxMatrix& iMatrix );
|
|
void SetValueByTranposingMatrix( const MeaningProcessingInfo& iMPI, const VxMatrix& iMatrix );
|
|
void SetValueByInversingMatrix( const MeaningProcessingInfo& iMPI, const VxMatrix& iMatrix );
|
|
void SetValueByInversingMatrix44( const MeaningProcessingInfo& iMPI, const VxMatrix& iMatrix );
|
|
void SetValueByInverseTransposingMatrix( const MeaningProcessingInfo& iMPI, const VxMatrix& iMatrix );
|
|
void SetValueByInverseTransposingMatrix44( const MeaningProcessingInfo& iMPI, const VxMatrix& iMatrix );
|
|
void SetValueFromCKTexture( const MeaningProcessingInfo& iMPI, CKTexture* iTex );
|
|
|
|
int m_ExpositionType;
|
|
};
|
|
|
|
#if DIRECT3D_VERSION>=0x0900
|
|
//--------------------------------------------------------------------------------
|
|
// NearestLight (Switcher to derive from)
|
|
//--------------------------------------------------------------------------------
|
|
class ParamMeaning_NearestLight : public ParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
|
|
//--- Methods One Have To Overide
|
|
virtual int GiveStride( const MeaningProcessingInfo& iMPI ) = 0;
|
|
|
|
virtual void GiveDefaultValues( const MeaningProcessingInfo& iMPI,
|
|
void* iTempBuffer, int iFinalArrayCount ) = 0;
|
|
virtual void GiveValue( const MeaningProcessingInfo& iMPI,
|
|
CKLight& iLight, void* iValueBuf ) = 0;
|
|
|
|
//--- Methods To Overide If Needed
|
|
virtual void AssignValues( const MeaningProcessingInfo& iMPI,
|
|
void* iValueBuf, const int iElemCount );
|
|
|
|
int m_NearestIndex;
|
|
int m_WantedLightArraySize;
|
|
bool m_Sort;
|
|
|
|
protected:
|
|
//--- Convenient Function
|
|
XArray< CKShaderManager::NearestLight >*
|
|
_GetLightsArrayRange( const MeaningProcessingInfo& iMII,
|
|
int& oMinLightIndex,
|
|
int& oMaxLightIndex,
|
|
bool iSort = true );
|
|
};
|
|
#endif
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Standard Params (To Derived)
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedParamMeaning : public ParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual ~ExposedParamMeaning();
|
|
virtual void PostIntantiationCallBack( const MeaningInstantiatorInfo& iMPI );
|
|
virtual void CopyDefaultValueFromShaderToParamCB( const MeaningProcessingInfo& iMPI );
|
|
|
|
CKGUID m_Guid;
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Float Params
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedFloatParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
virtual void CopyDefaultValueFromShaderToParamCB( const MeaningProcessingInfo& iMPI );
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Dword Params
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedDwordParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
virtual void CopyDefaultValueFromShaderToParamCB( const MeaningProcessingInfo& iMPI );
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Vectorizable Param
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedVectorizableParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
};
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed 2DVector Param
|
|
//--------------------------------------------------------------------------------
|
|
class Exposed2DVectorParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed XDVector Param
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedXDVectorParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Array Params
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedArrayParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
|
|
CKGUID m_Guid2;
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Matrix Params
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedMatrixParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
};
|
|
|
|
//--------------------------------------------------------------------------------
|
|
// Exposed Texture Params
|
|
//--------------------------------------------------------------------------------
|
|
class ExposedTextureParamMeaning : public ExposedParamMeaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
};
|
|
|
|
/***************************************************************************
|
|
____
|
|
| _ \ __ _ ___ ___
|
|
| |_) / _` / __/ __|
|
|
| __/ (_| \__ \__ \
|
|
|_| \__,_|___/___/
|
|
|
|
***************************************************************************/
|
|
class PassMeaning : public Meaning {
|
|
public:
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
virtual void PostIntantiationCallBack( const MeaningInstantiatorInfo& iMII );
|
|
|
|
XString m_DescStr;
|
|
};
|
|
|
|
|
|
/***************************************************************************
|
|
_____ _
|
|
|_ _|__ ___| |__
|
|
| |/ _ \/ __| '_ \
|
|
| | __/ (__| | | |
|
|
|_|\___|\___|_| |_|
|
|
|
|
**************************************************************************/
|
|
class TechMeaning : public Meaning {
|
|
public:
|
|
|
|
TechMeaning();
|
|
virtual ~TechMeaning();
|
|
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
virtual void PostIntantiationCallBack( const MeaningInstantiatorInfo& iMII );
|
|
|
|
inline int GetPassIndexByName( const char* iPassName )
|
|
{
|
|
int* passMeaningPtr = m_PassIndexFromName.FindPtr( iPassName );
|
|
return passMeaningPtr? *passMeaningPtr:-1;
|
|
}
|
|
|
|
bool m_Validated;
|
|
XString m_DescStr;
|
|
XArray<PassMeaning*> m_Passes;
|
|
XHashTable<int, XString> m_PassIndexFromName;
|
|
|
|
enum EMeshOps {
|
|
MeshOp_None = 0,
|
|
MeshOp_BuildTangentSpace = 1,
|
|
MeshOp_RemoveTangentSpace = 2,
|
|
MeshOp_SetUseColorAndNormal = 4,
|
|
MeshOp_RemoveUseColorAndNormal = 8
|
|
};
|
|
int m_MeshOps;
|
|
};
|
|
|
|
|
|
/***************************************************************************
|
|
_____ _
|
|
| ___|__| |_
|
|
| |_ / __| __|
|
|
| _| (__| |_
|
|
|_| \___|\__|
|
|
|
|
**************************************************************************/
|
|
class FctMeaning : public Meaning {
|
|
public:
|
|
|
|
static Meaning* MeaningInstantiator( const MeaningInstantiatorInfo& iMII );
|
|
virtual void ProcessCallBack( const MeaningProcessingInfo& iMPI );
|
|
virtual void PostIntantiationCallBack( const MeaningInstantiatorInfo& iMII );
|
|
};
|
|
|
|
|
|
/***************************************************************************
|
|
____ _ _
|
|
/ ___|| |__ __ _ __| | ___ _ __
|
|
\___ \| '_ \ / _` |/ _` |/ _ \ '__|
|
|
___) | | | | (_| | (_| | __/ |
|
|
|____/|_| |_|\__,_|\__,_|\___|_|
|
|
|
|
***************************************************************************/
|
|
typedef Meaning* (*MeaningInstantiatorPtr) ( const MeaningInstantiatorInfo& iMII );
|
|
|
|
class Shader {
|
|
|
|
public:
|
|
|
|
friend class Manager;
|
|
friend class TechMeaning;
|
|
|
|
Shader();
|
|
~Shader();
|
|
|
|
void Init( Manager* iShaderManager, ID3DXEffect* iDxFX, CKRenderContext* iRC, CKShader* iShader );
|
|
void ExecuteMeanings( MeaningProcessingInfo& iMPI );
|
|
void ExecutePerPassMeanings( MeaningProcessingInfo& iMPI );
|
|
|
|
inline Manager* GetManager(){ return m_SDM; }
|
|
inline CKShader* GetCKShader(){ return m_Shader; }
|
|
|
|
inline CKRenderContext* GetRenderContext(){ return m_RC; }
|
|
|
|
inline ExposedParamMeaning* GetParamMeaningByName( const XString& iName )
|
|
{
|
|
ExposedParamMeaning** paramMeaningPtr = m_ParamMeaningFromName.FindPtr( iName );
|
|
return paramMeaningPtr? *paramMeaningPtr:NULL;
|
|
}
|
|
|
|
inline TechMeaning* GetTechMeaningByName( const XString& iName )
|
|
{
|
|
int techIndex = GetTechIndexByName( iName );
|
|
if( techIndex == -1 ) return NULL;
|
|
return m_Techs[ techIndex ];
|
|
}
|
|
|
|
inline int GetTechIndexByName( const XString& iName )
|
|
{
|
|
int* techMeaningPtr = m_TechIndexFromName.FindPtr( iName );
|
|
return techMeaningPtr? *techMeaningPtr:-1;
|
|
}
|
|
|
|
inline FctMeaning* GetFctMeaningByName( const char* iName )
|
|
{
|
|
FctMeaning** fctMeaningPtr = m_FctMeaningFromName.FindPtr( iName );
|
|
return fctMeaningPtr? *fctMeaningPtr:NULL;
|
|
}
|
|
|
|
inline XArray<ParamMeaning*>& GetParamMeanings(){ return m_Params; }
|
|
inline XArray<ExposedParamMeaning*>& GetExposedParamMeanings(){ return m_ExposedParams; }
|
|
inline XArray<TechMeaning*>& GetTechMeanings(){ return m_Techs; }
|
|
inline XArray<FctMeaning*>& GetFunctMeanings(){ return m_Functs; }
|
|
|
|
static Meaning* InstantiateMeaning( MeaningInstantiatorPtr iMiptr, const MeaningInstantiatorInfo& iMPI );
|
|
static Meaning* InstantiateMeaningWithPost( MeaningInstantiatorPtr iMiptr, const MeaningInstantiatorInfo& iMPI );
|
|
|
|
protected:
|
|
|
|
void BuildDescription();
|
|
void DestroyDescription();
|
|
|
|
TechMeaning* BuildTechMeaning( MeaningInstantiatorInfo& ioMII );
|
|
ParamMeaning* BuildParamMeaning( MeaningInstantiatorInfo& ioMII );
|
|
FctMeaning* BuildFctMeaning( MeaningInstantiatorInfo& ioMII );
|
|
PassMeaning* BuildPassMeaning( MeaningInstantiatorInfo& ioMII );
|
|
|
|
|
|
XArray<ParamMeaning*> m_Params;
|
|
XArray<ParamMeaning*> m_ParamsPerPass;
|
|
XArray<ExposedParamMeaning*> m_ExposedParams;
|
|
XArray<TechMeaning*> m_Techs;
|
|
XArray<FctMeaning*> m_Functs;
|
|
|
|
XHashTable<ExposedParamMeaning*, XString> m_ParamMeaningFromName;
|
|
XHashTable<int, XString> m_TechIndexFromName;
|
|
XHashTable<FctMeaning*, XString> m_FctMeaningFromName;
|
|
|
|
protected:
|
|
|
|
ID3DXEffect* m_DxFX;
|
|
Manager* m_SDM;
|
|
CKRenderContext* m_RC;
|
|
CKShader* m_Shader;
|
|
};
|
|
|
|
/***************************************************************************
|
|
__ __
|
|
| \/ | __ _ _ __ __ _ __ _ ___ _ __
|
|
| |\/| |/ _` | '_ \ / _` |/ _` |/ _ \ '__|
|
|
| | | | (_| | | | | (_| | (_| | __/ |
|
|
|_| |_|\__,_|_| |_|\__,_|\__, |\___|_|
|
|
|___/
|
|
***************************************************************************/
|
|
class Manager {
|
|
|
|
public:
|
|
|
|
friend class Shader;
|
|
|
|
Manager();
|
|
|
|
void Init( CKContext* iContext );
|
|
|
|
D3DXHANDLE m_PreviousTextureParam;
|
|
|
|
inline CKContext* GetCKContext(){ return m_Context; }
|
|
inline CKShaderManager* GetShaderManager(){ return m_ShaderManager; }
|
|
|
|
#if DIRECT3D_VERSION<0x0900
|
|
virtual int GetSemanticIndexFromFourCC( DWORD iFcc );
|
|
#else
|
|
virtual int GetSemanticIndexFromString( XString& iStr );
|
|
#endif
|
|
|
|
void GetSemanticDesc( int iSemanticEnum, XString*& oSemDesc );
|
|
#if DIRECT3D_VERSION>=0x0900
|
|
const XClassArray<XString>& GetAnnotationOriginalNames();
|
|
int GetAnnotationIndexFromString( XString& iStr );
|
|
int GetAnnotStrValueIndexFromString( XString& iStr );
|
|
#endif
|
|
void ExpectingAnnotation( int iAnnotationEnum, int iAnnotationType, void* iValuePtr, bool* iAnnotIsUsedPtr = NULL );
|
|
void ParseExpectedAnnotations( ID3DXEffect* iFx,
|
|
D3DXHANDLE iHandle,
|
|
int iNumberOfAnnotationsToRead );
|
|
|
|
const XClassArray<XString>& GetSemanticOriginalNames();
|
|
|
|
protected:
|
|
void RegisterSemanticName( int iSemanticEnum, const char* iName, const char* iDesc = NULL );
|
|
void RegisterSemanticDesc( int iSemanticEnum, const char* iDesc );
|
|
#if DIRECT3D_VERSION>=0x0900
|
|
void RegisterAnnotationName( int iAnnotationEnum , const char* iName );
|
|
void RegisterAnnotationStringValues( int iAnnotStrEnum , const char* iValue );
|
|
#endif
|
|
void RegisterParamMeaningForSemantic( int iSemEnum, MeaningInstantiatorPtr iFctPtr );
|
|
|
|
#if DIRECT3D_VERSION<0x0900
|
|
void RegisterParamMeaningForType(int iType, MeaningInstantiatorPtr iFctPtr );
|
|
#else
|
|
void RegisterParamMeaningForClassAndType( int iClass, int iType, MeaningInstantiatorPtr iFctPtr );
|
|
#endif
|
|
|
|
void RegisterFctMeaning( MeaningInstantiatorPtr iFctPtr );
|
|
void RegisterTechMeaning( MeaningInstantiatorPtr iFctPtr );
|
|
void RegisterPassMeaning( MeaningInstantiatorPtr iFctPtr );
|
|
|
|
protected:
|
|
|
|
struct AnnotationExpected {
|
|
|
|
AnnotationExpected()
|
|
: annotEnum( Annot_Unknown ), annotType( AnnotType_Unknown ),
|
|
valuePtr( NULL ), annotIsUsedPtr( NULL ) {}
|
|
|
|
AnnotationExpected( int iAnnotationEnum, int iAnnotationType, void* iValuePtr )
|
|
: annotEnum( iAnnotationEnum ), annotType( iAnnotationType ),
|
|
valuePtr( iValuePtr ), annotIsUsedPtr( NULL ) {}
|
|
|
|
AnnotationExpected( int iAnnotationEnum, int iAnnotationType, void* iValuePtr, bool* iAnnotIsUsedPtr )
|
|
: annotEnum( iAnnotationEnum ), annotType( iAnnotationType ),
|
|
valuePtr( iValuePtr ), annotIsUsedPtr( iAnnotIsUsedPtr ) {}
|
|
|
|
int annotEnum;
|
|
int annotType;
|
|
void* valuePtr;
|
|
bool* annotIsUsedPtr;
|
|
};
|
|
|
|
XArray<AnnotationExpected> m_AnnotationsExpected;
|
|
|
|
CKBOOL m_EverythinghasAlreadyBeenRegistered;
|
|
CKContext* m_Context;
|
|
CKShaderManager* m_ShaderManager;
|
|
|
|
#if DIRECT3D_VERSION<0x0900
|
|
XHashTable<int, DWORD> m_SemanticHash;
|
|
#else
|
|
XHashTable<int, XString> m_SemanticHash;
|
|
XHashTable<int, XString> m_AnnotationHash;
|
|
XHashTable<int, XString> m_AnnotStrHash;
|
|
#endif
|
|
//--- Same description for all semantic (even synonyms... that's why it's a static array)
|
|
XString m_SemanticDescString[ShaderDescriptor_Base::SemCount];
|
|
|
|
//--- Original Names (use by the Shader Editor)
|
|
XClassArray<XString> m_AnnotationNameString;
|
|
XClassArray<XString> m_SemanticNameString;
|
|
|
|
//--- Meaning Instantiators
|
|
|
|
XArray<MeaningInstantiatorPtr> m_MeaningInstantiatorForFunctions;
|
|
XArray<MeaningInstantiatorPtr> m_MeaningInstantiatorForTechniques;
|
|
XArray<MeaningInstantiatorPtr> m_MeaningInstantiatorForPasses;
|
|
|
|
MeaningInstantiatorPtr m_MeaningInstantiatorForParamBySemantic[SemCount];
|
|
#if DIRECT3D_VERSION<0x0900
|
|
MeaningInstantiatorPtr m_MeaningInstantiatorForParamByType[ParamTypeCount];
|
|
#else
|
|
MeaningInstantiatorPtr m_MeaningInstantiatorForParamByClassAndType[ParamClassCount][ParamTypeCount];
|
|
#endif
|
|
};
|
|
|
|
|
|
/***************************************************************************
|
|
____ _ _
|
|
/ ___|___ _ ____ _____ _ __ (_) ___ _ __ | |_
|
|
| | / _ \| '_ \ \ / / _ \ '_ \| |/ _ \ '_ \| __|
|
|
| |__| (_) | | | \ V / __/ | | | | __/ | | | |_
|
|
\____\___/|_| |_|\_/ \___|_| |_|_|\___|_| |_|\__|
|
|
| ___| _ _ __ ___| |_(_) ___ _ __ ___
|
|
| |_ | | | | '_ \ / __| __| |/ _ \| '_ \/ __|
|
|
| _|| |_| | | | | (__| |_| | (_) | | | \__ \
|
|
|_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
|
|
|
|
***************************************************************************/
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define Instantiate_Meaning_With_Post( meaningClass, iMII ) \
|
|
ShaderDescriptor::Shader::InstantiateMeaningWithPost( meaningClass##::MeaningInstantiator, iMII );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define Instantiate_Meaning( meaningClass, iMII ) \
|
|
ShaderDescriptor::Shader::InstantiateMeaning( meaningClass##::MeaningInstantiator, iMII );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define RegisterMeaningBySemantic( sem, meaningClass ) \
|
|
this->RegisterParamMeaningForSemantic( sem, meaningClass##::MeaningInstantiator );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define RegisterMeaningByClassAndType( clas, typ, meaningClass ) \
|
|
this->RegisterParamMeaningForClassAndType( clas, typ, meaningClass##::MeaningInstantiator );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define RegisterMeaningByType( typ, meaningClass ) \
|
|
this->RegisterParamMeaningForType( typ, meaningClass##::MeaningInstantiator );
|
|
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define RegisterMeaningForTech( meaningClass ) \
|
|
this->RegisterTechMeaning( meaningClass##::MeaningInstantiator );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define RegisterMeaningForPass( meaningClass ) \
|
|
this->RegisterPassMeaning( meaningClass##::MeaningInstantiator );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define RegisterMeaningForFct( meaningClass ) \
|
|
this->RegisterFctMeaning( meaningClass##::MeaningInstantiator );
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define CLASSIC_INSTANTIATOR_DEFINITION( meaningClass ) \
|
|
Meaning* \
|
|
meaningClass::MeaningInstantiator( const MeaningInstantiatorInfo& iMII ){ \
|
|
meaningClass* inst = new meaningClass; \
|
|
return inst; \
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------
|
|
#define CLASSIC_INSTANTIATOR_DEF_INSIDE( meaningClass ) \
|
|
static Meaning* \
|
|
MeaningInstantiator( const MeaningInstantiatorInfo& iMII ){ \
|
|
meaningClass* inst = new meaningClass; \
|
|
return inst; \
|
|
}
|
|
|
|
}
|
|
#endif
|
|
|
|
|