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