Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1207 lines
45 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. // File: d3dx9shader.h
  6. // Content: D3DX Shader APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9. #include "d3dx9.h"
  10. #ifndef __D3DX9SHADER_H__
  11. #define __D3DX9SHADER_H__
  12. //---------------------------------------------------------------------------
  13. // D3DXTX_VERSION:
  14. // --------------
  15. // Version token used to create a procedural texture filler in effects
  16. // Used by D3DXFill[]TX functions
  17. //---------------------------------------------------------------------------
  18. #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
  19. //----------------------------------------------------------------------------
  20. // D3DXSHADER flags:
  21. // -----------------
  22. // D3DXSHADER_DEBUG
  23. // Insert debug file/line/type/symbol information.
  24. //
  25. // D3DXSHADER_SKIPVALIDATION
  26. // Do not validate the generated code against known capabilities and
  27. // constraints. This option is only recommended when compiling shaders
  28. // you KNOW will work. (ie. have compiled before without this option.)
  29. // Shaders are always validated by D3D before they are set to the device.
  30. //
  31. // D3DXSHADER_SKIPOPTIMIZATION
  32. // Instructs the compiler to skip optimization steps during code generation.
  33. // Unless you are trying to isolate a problem in your code using this option
  34. // is not recommended.
  35. //
  36. // D3DXSHADER_PACKMATRIX_ROWMAJOR
  37. // Unless explicitly specified, matrices will be packed in row-major order
  38. // on input and output from the shader.
  39. //
  40. // D3DXSHADER_PACKMATRIX_COLUMNMAJOR
  41. // Unless explicitly specified, matrices will be packed in column-major
  42. // order on input and output from the shader. This is generally more
  43. // efficient, since it allows vector-matrix multiplication to be performed
  44. // using a series of dot-products.
  45. //
  46. // D3DXSHADER_PARTIALPRECISION
  47. // Force all computations in resulting shader to occur at partial precision.
  48. // This may result in faster evaluation of shaders on some hardware.
  49. //
  50. // D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT
  51. // Force compiler to compile against the next highest available software
  52. // target for vertex shaders. This flag also turns optimizations off,
  53. // and debugging on.
  54. //
  55. // D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT
  56. // Force compiler to compile against the next highest available software
  57. // target for pixel shaders. This flag also turns optimizations off,
  58. // and debugging on.
  59. //
  60. // D3DXSHADER_NO_PRESHADER
  61. // Disables Preshaders. Using this flag will cause the compiler to not
  62. // pull out static expression for evaluation on the host cpu
  63. //
  64. // D3DXSHADER_AVOID_FLOW_CONTROL
  65. // Hint compiler to avoid flow-control constructs where possible.
  66. //
  67. // D3DXSHADER_PREFER_FLOW_CONTROL
  68. // Hint compiler to prefer flow-control constructs where possible.
  69. //
  70. //----------------------------------------------------------------------------
  71. #define D3DXSHADER_DEBUG (1 << 0)
  72. #define D3DXSHADER_SKIPVALIDATION (1 << 1)
  73. #define D3DXSHADER_SKIPOPTIMIZATION (1 << 2)
  74. #define D3DXSHADER_PACKMATRIX_ROWMAJOR (1 << 3)
  75. #define D3DXSHADER_PACKMATRIX_COLUMNMAJOR (1 << 4)
  76. #define D3DXSHADER_PARTIALPRECISION (1 << 5)
  77. #define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT (1 << 6)
  78. #define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT (1 << 7)
  79. #define D3DXSHADER_NO_PRESHADER (1 << 8)
  80. #define D3DXSHADER_AVOID_FLOW_CONTROL (1 << 9)
  81. #define D3DXSHADER_PREFER_FLOW_CONTROL (1 << 10)
  82. #define D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY (1 << 12)
  83. #define D3DXSHADER_IEEE_STRICTNESS (1 << 13)
  84. #define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL (1 << 16)
  85. // optimization level flags
  86. #define D3DXSHADER_OPTIMIZATION_LEVEL0 (1 << 14)
  87. #define D3DXSHADER_OPTIMIZATION_LEVEL1 0
  88. #define D3DXSHADER_OPTIMIZATION_LEVEL2 ((1 << 14) | (1 << 15))
  89. #define D3DXSHADER_OPTIMIZATION_LEVEL3 (1 << 15)
  90. //----------------------------------------------------------------------------
  91. // D3DXFRAGMENT flags:
  92. // -------------------
  93. #define D3DXFRAGMENT_LARGEADDRESSAWARE (1 << 17)
  94. //----------------------------------------------------------------------------
  95. // D3DXCONSTTABLE flags:
  96. // -------------------
  97. #define D3DXCONSTTABLE_LARGEADDRESSAWARE (1 << 17)
  98. //----------------------------------------------------------------------------
  99. // D3DXHANDLE:
  100. // -----------
  101. // Handle values used to efficiently reference shader and effect parameters.
  102. // Strings can be used as handles. However, handles are not always strings.
  103. //----------------------------------------------------------------------------
  104. #ifndef D3DXFX_LARGEADDRESS_HANDLE
  105. typedef LPCSTR D3DXHANDLE;
  106. #else
  107. typedef UINT_PTR D3DXHANDLE;
  108. #endif
  109. typedef D3DXHANDLE *LPD3DXHANDLE;
  110. //----------------------------------------------------------------------------
  111. // D3DXMACRO:
  112. // ----------
  113. // Preprocessor macro definition. The application pass in a NULL-terminated
  114. // array of this structure to various D3DX APIs. This enables the application
  115. // to #define tokens at runtime, before the file is parsed.
  116. //----------------------------------------------------------------------------
  117. typedef struct _D3DXMACRO
  118. {
  119. LPCSTR Name;
  120. LPCSTR Definition;
  121. } D3DXMACRO, *LPD3DXMACRO;
  122. //----------------------------------------------------------------------------
  123. // D3DXSEMANTIC:
  124. //----------------------------------------------------------------------------
  125. typedef struct _D3DXSEMANTIC
  126. {
  127. UINT Usage;
  128. UINT UsageIndex;
  129. } D3DXSEMANTIC, *LPD3DXSEMANTIC;
  130. //----------------------------------------------------------------------------
  131. // D3DXFRAGMENT_DESC:
  132. //----------------------------------------------------------------------------
  133. typedef struct _D3DXFRAGMENT_DESC
  134. {
  135. LPCSTR Name;
  136. DWORD Target;
  137. } D3DXFRAGMENT_DESC, *LPD3DXFRAGMENT_DESC;
  138. //----------------------------------------------------------------------------
  139. // D3DXREGISTER_SET:
  140. //----------------------------------------------------------------------------
  141. typedef enum _D3DXREGISTER_SET
  142. {
  143. D3DXRS_BOOL,
  144. D3DXRS_INT4,
  145. D3DXRS_FLOAT4,
  146. D3DXRS_SAMPLER,
  147. // force 32-bit size enum
  148. D3DXRS_FORCE_DWORD = 0x7fffffff
  149. } D3DXREGISTER_SET, *LPD3DXREGISTER_SET;
  150. //----------------------------------------------------------------------------
  151. // D3DXPARAMETER_CLASS:
  152. //----------------------------------------------------------------------------
  153. typedef enum _D3DXPARAMETER_CLASS
  154. {
  155. D3DXPC_SCALAR,
  156. D3DXPC_VECTOR,
  157. D3DXPC_MATRIX_ROWS,
  158. D3DXPC_MATRIX_COLUMNS,
  159. D3DXPC_OBJECT,
  160. D3DXPC_STRUCT,
  161. // force 32-bit size enum
  162. D3DXPC_FORCE_DWORD = 0x7fffffff
  163. } D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS;
  164. //----------------------------------------------------------------------------
  165. // D3DXPARAMETER_TYPE:
  166. //----------------------------------------------------------------------------
  167. typedef enum _D3DXPARAMETER_TYPE
  168. {
  169. D3DXPT_VOID,
  170. D3DXPT_BOOL,
  171. D3DXPT_INT,
  172. D3DXPT_FLOAT,
  173. D3DXPT_STRING,
  174. D3DXPT_TEXTURE,
  175. D3DXPT_TEXTURE1D,
  176. D3DXPT_TEXTURE2D,
  177. D3DXPT_TEXTURE3D,
  178. D3DXPT_TEXTURECUBE,
  179. D3DXPT_SAMPLER,
  180. D3DXPT_SAMPLER1D,
  181. D3DXPT_SAMPLER2D,
  182. D3DXPT_SAMPLER3D,
  183. D3DXPT_SAMPLERCUBE,
  184. D3DXPT_PIXELSHADER,
  185. D3DXPT_VERTEXSHADER,
  186. D3DXPT_PIXELFRAGMENT,
  187. D3DXPT_VERTEXFRAGMENT,
  188. D3DXPT_UNSUPPORTED,
  189. // force 32-bit size enum
  190. D3DXPT_FORCE_DWORD = 0x7fffffff
  191. } D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE;
  192. //----------------------------------------------------------------------------
  193. // D3DXCONSTANTTABLE_DESC:
  194. //----------------------------------------------------------------------------
  195. typedef struct _D3DXCONSTANTTABLE_DESC
  196. {
  197. LPCSTR Creator; // Creator string
  198. DWORD Version; // Shader version
  199. UINT Constants; // Number of constants
  200. } D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC;
  201. //----------------------------------------------------------------------------
  202. // D3DXCONSTANT_DESC:
  203. //----------------------------------------------------------------------------
  204. typedef struct _D3DXCONSTANT_DESC
  205. {
  206. LPCSTR Name; // Constant name
  207. D3DXREGISTER_SET RegisterSet; // Register set
  208. UINT RegisterIndex; // Register index
  209. UINT RegisterCount; // Number of registers occupied
  210. D3DXPARAMETER_CLASS Class; // Class
  211. D3DXPARAMETER_TYPE Type; // Component type
  212. UINT Rows; // Number of rows
  213. UINT Columns; // Number of columns
  214. UINT Elements; // Number of array elements
  215. UINT StructMembers; // Number of structure member sub-parameters
  216. UINT Bytes; // Data size, in bytes
  217. LPCVOID DefaultValue; // Pointer to default value
  218. } D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC;
  219. //----------------------------------------------------------------------------
  220. // ID3DXConstantTable:
  221. //----------------------------------------------------------------------------
  222. typedef interface ID3DXConstantTable ID3DXConstantTable;
  223. typedef interface ID3DXConstantTable *LPD3DXCONSTANTTABLE;
  224. // {AB3C758F-093E-4356-B762-4DB18F1B3A01}
  225. DEFINE_GUID(IID_ID3DXConstantTable,
  226. 0xab3c758f, 0x93e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x1);
  227. #undef INTERFACE
  228. #define INTERFACE ID3DXConstantTable
  229. DECLARE_INTERFACE_(ID3DXConstantTable, IUnknown)
  230. {
  231. // IUnknown
  232. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  233. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  234. STDMETHOD_(ULONG, Release)(THIS) PURE;
  235. // Buffer
  236. STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
  237. STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
  238. // Descs
  239. STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE;
  240. STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE;
  241. STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE;
  242. // Handle operations
  243. STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  244. STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE;
  245. STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  246. // Set Constants
  247. STDMETHOD(SetDefaults)(THIS_ LPDIRECT3DDEVICE9 pDevice) PURE;
  248. STDMETHOD(SetValue)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE;
  249. STDMETHOD(SetBool)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, BOOL b) PURE;
  250. STDMETHOD(SetBoolArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE;
  251. STDMETHOD(SetInt)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, INT n) PURE;
  252. STDMETHOD(SetIntArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE;
  253. STDMETHOD(SetFloat)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, FLOAT f) PURE;
  254. STDMETHOD(SetFloatArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE;
  255. STDMETHOD(SetVector)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE;
  256. STDMETHOD(SetVectorArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  257. STDMETHOD(SetMatrix)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  258. STDMETHOD(SetMatrixArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  259. STDMETHOD(SetMatrixPointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  260. STDMETHOD(SetMatrixTranspose)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  261. STDMETHOD(SetMatrixTransposeArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  262. STDMETHOD(SetMatrixTransposePointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  263. };
  264. //----------------------------------------------------------------------------
  265. // ID3DXTextureShader:
  266. //----------------------------------------------------------------------------
  267. typedef interface ID3DXTextureShader ID3DXTextureShader;
  268. typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER;
  269. // {3E3D67F8-AA7A-405d-A857-BA01D4758426}
  270. DEFINE_GUID(IID_ID3DXTextureShader,
  271. 0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26);
  272. #undef INTERFACE
  273. #define INTERFACE ID3DXTextureShader
  274. DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown)
  275. {
  276. // IUnknown
  277. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  278. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  279. STDMETHOD_(ULONG, Release)(THIS) PURE;
  280. // Gets
  281. STDMETHOD(GetFunction)(THIS_ LPD3DXBUFFER *ppFunction) PURE;
  282. STDMETHOD(GetConstantBuffer)(THIS_ LPD3DXBUFFER *ppConstantBuffer) PURE;
  283. // Descs
  284. STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE;
  285. STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE;
  286. // Handle operations
  287. STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  288. STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE;
  289. STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  290. // Set Constants
  291. STDMETHOD(SetDefaults)(THIS) PURE;
  292. STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE;
  293. STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE;
  294. STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE;
  295. STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE;
  296. STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE;
  297. STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE;
  298. STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE;
  299. STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE;
  300. STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  301. STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  302. STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  303. STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  304. STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  305. STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  306. STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  307. };
  308. //----------------------------------------------------------------------------
  309. // ID3DXFragmentLinker
  310. //----------------------------------------------------------------------------
  311. typedef interface ID3DXFragmentLinker ID3DXFragmentLinker;
  312. typedef interface ID3DXFragmentLinker *LPD3DXFRAGMENTLINKER;
  313. // {1A2C0CC2-E5B6-4ebc-9E8D-390E057811B6}
  314. DEFINE_GUID(IID_ID3DXFragmentLinker,
  315. 0x1a2c0cc2, 0xe5b6, 0x4ebc, 0x9e, 0x8d, 0x39, 0xe, 0x5, 0x78, 0x11, 0xb6);
  316. #undef INTERFACE
  317. #define INTERFACE ID3DXFragmentLinker
  318. DECLARE_INTERFACE_(ID3DXFragmentLinker, IUnknown)
  319. {
  320. // IUnknown
  321. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  322. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  323. STDMETHOD_(ULONG, Release)(THIS) PURE;
  324. // ID3DXFragmentLinker
  325. // fragment access and information retrieval functions
  326. STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  327. STDMETHOD_(UINT, GetNumberOfFragments)(THIS) PURE;
  328. STDMETHOD_(D3DXHANDLE, GetFragmentHandleByIndex)(THIS_ UINT Index) PURE;
  329. STDMETHOD_(D3DXHANDLE, GetFragmentHandleByName)(THIS_ LPCSTR Name) PURE;
  330. STDMETHOD(GetFragmentDesc)(THIS_ D3DXHANDLE Name, LPD3DXFRAGMENT_DESC FragDesc) PURE;
  331. // add the fragments in the buffer to the linker
  332. STDMETHOD(AddFragments)(THIS_ CONST DWORD *Fragments) PURE;
  333. // Create a buffer containing the fragments. Suitable for saving to disk
  334. STDMETHOD(GetAllFragments)(THIS_ LPD3DXBUFFER *ppBuffer) PURE;
  335. STDMETHOD(GetFragment)(THIS_ D3DXHANDLE Name, LPD3DXBUFFER *ppBuffer) PURE;
  336. STDMETHOD(LinkShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPD3DXBUFFER *ppBuffer, LPD3DXBUFFER *ppErrorMsgs) PURE;
  337. STDMETHOD(LinkVertexShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DVERTEXSHADER9 *pVShader, LPD3DXBUFFER *ppErrorMsgs) PURE;
  338. STDMETHOD(LinkPixelShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DPIXELSHADER9 *pPShader, LPD3DXBUFFER *ppErrorMsgs) PURE;
  339. STDMETHOD(ClearCache)(THIS) PURE;
  340. };
  341. //----------------------------------------------------------------------------
  342. // D3DXINCLUDE_TYPE:
  343. //----------------------------------------------------------------------------
  344. typedef enum _D3DXINCLUDE_TYPE
  345. {
  346. D3DXINC_LOCAL,
  347. D3DXINC_SYSTEM,
  348. // force 32-bit size enum
  349. D3DXINC_FORCE_DWORD = 0x7fffffff
  350. } D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE;
  351. //----------------------------------------------------------------------------
  352. // ID3DXInclude:
  353. // -------------
  354. // This interface is intended to be implemented by the application, and can
  355. // be used by various D3DX APIs. This enables application-specific handling
  356. // of #include directives in source files.
  357. //
  358. // Open()
  359. // Opens an include file. If successful, it should fill in ppData and
  360. // pBytes. The data pointer returned must remain valid until Close is
  361. // subsequently called. The name of the file is encoded in UTF-8 format.
  362. // Close()
  363. // Closes an include file. If Open was successful, Close is guaranteed
  364. // to be called before the API using this interface returns.
  365. //----------------------------------------------------------------------------
  366. typedef interface ID3DXInclude ID3DXInclude;
  367. typedef interface ID3DXInclude *LPD3DXINCLUDE;
  368. #undef INTERFACE
  369. #define INTERFACE ID3DXInclude
  370. DECLARE_INTERFACE(ID3DXInclude)
  371. {
  372. STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
  373. STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
  374. };
  375. //////////////////////////////////////////////////////////////////////////////
  376. // APIs //////////////////////////////////////////////////////////////////////
  377. //////////////////////////////////////////////////////////////////////////////
  378. #ifdef __cplusplus
  379. extern "C" {
  380. #endif //__cplusplus
  381. //----------------------------------------------------------------------------
  382. // D3DXAssembleShader:
  383. // -------------------
  384. // Assembles a shader.
  385. //
  386. // Parameters:
  387. // pSrcFile
  388. // Source file name
  389. // hSrcModule
  390. // Module handle. if NULL, current module will be used
  391. // pSrcResource
  392. // Resource name in module
  393. // pSrcData
  394. // Pointer to source code
  395. // SrcDataLen
  396. // Size of source code, in bytes
  397. // pDefines
  398. // Optional NULL-terminated array of preprocessor macro definitions.
  399. // pInclude
  400. // Optional interface pointer to use for handling #include directives.
  401. // If this parameter is NULL, #includes will be honored when assembling
  402. // from file, and will error when assembling from resource or memory.
  403. // Flags
  404. // See D3DXSHADER_xxx flags
  405. // ppShader
  406. // Returns a buffer containing the created shader. This buffer contains
  407. // the assembled shader code, as well as any embedded debug info.
  408. // ppErrorMsgs
  409. // Returns a buffer containing a listing of errors and warnings that were
  410. // encountered during assembly. If you are running in a debugger,
  411. // these are the same messages you will see in your debug output.
  412. //----------------------------------------------------------------------------
  413. HRESULT WINAPI
  414. D3DXAssembleShaderFromFileA(
  415. LPCSTR pSrcFile,
  416. CONST D3DXMACRO* pDefines,
  417. LPD3DXINCLUDE pInclude,
  418. DWORD Flags,
  419. LPD3DXBUFFER* ppShader,
  420. LPD3DXBUFFER* ppErrorMsgs);
  421. HRESULT WINAPI
  422. D3DXAssembleShaderFromFileW(
  423. LPCWSTR pSrcFile,
  424. CONST D3DXMACRO* pDefines,
  425. LPD3DXINCLUDE pInclude,
  426. DWORD Flags,
  427. LPD3DXBUFFER* ppShader,
  428. LPD3DXBUFFER* ppErrorMsgs);
  429. #ifdef UNICODE
  430. #define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW
  431. #else
  432. #define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA
  433. #endif
  434. HRESULT WINAPI
  435. D3DXAssembleShaderFromResourceA(
  436. HMODULE hSrcModule,
  437. LPCSTR pSrcResource,
  438. CONST D3DXMACRO* pDefines,
  439. LPD3DXINCLUDE pInclude,
  440. DWORD Flags,
  441. LPD3DXBUFFER* ppShader,
  442. LPD3DXBUFFER* ppErrorMsgs);
  443. HRESULT WINAPI
  444. D3DXAssembleShaderFromResourceW(
  445. HMODULE hSrcModule,
  446. LPCWSTR pSrcResource,
  447. CONST D3DXMACRO* pDefines,
  448. LPD3DXINCLUDE pInclude,
  449. DWORD Flags,
  450. LPD3DXBUFFER* ppShader,
  451. LPD3DXBUFFER* ppErrorMsgs);
  452. #ifdef UNICODE
  453. #define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW
  454. #else
  455. #define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA
  456. #endif
  457. HRESULT WINAPI
  458. D3DXAssembleShader(
  459. LPCSTR pSrcData,
  460. UINT SrcDataLen,
  461. CONST D3DXMACRO* pDefines,
  462. LPD3DXINCLUDE pInclude,
  463. DWORD Flags,
  464. LPD3DXBUFFER* ppShader,
  465. LPD3DXBUFFER* ppErrorMsgs);
  466. //----------------------------------------------------------------------------
  467. // D3DXCompileShader:
  468. // ------------------
  469. // Compiles a shader.
  470. //
  471. // Parameters:
  472. // pSrcFile
  473. // Source file name.
  474. // hSrcModule
  475. // Module handle. if NULL, current module will be used.
  476. // pSrcResource
  477. // Resource name in module.
  478. // pSrcData
  479. // Pointer to source code.
  480. // SrcDataLen
  481. // Size of source code, in bytes.
  482. // pDefines
  483. // Optional NULL-terminated array of preprocessor macro definitions.
  484. // pInclude
  485. // Optional interface pointer to use for handling #include directives.
  486. // If this parameter is NULL, #includes will be honored when compiling
  487. // from file, and will error when compiling from resource or memory.
  488. // pFunctionName
  489. // Name of the entrypoint function where execution should begin.
  490. // pProfile
  491. // Instruction set to be used when generating code. Currently supported
  492. // profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1",
  493. // "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0"
  494. // Flags
  495. // See D3DXSHADER_xxx flags.
  496. // ppShader
  497. // Returns a buffer containing the created shader. This buffer contains
  498. // the compiled shader code, as well as any embedded debug and symbol
  499. // table info. (See D3DXGetShaderConstantTable)
  500. // ppErrorMsgs
  501. // Returns a buffer containing a listing of errors and warnings that were
  502. // encountered during the compile. If you are running in a debugger,
  503. // these are the same messages you will see in your debug output.
  504. // ppConstantTable
  505. // Returns a ID3DXConstantTable object which can be used to set
  506. // shader constants to the device. Alternatively, an application can
  507. // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
  508. // the shader.
  509. //----------------------------------------------------------------------------
  510. HRESULT WINAPI
  511. D3DXCompileShaderFromFileA(
  512. LPCSTR pSrcFile,
  513. CONST D3DXMACRO* pDefines,
  514. LPD3DXINCLUDE pInclude,
  515. LPCSTR pFunctionName,
  516. LPCSTR pProfile,
  517. DWORD Flags,
  518. LPD3DXBUFFER* ppShader,
  519. LPD3DXBUFFER* ppErrorMsgs,
  520. LPD3DXCONSTANTTABLE* ppConstantTable);
  521. HRESULT WINAPI
  522. D3DXCompileShaderFromFileW(
  523. LPCWSTR pSrcFile,
  524. CONST D3DXMACRO* pDefines,
  525. LPD3DXINCLUDE pInclude,
  526. LPCSTR pFunctionName,
  527. LPCSTR pProfile,
  528. DWORD Flags,
  529. LPD3DXBUFFER* ppShader,
  530. LPD3DXBUFFER* ppErrorMsgs,
  531. LPD3DXCONSTANTTABLE* ppConstantTable);
  532. #ifdef UNICODE
  533. #define D3DXCompileShaderFromFile D3DXCompileShaderFromFileW
  534. #else
  535. #define D3DXCompileShaderFromFile D3DXCompileShaderFromFileA
  536. #endif
  537. HRESULT WINAPI
  538. D3DXCompileShaderFromResourceA(
  539. HMODULE hSrcModule,
  540. LPCSTR pSrcResource,
  541. CONST D3DXMACRO* pDefines,
  542. LPD3DXINCLUDE pInclude,
  543. LPCSTR pFunctionName,
  544. LPCSTR pProfile,
  545. DWORD Flags,
  546. LPD3DXBUFFER* ppShader,
  547. LPD3DXBUFFER* ppErrorMsgs,
  548. LPD3DXCONSTANTTABLE* ppConstantTable);
  549. HRESULT WINAPI
  550. D3DXCompileShaderFromResourceW(
  551. HMODULE hSrcModule,
  552. LPCWSTR pSrcResource,
  553. CONST D3DXMACRO* pDefines,
  554. LPD3DXINCLUDE pInclude,
  555. LPCSTR pFunctionName,
  556. LPCSTR pProfile,
  557. DWORD Flags,
  558. LPD3DXBUFFER* ppShader,
  559. LPD3DXBUFFER* ppErrorMsgs,
  560. LPD3DXCONSTANTTABLE* ppConstantTable);
  561. #ifdef UNICODE
  562. #define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceW
  563. #else
  564. #define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceA
  565. #endif
  566. HRESULT WINAPI
  567. D3DXCompileShader(
  568. LPCSTR pSrcData,
  569. UINT SrcDataLen,
  570. CONST D3DXMACRO* pDefines,
  571. LPD3DXINCLUDE pInclude,
  572. LPCSTR pFunctionName,
  573. LPCSTR pProfile,
  574. DWORD Flags,
  575. LPD3DXBUFFER* ppShader,
  576. LPD3DXBUFFER* ppErrorMsgs,
  577. LPD3DXCONSTANTTABLE* ppConstantTable);
  578. //----------------------------------------------------------------------------
  579. // D3DXDisassembleShader:
  580. // ----------------------
  581. // Takes a binary shader, and returns a buffer containing text assembly.
  582. //
  583. // Parameters:
  584. // pShader
  585. // Pointer to the shader byte code.
  586. // ShaderSizeInBytes
  587. // Size of the shader byte code in bytes.
  588. // EnableColorCode
  589. // Emit HTML tags for color coding the output?
  590. // pComments
  591. // Pointer to a comment string to include at the top of the shader.
  592. // ppDisassembly
  593. // Returns a buffer containing the disassembled shader.
  594. //----------------------------------------------------------------------------
  595. HRESULT WINAPI
  596. D3DXDisassembleShader(
  597. CONST DWORD* pShader,
  598. BOOL EnableColorCode,
  599. LPCSTR pComments,
  600. LPD3DXBUFFER* ppDisassembly);
  601. //----------------------------------------------------------------------------
  602. // D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile:
  603. // -----------------------------------------------------
  604. // Returns the name of the HLSL profile best suited to a given device.
  605. //
  606. // Parameters:
  607. // pDevice
  608. // Pointer to the device in question
  609. //----------------------------------------------------------------------------
  610. LPCSTR WINAPI
  611. D3DXGetPixelShaderProfile(
  612. LPDIRECT3DDEVICE9 pDevice);
  613. LPCSTR WINAPI
  614. D3DXGetVertexShaderProfile(
  615. LPDIRECT3DDEVICE9 pDevice);
  616. //----------------------------------------------------------------------------
  617. // D3DXFindShaderComment:
  618. // ----------------------
  619. // Searches through a shader for a particular comment, denoted by a FourCC in
  620. // the first DWORD of the comment. If the comment is not found, and no other
  621. // error has occurred, S_FALSE is returned.
  622. //
  623. // Parameters:
  624. // pFunction
  625. // Pointer to the function DWORD stream
  626. // FourCC
  627. // FourCC used to identify the desired comment block.
  628. // ppData
  629. // Returns a pointer to the comment data (not including comment token
  630. // and FourCC). Can be NULL.
  631. // pSizeInBytes
  632. // Returns the size of the comment data in bytes. Can be NULL.
  633. //----------------------------------------------------------------------------
  634. HRESULT WINAPI
  635. D3DXFindShaderComment(
  636. CONST DWORD* pFunction,
  637. DWORD FourCC,
  638. LPCVOID* ppData,
  639. UINT* pSizeInBytes);
  640. //----------------------------------------------------------------------------
  641. // D3DXGetShaderSize:
  642. // ------------------
  643. // Returns the size of the shader byte-code, in bytes.
  644. //
  645. // Parameters:
  646. // pFunction
  647. // Pointer to the function DWORD stream
  648. //----------------------------------------------------------------------------
  649. UINT WINAPI
  650. D3DXGetShaderSize(
  651. CONST DWORD* pFunction);
  652. //----------------------------------------------------------------------------
  653. // D3DXGetShaderVersion:
  654. // -----------------------
  655. // Returns the shader version of a given shader. Returns zero if the shader
  656. // function is NULL.
  657. //
  658. // Parameters:
  659. // pFunction
  660. // Pointer to the function DWORD stream
  661. //----------------------------------------------------------------------------
  662. DWORD WINAPI
  663. D3DXGetShaderVersion(
  664. CONST DWORD* pFunction);
  665. //----------------------------------------------------------------------------
  666. // D3DXGetShaderSemantics:
  667. // -----------------------
  668. // Gets semantics for all input elements referenced inside a given shader.
  669. //
  670. // Parameters:
  671. // pFunction
  672. // Pointer to the function DWORD stream
  673. // pSemantics
  674. // Pointer to an array of D3DXSEMANTIC structures. The function will
  675. // fill this array with the semantics for each input element referenced
  676. // inside the shader. This array is assumed to contain at least
  677. // MAXD3DDECLLENGTH elements.
  678. // pCount
  679. // Returns the number of elements referenced by the shader
  680. //----------------------------------------------------------------------------
  681. HRESULT WINAPI
  682. D3DXGetShaderInputSemantics(
  683. CONST DWORD* pFunction,
  684. D3DXSEMANTIC* pSemantics,
  685. UINT* pCount);
  686. HRESULT WINAPI
  687. D3DXGetShaderOutputSemantics(
  688. CONST DWORD* pFunction,
  689. D3DXSEMANTIC* pSemantics,
  690. UINT* pCount);
  691. //----------------------------------------------------------------------------
  692. // D3DXGetShaderSamplers:
  693. // ----------------------
  694. // Gets semantics for all input elements referenced inside a given shader.
  695. //
  696. // pFunction
  697. // Pointer to the function DWORD stream
  698. // pSamplers
  699. // Pointer to an array of LPCSTRs. The function will fill this array
  700. // with pointers to the sampler names contained within pFunction, for
  701. // each sampler referenced inside the shader. This array is assumed to
  702. // contain at least 16 elements.
  703. // pCount
  704. // Returns the number of samplers referenced by the shader
  705. //----------------------------------------------------------------------------
  706. HRESULT WINAPI
  707. D3DXGetShaderSamplers(
  708. CONST DWORD* pFunction,
  709. LPCSTR* pSamplers,
  710. UINT* pCount);
  711. //----------------------------------------------------------------------------
  712. // D3DXGetShaderConstantTable:
  713. // ---------------------------
  714. // Gets shader constant table embedded inside shader. A constant table is
  715. // generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in
  716. // the body of the shader.
  717. //
  718. // Parameters:
  719. // pFunction
  720. // Pointer to the function DWORD stream
  721. // Flags
  722. // See D3DXCONSTTABLE_xxx
  723. // ppConstantTable
  724. // Returns a ID3DXConstantTable object which can be used to set
  725. // shader constants to the device. Alternatively, an application can
  726. // parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
  727. // the shader.
  728. //----------------------------------------------------------------------------
  729. HRESULT WINAPI
  730. D3DXGetShaderConstantTable(
  731. CONST DWORD* pFunction,
  732. LPD3DXCONSTANTTABLE* ppConstantTable);
  733. HRESULT WINAPI
  734. D3DXGetShaderConstantTableEx(
  735. CONST DWORD* pFunction,
  736. DWORD Flags,
  737. LPD3DXCONSTANTTABLE* ppConstantTable);
  738. //----------------------------------------------------------------------------
  739. // D3DXCreateTextureShader:
  740. // ------------------------
  741. // Creates a texture shader object, given the compiled shader.
  742. //
  743. // Parameters
  744. // pFunction
  745. // Pointer to the function DWORD stream
  746. // ppTextureShader
  747. // Returns a ID3DXTextureShader object which can be used to procedurally
  748. // fill the contents of a texture using the D3DXFillTextureTX functions.
  749. //----------------------------------------------------------------------------
  750. HRESULT WINAPI
  751. D3DXCreateTextureShader(
  752. CONST DWORD* pFunction,
  753. LPD3DXTEXTURESHADER* ppTextureShader);
  754. //----------------------------------------------------------------------------
  755. // D3DXGatherFragments:
  756. // -------------------
  757. // Assembles shader fragments into a buffer to be passed to a fragment linker.
  758. // will generate shader fragments for all fragments in the file
  759. //
  760. // Parameters:
  761. // pSrcFile
  762. // Source file name
  763. // hSrcModule
  764. // Module handle. if NULL, current module will be used
  765. // pSrcResource
  766. // Resource name in module
  767. // pSrcData
  768. // Pointer to source code
  769. // SrcDataLen
  770. // Size of source code, in bytes
  771. // pDefines
  772. // Optional NULL-terminated array of preprocessor macro definitions.
  773. // pInclude
  774. // Optional interface pointer to use for handling #include directives.
  775. // If this parameter is NULL, #includes will be honored when assembling
  776. // from file, and will error when assembling from resource or memory.
  777. // Flags
  778. // See D3DXSHADER_xxx flags
  779. // ppShader
  780. // Returns a buffer containing the created shader fragments. This buffer contains
  781. // the assembled shader code, as well as any embedded debug info.
  782. // ppErrorMsgs
  783. // Returns a buffer containing a listing of errors and warnings that were
  784. // encountered during assembly. If you are running in a debugger,
  785. // these are the same messages you will see in your debug output.
  786. //----------------------------------------------------------------------------
  787. DECLSPEC_DEPRECATED HRESULT WINAPI
  788. D3DXGatherFragmentsFromFileA(
  789. LPCSTR pSrcFile,
  790. CONST D3DXMACRO* pDefines,
  791. LPD3DXINCLUDE pInclude,
  792. DWORD Flags,
  793. LPD3DXBUFFER* ppShader,
  794. LPD3DXBUFFER* ppErrorMsgs);
  795. DECLSPEC_DEPRECATED HRESULT WINAPI
  796. D3DXGatherFragmentsFromFileW(
  797. LPCWSTR pSrcFile,
  798. CONST D3DXMACRO* pDefines,
  799. LPD3DXINCLUDE pInclude,
  800. DWORD Flags,
  801. LPD3DXBUFFER* ppShader,
  802. LPD3DXBUFFER* ppErrorMsgs);
  803. #ifdef UNICODE
  804. #define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileW
  805. #else
  806. #define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileA
  807. #endif
  808. DECLSPEC_DEPRECATED HRESULT WINAPI
  809. D3DXGatherFragmentsFromResourceA(
  810. HMODULE hSrcModule,
  811. LPCSTR pSrcResource,
  812. CONST D3DXMACRO* pDefines,
  813. LPD3DXINCLUDE pInclude,
  814. DWORD Flags,
  815. LPD3DXBUFFER* ppShader,
  816. LPD3DXBUFFER* ppErrorMsgs);
  817. DECLSPEC_DEPRECATED HRESULT WINAPI
  818. D3DXGatherFragmentsFromResourceW(
  819. HMODULE hSrcModule,
  820. LPCWSTR pSrcResource,
  821. CONST D3DXMACRO* pDefines,
  822. LPD3DXINCLUDE pInclude,
  823. DWORD Flags,
  824. LPD3DXBUFFER* ppShader,
  825. LPD3DXBUFFER* ppErrorMsgs);
  826. #ifdef UNICODE
  827. #define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceW
  828. #else
  829. #define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceA
  830. #endif
  831. DECLSPEC_DEPRECATED HRESULT WINAPI
  832. D3DXGatherFragments(
  833. LPCSTR pSrcData,
  834. UINT SrcDataLen,
  835. CONST D3DXMACRO* pDefines,
  836. LPD3DXINCLUDE pInclude,
  837. DWORD Flags,
  838. LPD3DXBUFFER* ppShader,
  839. LPD3DXBUFFER* ppErrorMsgs);
  840. //----------------------------------------------------------------------------
  841. // D3DXCreateFragmentLinker:
  842. // -------------------------
  843. // Creates a fragment linker with a given cache size. The interface returned
  844. // can be used to link together shader fragments. (both HLSL & ASM fragements)
  845. //
  846. // Parameters:
  847. // pDevice
  848. // Pointer to the device on which to create the shaders
  849. // ShaderCacheSize
  850. // Size of the shader cache
  851. // Flags
  852. // See D3DXFRAGMENT_xxx flags
  853. // ppFragmentLinker
  854. // pointer to a memory location to put the created interface pointer
  855. //
  856. //----------------------------------------------------------------------------
  857. HRESULT WINAPI
  858. D3DXCreateFragmentLinker(
  859. LPDIRECT3DDEVICE9 pDevice,
  860. UINT ShaderCacheSize,
  861. LPD3DXFRAGMENTLINKER* ppFragmentLinker);
  862. HRESULT WINAPI
  863. D3DXCreateFragmentLinkerEx(
  864. LPDIRECT3DDEVICE9 pDevice,
  865. UINT ShaderCacheSize,
  866. DWORD Flags,
  867. LPD3DXFRAGMENTLINKER* ppFragmentLinker);
  868. //----------------------------------------------------------------------------
  869. // D3DXPreprocessShader:
  870. // ---------------------
  871. // Runs the preprocessor on the specified shader or effect, but does
  872. // not actually compile it. This is useful for evaluating the #includes
  873. // and #defines in a shader and then emitting a reformatted token stream
  874. // for debugging purposes or for generating a self-contained shader.
  875. //
  876. // Parameters:
  877. // pSrcFile
  878. // Source file name
  879. // hSrcModule
  880. // Module handle. if NULL, current module will be used
  881. // pSrcResource
  882. // Resource name in module
  883. // pSrcData
  884. // Pointer to source code
  885. // SrcDataLen
  886. // Size of source code, in bytes
  887. // pDefines
  888. // Optional NULL-terminated array of preprocessor macro definitions.
  889. // pInclude
  890. // Optional interface pointer to use for handling #include directives.
  891. // If this parameter is NULL, #includes will be honored when assembling
  892. // from file, and will error when assembling from resource or memory.
  893. // ppShaderText
  894. // Returns a buffer containing a single large string that represents
  895. // the resulting formatted token stream
  896. // ppErrorMsgs
  897. // Returns a buffer containing a listing of errors and warnings that were
  898. // encountered during assembly. If you are running in a debugger,
  899. // these are the same messages you will see in your debug output.
  900. //----------------------------------------------------------------------------
  901. HRESULT WINAPI
  902. D3DXPreprocessShaderFromFileA(
  903. LPCSTR pSrcFile,
  904. CONST D3DXMACRO* pDefines,
  905. LPD3DXINCLUDE pInclude,
  906. LPD3DXBUFFER* ppShaderText,
  907. LPD3DXBUFFER* ppErrorMsgs);
  908. HRESULT WINAPI
  909. D3DXPreprocessShaderFromFileW(
  910. LPCWSTR pSrcFile,
  911. CONST D3DXMACRO* pDefines,
  912. LPD3DXINCLUDE pInclude,
  913. LPD3DXBUFFER* ppShaderText,
  914. LPD3DXBUFFER* ppErrorMsgs);
  915. #ifdef UNICODE
  916. #define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileW
  917. #else
  918. #define D3DXPreprocessShaderFromFile D3DXPreprocessShaderFromFileA
  919. #endif
  920. HRESULT WINAPI
  921. D3DXPreprocessShaderFromResourceA(
  922. HMODULE hSrcModule,
  923. LPCSTR pSrcResource,
  924. CONST D3DXMACRO* pDefines,
  925. LPD3DXINCLUDE pInclude,
  926. LPD3DXBUFFER* ppShaderText,
  927. LPD3DXBUFFER* ppErrorMsgs);
  928. HRESULT WINAPI
  929. D3DXPreprocessShaderFromResourceW(
  930. HMODULE hSrcModule,
  931. LPCWSTR pSrcResource,
  932. CONST D3DXMACRO* pDefines,
  933. LPD3DXINCLUDE pInclude,
  934. LPD3DXBUFFER* ppShaderText,
  935. LPD3DXBUFFER* ppErrorMsgs);
  936. #ifdef UNICODE
  937. #define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceW
  938. #else
  939. #define D3DXPreprocessShaderFromResource D3DXPreprocessShaderFromResourceA
  940. #endif
  941. HRESULT WINAPI
  942. D3DXPreprocessShader(
  943. LPCSTR pSrcData,
  944. UINT SrcDataSize,
  945. CONST D3DXMACRO* pDefines,
  946. LPD3DXINCLUDE pInclude,
  947. LPD3DXBUFFER* ppShaderText,
  948. LPD3DXBUFFER* ppErrorMsgs);
  949. #ifdef __cplusplus
  950. }
  951. #endif //__cplusplus
  952. //////////////////////////////////////////////////////////////////////////////
  953. // Shader comment block layouts //////////////////////////////////////////////
  954. //////////////////////////////////////////////////////////////////////////////
  955. //----------------------------------------------------------------------------
  956. // D3DXSHADER_CONSTANTTABLE:
  957. // -------------------------
  958. // Shader constant information; included as an CTAB comment block inside
  959. // shaders. All offsets are BYTE offsets from start of CONSTANTTABLE struct.
  960. // Entries in the table are sorted by Name in ascending order.
  961. //----------------------------------------------------------------------------
  962. typedef struct _D3DXSHADER_CONSTANTTABLE
  963. {
  964. DWORD Size; // sizeof(D3DXSHADER_CONSTANTTABLE)
  965. DWORD Creator; // LPCSTR offset
  966. DWORD Version; // shader version
  967. DWORD Constants; // number of constants
  968. DWORD ConstantInfo; // D3DXSHADER_CONSTANTINFO[Constants] offset
  969. DWORD Flags; // flags shader was compiled with
  970. DWORD Target; // LPCSTR offset
  971. } D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE;
  972. typedef struct _D3DXSHADER_CONSTANTINFO
  973. {
  974. DWORD Name; // LPCSTR offset
  975. WORD RegisterSet; // D3DXREGISTER_SET
  976. WORD RegisterIndex; // register number
  977. WORD RegisterCount; // number of registers
  978. WORD Reserved; // reserved
  979. DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset
  980. DWORD DefaultValue; // offset of default value
  981. } D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO;
  982. typedef struct _D3DXSHADER_TYPEINFO
  983. {
  984. WORD Class; // D3DXPARAMETER_CLASS
  985. WORD Type; // D3DXPARAMETER_TYPE
  986. WORD Rows; // number of rows (matrices)
  987. WORD Columns; // number of columns (vectors and matrices)
  988. WORD Elements; // array dimension
  989. WORD StructMembers; // number of struct members
  990. DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset
  991. } D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO;
  992. typedef struct _D3DXSHADER_STRUCTMEMBERINFO
  993. {
  994. DWORD Name; // LPCSTR offset
  995. DWORD TypeInfo; // D3DXSHADER_TYPEINFO offset
  996. } D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO;
  997. #endif //__D3DX9SHADER_H__