Subversion Repositories Games.Chess Giants

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. //  Copyright (c) Microsoft Corporation.  All rights reserved.
  5. //
  6. //  File:       d3dx9effect.h
  7. //  Content:    D3DX effect types and Shaders
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10.  
  11. #include "d3dx9.h"
  12.  
  13. #ifndef __D3DX9EFFECT_H__
  14. #define __D3DX9EFFECT_H__
  15.  
  16.  
  17. //----------------------------------------------------------------------------
  18. // D3DXFX_DONOTSAVESTATE
  19. //   This flag is used as a parameter to ID3DXEffect::Begin().  When this flag
  20. //   is specified, device state is not saved or restored in Begin/End.
  21. // D3DXFX_DONOTSAVESHADERSTATE
  22. //   This flag is used as a parameter to ID3DXEffect::Begin().  When this flag
  23. //   is specified, shader device state is not saved or restored in Begin/End.
  24. //   This includes pixel/vertex shaders and shader constants
  25. // D3DXFX_DONOTSAVESAMPLERSTATE
  26. //   This flag is used as a parameter to ID3DXEffect::Begin(). When this flag
  27. //   is specified, sampler device state is not saved or restored in Begin/End.
  28. // D3DXFX_NOT_CLONEABLE
  29. //   This flag is used as a parameter to the D3DXCreateEffect family of APIs.
  30. //   When this flag is specified, the effect will be non-cloneable and will not
  31. //   contain any shader binary data.
  32. //   Furthermore, GetPassDesc will not return shader function pointers.
  33. //   Setting this flag reduces effect memory usage by about 50%.
  34. //----------------------------------------------------------------------------
  35.  
  36. #define D3DXFX_DONOTSAVESTATE         (1 << 0)
  37. #define D3DXFX_DONOTSAVESHADERSTATE   (1 << 1)
  38. #define D3DXFX_DONOTSAVESAMPLERSTATE  (1 << 2)
  39.  
  40. #define D3DXFX_NOT_CLONEABLE          (1 << 11)
  41. #define D3DXFX_LARGEADDRESSAWARE      (1 << 17)
  42.  
  43. //----------------------------------------------------------------------------
  44. // D3DX_PARAMETER_SHARED
  45. //   Indicates that the value of a parameter will be shared with all effects
  46. //   which share the same namespace.  Changing the value in one effect will
  47. //   change it in all.
  48. //
  49. // D3DX_PARAMETER_LITERAL
  50. //   Indicates that the value of this parameter can be treated as literal.
  51. //   Literal parameters can be marked when the effect is compiled, and their
  52. //   cannot be changed after the effect is compiled.  Shared parameters cannot
  53. //   be literal.
  54. //----------------------------------------------------------------------------
  55.  
  56. #define D3DX_PARAMETER_SHARED       (1 << 0)
  57. #define D3DX_PARAMETER_LITERAL      (1 << 1)
  58. #define D3DX_PARAMETER_ANNOTATION   (1 << 2)
  59.  
  60. //----------------------------------------------------------------------------
  61. // D3DXEFFECT_DESC:
  62. //----------------------------------------------------------------------------
  63.  
  64. typedef struct _D3DXEFFECT_DESC
  65. {
  66.     LPCSTR Creator;                     // Creator string
  67.     UINT Parameters;                    // Number of parameters
  68.     UINT Techniques;                    // Number of techniques
  69.     UINT Functions;                     // Number of function entrypoints
  70.  
  71. } D3DXEFFECT_DESC;
  72.  
  73.  
  74. //----------------------------------------------------------------------------
  75. // D3DXPARAMETER_DESC:
  76. //----------------------------------------------------------------------------
  77.  
  78. typedef struct _D3DXPARAMETER_DESC
  79. {
  80.     LPCSTR Name;                        // Parameter name
  81.     LPCSTR Semantic;                    // Parameter semantic
  82.     D3DXPARAMETER_CLASS Class;          // Class
  83.     D3DXPARAMETER_TYPE Type;            // Component type
  84.     UINT Rows;                          // Number of rows
  85.     UINT Columns;                       // Number of columns
  86.     UINT Elements;                      // Number of array elements
  87.     UINT Annotations;                   // Number of annotations
  88.     UINT StructMembers;                 // Number of structure member sub-parameters
  89.     DWORD Flags;                        // D3DX_PARAMETER_* flags
  90.     UINT Bytes;                         // Parameter size, in bytes
  91.  
  92. } D3DXPARAMETER_DESC;
  93.  
  94.  
  95. //----------------------------------------------------------------------------
  96. // D3DXTECHNIQUE_DESC:
  97. //----------------------------------------------------------------------------
  98.  
  99. typedef struct _D3DXTECHNIQUE_DESC
  100. {
  101.     LPCSTR Name;                        // Technique name
  102.     UINT Passes;                        // Number of passes
  103.     UINT Annotations;                   // Number of annotations
  104.  
  105. } D3DXTECHNIQUE_DESC;
  106.  
  107.  
  108. //----------------------------------------------------------------------------
  109. // D3DXPASS_DESC:
  110. //----------------------------------------------------------------------------
  111.  
  112. typedef struct _D3DXPASS_DESC
  113. {
  114.     LPCSTR Name;                        // Pass name
  115.     UINT Annotations;                   // Number of annotations
  116.  
  117.     CONST DWORD *pVertexShaderFunction; // Vertex shader function
  118.     CONST DWORD *pPixelShaderFunction;  // Pixel shader function
  119.  
  120. } D3DXPASS_DESC;
  121.  
  122.  
  123. //----------------------------------------------------------------------------
  124. // D3DXFUNCTION_DESC:
  125. //----------------------------------------------------------------------------
  126.  
  127. typedef struct _D3DXFUNCTION_DESC
  128. {
  129.     LPCSTR Name;                        // Function name
  130.     UINT Annotations;                   // Number of annotations
  131.  
  132. } D3DXFUNCTION_DESC;
  133.  
  134.  
  135.  
  136. //////////////////////////////////////////////////////////////////////////////
  137. // ID3DXEffectPool ///////////////////////////////////////////////////////////
  138. //////////////////////////////////////////////////////////////////////////////
  139.  
  140. typedef interface ID3DXEffectPool ID3DXEffectPool;
  141. typedef interface ID3DXEffectPool *LPD3DXEFFECTPOOL;
  142.  
  143. // {9537AB04-3250-412e-8213-FCD2F8677933}
  144. DEFINE_GUID(IID_ID3DXEffectPool,
  145. 0x9537ab04, 0x3250, 0x412e, 0x82, 0x13, 0xfc, 0xd2, 0xf8, 0x67, 0x79, 0x33);
  146.  
  147.  
  148. #undef INTERFACE
  149. #define INTERFACE ID3DXEffectPool
  150.  
  151. DECLARE_INTERFACE_(ID3DXEffectPool, IUnknown)
  152. {
  153.     // IUnknown
  154.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  155.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  156.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  157.  
  158.     // No public methods
  159. };
  160.  
  161.  
  162. //////////////////////////////////////////////////////////////////////////////
  163. // ID3DXBaseEffect ///////////////////////////////////////////////////////////
  164. //////////////////////////////////////////////////////////////////////////////
  165.  
  166. typedef interface ID3DXBaseEffect ID3DXBaseEffect;
  167. typedef interface ID3DXBaseEffect *LPD3DXBASEEFFECT;
  168.  
  169. // {017C18AC-103F-4417-8C51-6BF6EF1E56BE}
  170. DEFINE_GUID(IID_ID3DXBaseEffect,
  171. 0x17c18ac, 0x103f, 0x4417, 0x8c, 0x51, 0x6b, 0xf6, 0xef, 0x1e, 0x56, 0xbe);
  172.  
  173.  
  174. #undef INTERFACE
  175. #define INTERFACE ID3DXBaseEffect
  176.  
  177. DECLARE_INTERFACE_(ID3DXBaseEffect, IUnknown)
  178. {
  179.     // IUnknown
  180.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  181.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  182.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  183.  
  184.     // Descs
  185.     STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
  186.     STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE;
  187.     STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  188.     STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE;
  189.     STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE;
  190.  
  191.     // Handle operations
  192.     STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
  193.     STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE;
  194.     STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
  195.     STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
  196.     STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
  197.     STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
  198.     STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE;
  199.     STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE;
  200.     STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
  201.     STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
  202.     STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE;
  203.     STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE;
  204.  
  205.     // Get/Set Parameters
  206.     STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE;
  207.     STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE;
  208.     STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE;
  209.     STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE;
  210.     STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE;
  211.     STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE;
  212.     STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE;
  213.     STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE;
  214.     STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE;
  215.     STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE;
  216.     STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE;
  217.     STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE;
  218.     STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE;
  219.     STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE;
  220.     STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE;
  221.     STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE;
  222.     STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  223.     STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE;
  224.     STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
  225.     STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
  226.     STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  227.     STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
  228.     STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  229.     STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
  230.     STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
  231.     STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
  232.     STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  233.     STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
  234.     STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  235.     STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
  236.     STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE;
  237.     STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE;
  238.     STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
  239.     STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
  240.     STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
  241.     STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
  242.  
  243.     //Set Range of an Array to pass to device
  244.     //Useful for sending only a subrange of an array down to the device
  245.     STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
  246.  
  247. };
  248.  
  249.  
  250. //----------------------------------------------------------------------------
  251. // ID3DXEffectStateManager:
  252. // ------------------------
  253. // This is a user implemented interface that can be used to manage device
  254. // state changes made by an Effect.
  255. //----------------------------------------------------------------------------
  256.  
  257. typedef interface ID3DXEffectStateManager ID3DXEffectStateManager;
  258. typedef interface ID3DXEffectStateManager *LPD3DXEFFECTSTATEMANAGER;
  259.  
  260. // {79AAB587-6DBC-4fa7-82DE-37FA1781C5CE}
  261. DEFINE_GUID(IID_ID3DXEffectStateManager,
  262. 0x79aab587, 0x6dbc, 0x4fa7, 0x82, 0xde, 0x37, 0xfa, 0x17, 0x81, 0xc5, 0xce);
  263.  
  264. #undef INTERFACE
  265. #define INTERFACE ID3DXEffectStateManager
  266.  
  267. DECLARE_INTERFACE_(ID3DXEffectStateManager, IUnknown)
  268. {
  269.     // The user must correctly implement QueryInterface, AddRef, and Release.
  270.  
  271.     // IUnknown
  272.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  273.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  274.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  275.  
  276.     // The following methods are called by the Effect when it wants to make
  277.     // the corresponding device call.  Note that:
  278.     // 1. Users manage the state and are therefore responsible for making the
  279.     //    the corresponding device calls themselves inside their callbacks.  
  280.     // 2. Effects pay attention to the return values of the callbacks, and so
  281.     //    users must pay attention to what they return in their callbacks.
  282.  
  283.     STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX *pMatrix) PURE;
  284.     STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9 *pMaterial) PURE;
  285.     STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9 *pLight) PURE;
  286.     STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE;
  287.     STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE;
  288.     STDMETHOD(SetTexture)(THIS_ DWORD Stage, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
  289.     STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE;
  290.     STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE;
  291.     STDMETHOD(SetNPatchMode)(THIS_ FLOAT NumSegments) PURE;
  292.     STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
  293.     STDMETHOD(SetVertexShader)(THIS_ LPDIRECT3DVERTEXSHADER9 pShader) PURE;
  294.     STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE;
  295.     STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE;
  296.     STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE;
  297.     STDMETHOD(SetPixelShader)(THIS_ LPDIRECT3DPIXELSHADER9 pShader) PURE;
  298.     STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT RegisterIndex, CONST FLOAT *pConstantData, UINT RegisterCount) PURE;
  299.     STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT RegisterIndex, CONST INT *pConstantData, UINT RegisterCount) PURE;
  300.     STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT RegisterIndex, CONST BOOL *pConstantData, UINT RegisterCount) PURE;
  301. };
  302.  
  303.  
  304. //////////////////////////////////////////////////////////////////////////////
  305. // ID3DXEffect ///////////////////////////////////////////////////////////////
  306. //////////////////////////////////////////////////////////////////////////////
  307.  
  308. typedef interface ID3DXEffect ID3DXEffect;
  309. typedef interface ID3DXEffect *LPD3DXEFFECT;
  310.  
  311. // {F6CEB4B3-4E4C-40dd-B883-8D8DE5EA0CD5}
  312. DEFINE_GUID(IID_ID3DXEffect,
  313. 0xf6ceb4b3, 0x4e4c, 0x40dd, 0xb8, 0x83, 0x8d, 0x8d, 0xe5, 0xea, 0xc, 0xd5);
  314.  
  315. #undef INTERFACE
  316. #define INTERFACE ID3DXEffect
  317.  
  318. DECLARE_INTERFACE_(ID3DXEffect, ID3DXBaseEffect)
  319. {
  320.     // ID3DXBaseEffect
  321.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  322.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  323.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  324.  
  325.     // Descs
  326.     STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
  327.     STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE;
  328.     STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  329.     STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE;
  330.     STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE;
  331.  
  332.     // Handle operations
  333.     STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
  334.     STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE;
  335.     STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
  336.     STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
  337.     STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
  338.     STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
  339.     STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE;
  340.     STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE;
  341.     STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
  342.     STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
  343.     STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE;
  344.     STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE;
  345.  
  346.     // Get/Set Parameters
  347.     STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE;
  348.     STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE;
  349.     STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE;
  350.     STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE;
  351.     STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE;
  352.     STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE;
  353.     STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE;
  354.     STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE;
  355.     STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE;
  356.     STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE;
  357.     STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE;
  358.     STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE;
  359.     STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE;
  360.     STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE;
  361.     STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE;
  362.     STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE;
  363.     STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  364.     STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE;
  365.     STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
  366.     STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
  367.     STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  368.     STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
  369.     STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  370.     STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
  371.     STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
  372.     STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
  373.     STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  374.     STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
  375.     STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  376.     STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
  377.     STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE;
  378.     STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE;
  379.     STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
  380.     STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
  381.     STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
  382.     STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
  383.  
  384.         //Set Range of an Array to pass to device
  385.         //Usefull for sending only a subrange of an array down to the device
  386.         STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
  387.         // ID3DXBaseEffect
  388.    
  389.    
  390.     // Pool
  391.     STDMETHOD(GetPool)(THIS_ LPD3DXEFFECTPOOL* ppPool) PURE;
  392.  
  393.     // Selecting and setting a technique
  394.     STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE hTechnique) PURE;
  395.     STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE;
  396.     STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE hTechnique) PURE;
  397.     STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE hTechnique, D3DXHANDLE *pTechnique) PURE;
  398.     STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE hParameter, D3DXHANDLE hTechnique) PURE;
  399.  
  400.     // Using current technique
  401.     // Begin           starts active technique
  402.     // BeginPass       begins a pass
  403.     // CommitChanges   updates changes to any set calls in the pass. This should be called before
  404.     //                 any DrawPrimitive call to d3d
  405.     // EndPass         ends a pass
  406.     // End             ends active technique
  407.     STDMETHOD(Begin)(THIS_ UINT *pPasses, DWORD Flags) PURE;
  408.     STDMETHOD(BeginPass)(THIS_ UINT Pass) PURE;
  409.     STDMETHOD(CommitChanges)(THIS) PURE;
  410.     STDMETHOD(EndPass)(THIS) PURE;
  411.     STDMETHOD(End)(THIS) PURE;
  412.  
  413.     // Managing D3D Device
  414.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  415.     STDMETHOD(OnLostDevice)(THIS) PURE;
  416.     STDMETHOD(OnResetDevice)(THIS) PURE;
  417.  
  418.     // Logging device calls
  419.     STDMETHOD(SetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER pManager) PURE;
  420.     STDMETHOD(GetStateManager)(THIS_ LPD3DXEFFECTSTATEMANAGER *ppManager) PURE;
  421.  
  422.     // Parameter blocks
  423.     STDMETHOD(BeginParameterBlock)(THIS) PURE;
  424.     STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE;
  425.     STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE;
  426.     STDMETHOD(DeleteParameterBlock)(THIS_ D3DXHANDLE hParameterBlock) PURE;
  427.  
  428.     // Cloning
  429.     STDMETHOD(CloneEffect)(THIS_ LPDIRECT3DDEVICE9 pDevice, LPD3DXEFFECT* ppEffect) PURE;
  430.    
  431.     // Fast path for setting variables directly in ID3DXEffect
  432.     STDMETHOD(SetRawValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT ByteOffset, UINT Bytes) PURE;
  433. };
  434.  
  435.  
  436. //////////////////////////////////////////////////////////////////////////////
  437. // ID3DXEffectCompiler ///////////////////////////////////////////////////////
  438. //////////////////////////////////////////////////////////////////////////////
  439.  
  440. typedef interface ID3DXEffectCompiler ID3DXEffectCompiler;
  441. typedef interface ID3DXEffectCompiler *LPD3DXEFFECTCOMPILER;
  442.  
  443. // {51B8A949-1A31-47e6-BEA0-4B30DB53F1E0}
  444. DEFINE_GUID(IID_ID3DXEffectCompiler,
  445. 0x51b8a949, 0x1a31, 0x47e6, 0xbe, 0xa0, 0x4b, 0x30, 0xdb, 0x53, 0xf1, 0xe0);
  446.  
  447.  
  448. #undef INTERFACE
  449. #define INTERFACE ID3DXEffectCompiler
  450.  
  451. DECLARE_INTERFACE_(ID3DXEffectCompiler, ID3DXBaseEffect)
  452. {
  453.     // ID3DXBaseEffect
  454.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  455.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  456.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  457.  
  458.     // Descs
  459.     STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* pDesc) PURE;
  460.     STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE hParameter, D3DXPARAMETER_DESC* pDesc) PURE;
  461.     STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE hTechnique, D3DXTECHNIQUE_DESC* pDesc) PURE;
  462.     STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE hPass, D3DXPASS_DESC* pDesc) PURE;
  463.     STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE hShader, D3DXFUNCTION_DESC* pDesc) PURE;
  464.  
  465.     // Handle operations
  466.     STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
  467.     STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE hParameter, LPCSTR pName) PURE;
  468.     STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE hParameter, LPCSTR pSemantic) PURE;
  469.     STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE hParameter, UINT Index) PURE;
  470.     STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT Index) PURE;
  471.     STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ LPCSTR pName) PURE;
  472.     STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE hTechnique, UINT Index) PURE;
  473.     STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE hTechnique, LPCSTR pName) PURE;
  474.     STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT Index) PURE;
  475.     STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ LPCSTR pName) PURE;
  476.     STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE hObject, UINT Index) PURE;
  477.     STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE hObject, LPCSTR pName) PURE;
  478.  
  479.     // Get/Set Parameters
  480.     STDMETHOD(SetValue)(THIS_ D3DXHANDLE hParameter, LPCVOID pData, UINT Bytes) PURE;
  481.     STDMETHOD(GetValue)(THIS_ D3DXHANDLE hParameter, LPVOID pData, UINT Bytes) PURE;
  482.     STDMETHOD(SetBool)(THIS_ D3DXHANDLE hParameter, BOOL b) PURE;
  483.     STDMETHOD(GetBool)(THIS_ D3DXHANDLE hParameter, BOOL* pb) PURE;
  484.     STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hParameter, CONST BOOL* pb, UINT Count) PURE;
  485.     STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE hParameter, BOOL* pb, UINT Count) PURE;
  486.     STDMETHOD(SetInt)(THIS_ D3DXHANDLE hParameter, INT n) PURE;
  487.     STDMETHOD(GetInt)(THIS_ D3DXHANDLE hParameter, INT* pn) PURE;
  488.     STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hParameter, CONST INT* pn, UINT Count) PURE;
  489.     STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE hParameter, INT* pn, UINT Count) PURE;
  490.     STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT f) PURE;
  491.     STDMETHOD(GetFloat)(THIS_ D3DXHANDLE hParameter, FLOAT* pf) PURE;
  492.     STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hParameter, CONST FLOAT* pf, UINT Count) PURE;
  493.     STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE hParameter, FLOAT* pf, UINT Count) PURE;
  494.     STDMETHOD(SetVector)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector) PURE;
  495.     STDMETHOD(GetVector)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector) PURE;
  496.     STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  497.     STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE hParameter, D3DXVECTOR4* pVector, UINT Count) PURE;
  498.     STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
  499.     STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
  500.     STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  501.     STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
  502.     STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  503.     STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
  504.     STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix) PURE;
  505.     STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix) PURE;
  506.     STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  507.     STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX* pMatrix, UINT Count) PURE;
  508.     STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  509.     STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hParameter, D3DXMATRIX** ppMatrix, UINT Count) PURE;
  510.     STDMETHOD(SetString)(THIS_ D3DXHANDLE hParameter, LPCSTR pString) PURE;
  511.     STDMETHOD(GetString)(THIS_ D3DXHANDLE hParameter, LPCSTR* ppString) PURE;
  512.     STDMETHOD(SetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 pTexture) PURE;
  513.     STDMETHOD(GetTexture)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DBASETEXTURE9 *ppTexture) PURE;
  514.     STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DPIXELSHADER9 *ppPShader) PURE;
  515.     STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE hParameter, LPDIRECT3DVERTEXSHADER9 *ppVShader) PURE;
  516.    
  517.         //Set Range of an Array to pass to device
  518.         //Usefull for sending only a subrange of an array down to the device
  519.         STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE hParameter, UINT uStart, UINT uEnd) PURE;
  520.         // ID3DXBaseEffect
  521.  
  522.     // Parameter sharing, specialization, and information
  523.     STDMETHOD(SetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL Literal) PURE;
  524.     STDMETHOD(GetLiteral)(THIS_ D3DXHANDLE hParameter, BOOL *pLiteral) PURE;
  525.  
  526.     // Compilation
  527.     STDMETHOD(CompileEffect)(THIS_ DWORD Flags,
  528.         LPD3DXBUFFER* ppEffect, LPD3DXBUFFER* ppErrorMsgs) PURE;
  529.  
  530.     STDMETHOD(CompileShader)(THIS_ D3DXHANDLE hFunction, LPCSTR pTarget, DWORD Flags,
  531.         LPD3DXBUFFER* ppShader, LPD3DXBUFFER* ppErrorMsgs, LPD3DXCONSTANTTABLE* ppConstantTable) PURE;
  532. };
  533.  
  534.  
  535. //////////////////////////////////////////////////////////////////////////////
  536. // APIs //////////////////////////////////////////////////////////////////////
  537. //////////////////////////////////////////////////////////////////////////////
  538.  
  539.  
  540. #ifdef __cplusplus
  541. extern "C" {
  542. #endif //__cplusplus
  543.  
  544. //----------------------------------------------------------------------------
  545. // D3DXCreateEffectPool:
  546. // ---------------------
  547. // Creates an effect pool.  Pools are used for sharing parameters between
  548. // multiple effects.  For all effects within a pool, shared parameters of the
  549. // same name all share the same value.
  550. //
  551. // Parameters:
  552. //  ppPool
  553. //      Returns the created pool.
  554. //----------------------------------------------------------------------------
  555.  
  556. HRESULT WINAPI
  557.     D3DXCreateEffectPool(
  558.         LPD3DXEFFECTPOOL*               ppPool);
  559.  
  560.  
  561. //----------------------------------------------------------------------------
  562. // D3DXCreateEffect:
  563. // -----------------
  564. // Creates an effect from an ascii or binary effect description.
  565. //
  566. // Parameters:
  567. //  pDevice
  568. //      Pointer of the device on which to create the effect
  569. //  pSrcFile
  570. //      Name of the file containing the effect description
  571. //  hSrcModule
  572. //      Module handle. if NULL, current module will be used.
  573. //  pSrcResource
  574. //      Resource name in module
  575. //  pSrcData
  576. //      Pointer to effect description
  577. //  SrcDataSize
  578. //      Size of the effect description in bytes
  579. //  pDefines
  580. //      Optional NULL-terminated array of preprocessor macro definitions.
  581. //  Flags
  582. //      See D3DXSHADER_xxx flags.
  583. //  pSkipConstants
  584. //      A list of semi-colon delimited variable names.  The effect will
  585. //      not set these variables to the device when they are referenced
  586. //      by a shader.  NOTE: the variables specified here must be
  587. //      register bound in the file and must not be used in expressions
  588. //      in passes or samplers or the file will not load.
  589. //  pInclude
  590. //      Optional interface pointer to use for handling #include directives.
  591. //      If this parameter is NULL, #includes will be honored when compiling
  592. //      from file, and will error when compiling from resource or memory.
  593. //  pPool
  594. //      Pointer to ID3DXEffectPool object to use for shared parameters.
  595. //      If NULL, no parameters will be shared.
  596. //  ppEffect
  597. //      Returns a buffer containing created effect.
  598. //  ppCompilationErrors
  599. //      Returns a buffer containing any error messages which occurred during
  600. //      compile.  Or NULL if you do not care about the error messages.
  601. //
  602. //----------------------------------------------------------------------------
  603.  
  604. HRESULT WINAPI
  605.     D3DXCreateEffectFromFileA(
  606.         LPDIRECT3DDEVICE9               pDevice,
  607.         LPCSTR                          pSrcFile,
  608.         CONST D3DXMACRO*                pDefines,
  609.         LPD3DXINCLUDE                   pInclude,
  610.         DWORD                           Flags,
  611.         LPD3DXEFFECTPOOL                pPool,
  612.         LPD3DXEFFECT*                   ppEffect,
  613.         LPD3DXBUFFER*                   ppCompilationErrors);
  614.  
  615. HRESULT WINAPI
  616.     D3DXCreateEffectFromFileW(
  617.         LPDIRECT3DDEVICE9               pDevice,
  618.         LPCWSTR                         pSrcFile,
  619.         CONST D3DXMACRO*                pDefines,
  620.         LPD3DXINCLUDE                   pInclude,
  621.         DWORD                           Flags,
  622.         LPD3DXEFFECTPOOL                pPool,
  623.         LPD3DXEFFECT*                   ppEffect,
  624.         LPD3DXBUFFER*                   ppCompilationErrors);
  625.  
  626. #ifdef UNICODE
  627. #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileW
  628. #else
  629. #define D3DXCreateEffectFromFile D3DXCreateEffectFromFileA
  630. #endif
  631.  
  632.  
  633. HRESULT WINAPI
  634.     D3DXCreateEffectFromResourceA(
  635.         LPDIRECT3DDEVICE9               pDevice,
  636.         HMODULE                         hSrcModule,
  637.         LPCSTR                          pSrcResource,
  638.         CONST D3DXMACRO*                pDefines,
  639.         LPD3DXINCLUDE                   pInclude,
  640.         DWORD                           Flags,
  641.         LPD3DXEFFECTPOOL                pPool,
  642.         LPD3DXEFFECT*                   ppEffect,
  643.         LPD3DXBUFFER*                   ppCompilationErrors);
  644.  
  645. HRESULT WINAPI
  646.     D3DXCreateEffectFromResourceW(
  647.         LPDIRECT3DDEVICE9               pDevice,
  648.         HMODULE                         hSrcModule,
  649.         LPCWSTR                         pSrcResource,
  650.         CONST D3DXMACRO*                pDefines,
  651.         LPD3DXINCLUDE                   pInclude,
  652.         DWORD                           Flags,
  653.         LPD3DXEFFECTPOOL                pPool,
  654.         LPD3DXEFFECT*                   ppEffect,
  655.         LPD3DXBUFFER*                   ppCompilationErrors);
  656.  
  657. #ifdef UNICODE
  658. #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceW
  659. #else
  660. #define D3DXCreateEffectFromResource D3DXCreateEffectFromResourceA
  661. #endif
  662.  
  663.  
  664. HRESULT WINAPI
  665.     D3DXCreateEffect(
  666.         LPDIRECT3DDEVICE9               pDevice,
  667.         LPCVOID                         pSrcData,
  668.         UINT                            SrcDataLen,
  669.         CONST D3DXMACRO*                pDefines,
  670.         LPD3DXINCLUDE                   pInclude,
  671.         DWORD                           Flags,
  672.         LPD3DXEFFECTPOOL                pPool,
  673.         LPD3DXEFFECT*                   ppEffect,
  674.         LPD3DXBUFFER*                   ppCompilationErrors);
  675.  
  676. //
  677. // Ex functions that accept pSkipConstants in addition to other parameters
  678. //
  679.  
  680. HRESULT WINAPI
  681.     D3DXCreateEffectFromFileExA(
  682.         LPDIRECT3DDEVICE9               pDevice,
  683.         LPCSTR                          pSrcFile,
  684.         CONST D3DXMACRO*                pDefines,
  685.         LPD3DXINCLUDE                   pInclude,
  686.         LPCSTR                          pSkipConstants,
  687.         DWORD                           Flags,
  688.         LPD3DXEFFECTPOOL                pPool,
  689.         LPD3DXEFFECT*                   ppEffect,
  690.         LPD3DXBUFFER*                   ppCompilationErrors);
  691.  
  692. HRESULT WINAPI
  693.     D3DXCreateEffectFromFileExW(
  694.         LPDIRECT3DDEVICE9               pDevice,
  695.         LPCWSTR                         pSrcFile,
  696.         CONST D3DXMACRO*                pDefines,
  697.         LPD3DXINCLUDE                   pInclude,
  698.         LPCSTR                          pSkipConstants,
  699.         DWORD                           Flags,
  700.         LPD3DXEFFECTPOOL                pPool,
  701.         LPD3DXEFFECT*                   ppEffect,
  702.         LPD3DXBUFFER*                   ppCompilationErrors);
  703.  
  704. #ifdef UNICODE
  705. #define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExW
  706. #else
  707. #define D3DXCreateEffectFromFileEx D3DXCreateEffectFromFileExA
  708. #endif
  709.  
  710.  
  711. HRESULT WINAPI
  712.     D3DXCreateEffectFromResourceExA(
  713.         LPDIRECT3DDEVICE9               pDevice,
  714.         HMODULE                         hSrcModule,
  715.         LPCSTR                          pSrcResource,
  716.         CONST D3DXMACRO*                pDefines,
  717.         LPD3DXINCLUDE                   pInclude,
  718.         LPCSTR                          pSkipConstants,
  719.         DWORD                           Flags,
  720.         LPD3DXEFFECTPOOL                pPool,
  721.         LPD3DXEFFECT*                   ppEffect,
  722.         LPD3DXBUFFER*                   ppCompilationErrors);
  723.  
  724. HRESULT WINAPI
  725.     D3DXCreateEffectFromResourceExW(
  726.         LPDIRECT3DDEVICE9               pDevice,
  727.         HMODULE                         hSrcModule,
  728.         LPCWSTR                         pSrcResource,
  729.         CONST D3DXMACRO*                pDefines,
  730.         LPD3DXINCLUDE                   pInclude,
  731.         LPCSTR                          pSkipConstants,
  732.         DWORD                           Flags,
  733.         LPD3DXEFFECTPOOL                pPool,
  734.         LPD3DXEFFECT*                   ppEffect,
  735.         LPD3DXBUFFER*                   ppCompilationErrors);
  736.  
  737. #ifdef UNICODE
  738. #define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExW
  739. #else
  740. #define D3DXCreateEffectFromResourceEx D3DXCreateEffectFromResourceExA
  741. #endif
  742.  
  743.  
  744. HRESULT WINAPI
  745.     D3DXCreateEffectEx(
  746.         LPDIRECT3DDEVICE9               pDevice,
  747.         LPCVOID                         pSrcData,
  748.         UINT                            SrcDataLen,
  749.         CONST D3DXMACRO*                pDefines,
  750.         LPD3DXINCLUDE                   pInclude,
  751.         LPCSTR                          pSkipConstants,
  752.         DWORD                           Flags,
  753.         LPD3DXEFFECTPOOL                pPool,
  754.         LPD3DXEFFECT*                   ppEffect,
  755.         LPD3DXBUFFER*                   ppCompilationErrors);
  756.  
  757. //----------------------------------------------------------------------------
  758. // D3DXCreateEffectCompiler:
  759. // -------------------------
  760. // Creates an effect from an ascii or binary effect description.
  761. //
  762. // Parameters:
  763. //  pSrcFile
  764. //      Name of the file containing the effect description
  765. //  hSrcModule
  766. //      Module handle. if NULL, current module will be used.
  767. //  pSrcResource
  768. //      Resource name in module
  769. //  pSrcData
  770. //      Pointer to effect description
  771. //  SrcDataSize
  772. //      Size of the effect description in bytes
  773. //  pDefines
  774. //      Optional NULL-terminated array of preprocessor macro definitions.
  775. //  pInclude
  776. //      Optional interface pointer to use for handling #include directives.
  777. //      If this parameter is NULL, #includes will be honored when compiling
  778. //      from file, and will error when compiling from resource or memory.
  779. //  pPool
  780. //      Pointer to ID3DXEffectPool object to use for shared parameters.
  781. //      If NULL, no parameters will be shared.
  782. //  ppCompiler
  783. //      Returns a buffer containing created effect compiler.
  784. //  ppParseErrors
  785. //      Returns a buffer containing any error messages which occurred during
  786. //      parse.  Or NULL if you do not care about the error messages.
  787. //
  788. //----------------------------------------------------------------------------
  789.  
  790. HRESULT WINAPI
  791.     D3DXCreateEffectCompilerFromFileA(
  792.         LPCSTR                          pSrcFile,
  793.         CONST D3DXMACRO*                pDefines,
  794.         LPD3DXINCLUDE                   pInclude,
  795.         DWORD                           Flags,
  796.         LPD3DXEFFECTCOMPILER*           ppCompiler,
  797.         LPD3DXBUFFER*                   ppParseErrors);
  798.  
  799. HRESULT WINAPI
  800.     D3DXCreateEffectCompilerFromFileW(
  801.         LPCWSTR                         pSrcFile,
  802.         CONST D3DXMACRO*                pDefines,
  803.         LPD3DXINCLUDE                   pInclude,
  804.         DWORD                           Flags,
  805.         LPD3DXEFFECTCOMPILER*           ppCompiler,
  806.         LPD3DXBUFFER*                   ppParseErrors);
  807.  
  808. #ifdef UNICODE
  809. #define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileW
  810. #else
  811. #define D3DXCreateEffectCompilerFromFile D3DXCreateEffectCompilerFromFileA
  812. #endif
  813.  
  814.  
  815. HRESULT WINAPI
  816.     D3DXCreateEffectCompilerFromResourceA(
  817.         HMODULE                         hSrcModule,
  818.         LPCSTR                          pSrcResource,
  819.         CONST D3DXMACRO*                pDefines,
  820.         LPD3DXINCLUDE                   pInclude,
  821.         DWORD                           Flags,
  822.         LPD3DXEFFECTCOMPILER*           ppCompiler,
  823.         LPD3DXBUFFER*                   ppParseErrors);
  824.  
  825. HRESULT WINAPI
  826.     D3DXCreateEffectCompilerFromResourceW(
  827.         HMODULE                         hSrcModule,
  828.         LPCWSTR                         pSrcResource,
  829.         CONST D3DXMACRO*                pDefines,
  830.         LPD3DXINCLUDE                   pInclude,
  831.         DWORD                           Flags,
  832.         LPD3DXEFFECTCOMPILER*           ppCompiler,
  833.         LPD3DXBUFFER*                   ppParseErrors);
  834.  
  835. #ifdef UNICODE
  836. #define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceW
  837. #else
  838. #define D3DXCreateEffectCompilerFromResource D3DXCreateEffectCompilerFromResourceA
  839. #endif
  840.  
  841.  
  842. HRESULT WINAPI
  843.     D3DXCreateEffectCompiler(
  844.         LPCSTR                          pSrcData,
  845.         UINT                            SrcDataLen,
  846.         CONST D3DXMACRO*                pDefines,
  847.         LPD3DXINCLUDE                   pInclude,
  848.         DWORD                           Flags,
  849.         LPD3DXEFFECTCOMPILER*           ppCompiler,
  850.         LPD3DXBUFFER*                   ppParseErrors);
  851.  
  852. //----------------------------------------------------------------------------
  853. // D3DXDisassembleEffect:
  854. // -----------------------
  855. //
  856. // Parameters:
  857. //----------------------------------------------------------------------------
  858.  
  859. HRESULT WINAPI
  860.     D3DXDisassembleEffect(
  861.         LPD3DXEFFECT pEffect,
  862.         BOOL EnableColorCode,
  863.         LPD3DXBUFFER *ppDisassembly);
  864.        
  865.  
  866.  
  867. #ifdef __cplusplus
  868. }
  869. #endif //__cplusplus
  870.  
  871. #endif //__D3DX9EFFECT_H__
  872.  
  873.  
  874.