| 1 | #include <_mingw_unicode.h> |
| 2 | #undef INTERFACE |
| 3 | /* |
| 4 | * Copyright 2008 Luis Busquets |
| 5 | * Copyright 2014 Kai Tietz |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 20 | */ |
| 21 | |
| 22 | #include "d3dx9.h" |
| 23 | |
| 24 | #ifndef __D3DX9SHADER_H__ |
| 25 | #define __D3DX9SHADER_H__ |
| 26 | |
| 27 | #define D3DXSHADER_DEBUG 0x1 |
| 28 | #define D3DXSHADER_SKIPVALIDATION 0x2 |
| 29 | #define D3DXSHADER_SKIPOPTIMIZATION 0x4 |
| 30 | #define D3DXSHADER_PACKMATRIX_ROWMAJOR 0x8 |
| 31 | #define D3DXSHADER_PACKMATRIX_COLUMNMAJOR 0x10 |
| 32 | #define D3DXSHADER_PARTIALPRECISION 0x20 |
| 33 | #define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT 0x40 |
| 34 | #define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT 0x80 |
| 35 | #define D3DXSHADER_NO_PRESHADER 0x100 |
| 36 | #define D3DXSHADER_AVOID_FLOW_CONTROL 0x200 |
| 37 | #define D3DXSHADER_PREFER_FLOW_CONTROL 0x400 |
| 38 | #define D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY 0x1000 |
| 39 | #define D3DXSHADER_IEEE_STRICTNESS 0x2000 |
| 40 | |
| 41 | #define D3DXSHADER_OPTIMIZATION_LEVEL0 0x4000 |
| 42 | #define D3DXSHADER_OPTIMIZATION_LEVEL1 0x0 |
| 43 | #define D3DXSHADER_OPTIMIZATION_LEVEL2 0xC000 |
| 44 | #define D3DXSHADER_OPTIMIZATION_LEVEL3 0x8000 |
| 45 | |
| 46 | #define D3DXSHADER_USE_LEGACY_D3DX9_31_DLL 0x10000 |
| 47 | |
| 48 | #define D3DXCONSTTABLE_LARGEADDRESSAWARE 0x20000 |
| 49 | |
| 50 | typedef const char *D3DXHANDLE; |
| 51 | typedef D3DXHANDLE *LPD3DXHANDLE; |
| 52 | |
| 53 | typedef enum _D3DXREGISTER_SET |
| 54 | { |
| 55 | D3DXRS_BOOL, |
| 56 | D3DXRS_INT4, |
| 57 | D3DXRS_FLOAT4, |
| 58 | D3DXRS_SAMPLER, |
| 59 | D3DXRS_FORCE_DWORD = 0x7fffffff |
| 60 | } D3DXREGISTER_SET, *LPD3DXREGISTER_SET; |
| 61 | |
| 62 | typedef enum D3DXPARAMETER_CLASS |
| 63 | { |
| 64 | D3DXPC_SCALAR, |
| 65 | D3DXPC_VECTOR, |
| 66 | D3DXPC_MATRIX_ROWS, |
| 67 | D3DXPC_MATRIX_COLUMNS, |
| 68 | D3DXPC_OBJECT, |
| 69 | D3DXPC_STRUCT, |
| 70 | D3DXPC_FORCE_DWORD = 0x7fffffff, |
| 71 | } D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS; |
| 72 | |
| 73 | typedef enum D3DXPARAMETER_TYPE |
| 74 | { |
| 75 | D3DXPT_VOID, |
| 76 | D3DXPT_BOOL, |
| 77 | D3DXPT_INT, |
| 78 | D3DXPT_FLOAT, |
| 79 | D3DXPT_STRING, |
| 80 | D3DXPT_TEXTURE, |
| 81 | D3DXPT_TEXTURE1D, |
| 82 | D3DXPT_TEXTURE2D, |
| 83 | D3DXPT_TEXTURE3D, |
| 84 | D3DXPT_TEXTURECUBE, |
| 85 | D3DXPT_SAMPLER, |
| 86 | D3DXPT_SAMPLER1D, |
| 87 | D3DXPT_SAMPLER2D, |
| 88 | D3DXPT_SAMPLER3D, |
| 89 | D3DXPT_SAMPLERCUBE, |
| 90 | D3DXPT_PIXELSHADER, |
| 91 | D3DXPT_VERTEXSHADER, |
| 92 | D3DXPT_PIXELFRAGMENT, |
| 93 | D3DXPT_VERTEXFRAGMENT, |
| 94 | D3DXPT_UNSUPPORTED, |
| 95 | D3DXPT_FORCE_DWORD = 0x7fffffff, |
| 96 | } D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE; |
| 97 | |
| 98 | typedef struct _D3DXCONSTANTTABLE_DESC |
| 99 | { |
| 100 | const char *Creator; |
| 101 | DWORD Version; |
| 102 | UINT Constants; |
| 103 | } D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC; |
| 104 | |
| 105 | typedef struct _D3DXCONSTANT_DESC |
| 106 | { |
| 107 | const char *Name; |
| 108 | D3DXREGISTER_SET RegisterSet; |
| 109 | UINT RegisterIndex; |
| 110 | UINT RegisterCount; |
| 111 | D3DXPARAMETER_CLASS Class; |
| 112 | D3DXPARAMETER_TYPE Type; |
| 113 | UINT Rows; |
| 114 | UINT Columns; |
| 115 | UINT Elements; |
| 116 | UINT StructMembers; |
| 117 | UINT Bytes; |
| 118 | const void *DefaultValue; |
| 119 | } D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC; |
| 120 | |
| 121 | #if D3DX_SDK_VERSION < 43 |
| 122 | DEFINE_GUID(IID_ID3DXConstantTable, 0x9dca3190, 0x38b9, 0x4fc3, 0x92, 0xe3, 0x39, 0xc6, 0xdd, 0xfb, 0x35, 0x8b); |
| 123 | #else |
| 124 | DEFINE_GUID(IID_ID3DXConstantTable, 0xab3c758f, 0x093e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x01); |
| 125 | #endif |
| 126 | |
| 127 | #undef INTERFACE |
| 128 | #define INTERFACE ID3DXConstantTable |
| 129 | |
| 130 | DECLARE_INTERFACE_(ID3DXConstantTable, ID3DXBuffer) |
| 131 | { |
| 132 | /*** IUnknown methods ***/ |
| 133 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **out) PURE; |
| 134 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 135 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 136 | /*** ID3DXBuffer methods ***/ |
| 137 | STDMETHOD_(void *, GetBufferPointer)(THIS) PURE; |
| 138 | STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; |
| 139 | /*** ID3DXConstantTable methods ***/ |
| 140 | STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; |
| 141 | STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; |
| 142 | STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE; |
| 143 | STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; |
| 144 | STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE constant, const char *name) PURE; |
| 145 | STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; |
| 146 | STDMETHOD(SetDefaults)(THIS_ struct IDirect3DDevice9 *device) PURE; |
| 147 | STDMETHOD(SetValue)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 148 | const void *data, UINT data_size) PURE; |
| 149 | STDMETHOD(SetBool)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, WINBOOL value) PURE; |
| 150 | STDMETHOD(SetBoolArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 151 | const WINBOOL *values, UINT value_count) PURE; |
| 152 | STDMETHOD(SetInt)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, INT value) PURE; |
| 153 | STDMETHOD(SetIntArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 154 | const INT *values, UINT value_count) PURE; |
| 155 | STDMETHOD(SetFloat)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, float value) PURE; |
| 156 | STDMETHOD(SetFloatArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 157 | const float *values, UINT value_count) PURE; |
| 158 | STDMETHOD(SetVector)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXVECTOR4 *value) PURE; |
| 159 | STDMETHOD(SetVectorArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 160 | const D3DXVECTOR4 *values, UINT value_count) PURE; |
| 161 | STDMETHOD(SetMatrix)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, const D3DXMATRIX *value) PURE; |
| 162 | STDMETHOD(SetMatrixArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 163 | const D3DXMATRIX *values, UINT value_count) PURE; |
| 164 | STDMETHOD(SetMatrixPointerArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 165 | const D3DXMATRIX **values, UINT value_count) PURE; |
| 166 | STDMETHOD(SetMatrixTranspose)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 167 | const D3DXMATRIX *value) PURE; |
| 168 | STDMETHOD(SetMatrixTransposeArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 169 | const D3DXMATRIX *values, UINT value_count) PURE; |
| 170 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ struct IDirect3DDevice9 *device, D3DXHANDLE constant, |
| 171 | const D3DXMATRIX **values, UINT value_count) PURE; |
| 172 | }; |
| 173 | #undef INTERFACE |
| 174 | |
| 175 | #if !defined(__cplusplus) || defined(CINTERFACE) |
| 176 | /*** IUnknown methods ***/ |
| 177 | #define ID3DXConstantTable_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) |
| 178 | #define ID3DXConstantTable_AddRef(p) (p)->lpVtbl->AddRef(p) |
| 179 | #define ID3DXConstantTable_Release(p) (p)->lpVtbl->Release(p) |
| 180 | /*** ID3DXBuffer methods ***/ |
| 181 | #define ID3DXConstantTable_GetBufferPointer(p) (p)->lpVtbl->GetBufferPointer(p) |
| 182 | #define ID3DXConstantTable_GetBufferSize(p) (p)->lpVtbl->GetBufferSize(p) |
| 183 | /*** ID3DXConstantTable methods ***/ |
| 184 | #define ID3DXConstantTable_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a) |
| 185 | #define ID3DXConstantTable_GetConstantDesc(p,a,b,c) (p)->lpVtbl->GetConstantDesc(p,a,b,c) |
| 186 | #define ID3DXConstantTable_GetSamplerIndex(p,a) (p)->lpVtbl->GetSamplerIndex(p,a) |
| 187 | #define ID3DXConstantTable_GetConstant(p,a,b) (p)->lpVtbl->GetConstant(p,a,b) |
| 188 | #define ID3DXConstantTable_GetConstantByName(p,a,b) (p)->lpVtbl->GetConstantByName(p,a,b) |
| 189 | #define ID3DXConstantTable_GetConstantElement(p,a,b) (p)->lpVtbl->GetConstantElement(p,a,b) |
| 190 | #define ID3DXConstantTable_SetDefaults(p,a) (p)->lpVtbl->SetDefaults(p,a) |
| 191 | #define ID3DXConstantTable_SetValue(p,a,b,c,d) (p)->lpVtbl->SetValue(p,a,b,c,d) |
| 192 | #define ID3DXConstantTable_SetBool(p,a,b,c) (p)->lpVtbl->SetBool(p,a,b,c) |
| 193 | #define ID3DXConstantTable_SetBoolArray(p,a,b,c,d) (p)->lpVtbl->SetBoolArray(p,a,b,c,d) |
| 194 | #define ID3DXConstantTable_SetInt(p,a,b,c) (p)->lpVtbl->SetInt(p,a,b,c) |
| 195 | #define ID3DXConstantTable_SetIntArray(p,a,b,c,d) (p)->lpVtbl->SetIntArray(p,a,b,c,d) |
| 196 | #define ID3DXConstantTable_SetFloat(p,a,b,c) (p)->lpVtbl->SetFloat(p,a,b,c) |
| 197 | #define ID3DXConstantTable_SetFloatArray(p,a,b,c,d) (p)->lpVtbl->SetFloatArray(p,a,b,c,d) |
| 198 | #define ID3DXConstantTable_SetVector(p,a,b,c) (p)->lpVtbl->SetVector(p,a,b,c) |
| 199 | #define ID3DXConstantTable_SetVectorArray(p,a,b,c,d) (p)->lpVtbl->SetVectorArray(p,a,b,c,d) |
| 200 | #define ID3DXConstantTable_SetMatrix(p,a,b,c) (p)->lpVtbl->SetMatrix(p,a,b,c) |
| 201 | #define ID3DXConstantTable_SetMatrixArray(p,a,b,c,d) (p)->lpVtbl->SetMatrixArray(p,a,b,c,d) |
| 202 | #define ID3DXConstantTable_SetMatrixPointerArray(p,a,b,c,d) (p)->lpVtbl->SetMatrixPointerArray(p,a,b,c,d) |
| 203 | #define ID3DXConstantTable_SetMatrixTranspose(p,a,b,c) (p)->lpVtbl->SetMatrixTranspose(p,a,b,c) |
| 204 | #define ID3DXConstantTable_SetMatrixTransposeArray(p,a,b,c,d) (p)->lpVtbl->SetMatrixTransposeArray(p,a,b,c,d) |
| 205 | #define ID3DXConstantTable_SetMatrixTransposePointerArray(p,a,b,c,d) (p)->lpVtbl->SetMatrixTransposePointerArray(p,a,b,c,d) |
| 206 | #else |
| 207 | /*** IUnknown methods ***/ |
| 208 | #define ID3DXConstantTable_QueryInterface(p,a,b) (p)->QueryInterface(a,b) |
| 209 | #define ID3DXConstantTable_AddRef(p) (p)->AddRef() |
| 210 | #define ID3DXConstantTable_Release(p) (p)->Release() |
| 211 | /*** ID3DXBuffer methods ***/ |
| 212 | #define ID3DXConstantTable_GetBufferPointer(p) (p)->GetBufferPointer() |
| 213 | #define ID3DXConstantTable_GetBufferSize(p) (p)->GetBufferSize() |
| 214 | /*** ID3DXConstantTable methods ***/ |
| 215 | #define ID3DXConstantTable_GetDesc(p,a) (p)->GetDesc(a) |
| 216 | #define ID3DXConstantTable_GetConstantDesc(p,a,b,c) (p)->GetConstantDesc(a,b,c) |
| 217 | #define ID3DXConstantTable_GetSamplerIndex(p,a) (p)->GetSamplerIndex(a) |
| 218 | #define ID3DXConstantTable_GetConstant(p,a,b) (p)->GetConstant(a,b) |
| 219 | #define ID3DXConstantTable_GetConstantByName(p,a,b) (p)->GetConstantByName(a,b) |
| 220 | #define ID3DXConstantTable_GetConstantElement(p,a,b) (p)->GetConstantElement(a,b) |
| 221 | #define ID3DXConstantTable_SetDefaults(p,a) (p)->SetDefaults(a) |
| 222 | #define ID3DXConstantTable_SetValue(p,a,b,c,d) (p)->SetValue(a,b,c,d) |
| 223 | #define ID3DXConstantTable_SetBool(p,a,b,c) (p)->SetBool(a,b,c) |
| 224 | #define ID3DXConstantTable_SetBoolArray(p,a,b,c,d) (p)->SetBoolArray(a,b,c,d) |
| 225 | #define ID3DXConstantTable_SetInt(p,a,b,c) (p)->SetInt(a,b,c) |
| 226 | #define ID3DXConstantTable_SetIntArray(p,a,b,c,d) (p)->SetIntArray(a,b,c,d) |
| 227 | #define ID3DXConstantTable_SetFloat(p,a,b,c) (p)->SetFloat(a,b,c) |
| 228 | #define ID3DXConstantTable_SetFloatArray(p,a,b,c,d) (p)->SetFloatArray(a,b,c,d) |
| 229 | #define ID3DXConstantTable_SetVector(p,a,b,c) (p)->SetVector(a,b,c) |
| 230 | #define ID3DXConstantTable_SetVectorArray(p,a,b,c,d) (p)->SetVectorArray(a,b,c,d) |
| 231 | #define ID3DXConstantTable_SetMatrix(p,a,b,c) (p)->SetMatrix(a,b,c) |
| 232 | #define ID3DXConstantTable_SetMatrixArray(p,a,b,c,d) (p)->SetMatrixArray(a,b,c,d) |
| 233 | #define ID3DXConstantTable_SetMatrixPointerArray(p,a,b,c,d) (p)->SetMatrixPointerArray(a,b,c,d) |
| 234 | #define ID3DXConstantTable_SetMatrixTranspose(p,a,b,c) (p)->SetMatrixTranspose(a,b,c) |
| 235 | #define ID3DXConstantTable_SetMatrixTransposeArray(p,a,b,c,d) (p)->SetMatrixTransposeArray(a,b,c,d) |
| 236 | #define ID3DXConstantTable_SetMatrixTransposePointerArray(p,a,b,c,d) (p)->SetMatrixTransposePointerArray(a,b,c,d) |
| 237 | #endif |
| 238 | |
| 239 | typedef struct ID3DXConstantTable *LPD3DXCONSTANTTABLE; |
| 240 | |
| 241 | typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER; |
| 242 | |
| 243 | DEFINE_GUID(IID_ID3DXTextureShader, 0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26); |
| 244 | |
| 245 | #define INTERFACE ID3DXTextureShader |
| 246 | DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown) |
| 247 | { |
| 248 | STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **ppv) PURE; |
| 249 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 250 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 251 | STDMETHOD(GetFunction)(THIS_ struct ID3DXBuffer **ppFunction) PURE; |
| 252 | STDMETHOD(GetConstantBuffer)(THIS_ struct ID3DXBuffer **ppConstantBuffer) PURE; |
| 253 | STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE; |
| 254 | STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE; |
| 255 | STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; |
| 256 | STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, const char *pName) PURE; |
| 257 | STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE; |
| 258 | STDMETHOD(SetDefaults)(THIS) PURE; |
| 259 | STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, const void *pData, UINT Bytes) PURE; |
| 260 | STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, WINBOOL b) PURE; |
| 261 | STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, const WINBOOL *pb, UINT Count) PURE; |
| 262 | STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE; |
| 263 | STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, const INT *pn, UINT Count) PURE; |
| 264 | STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE; |
| 265 | STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, const FLOAT *pf, UINT Count) PURE; |
| 266 | STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, const D3DXVECTOR4 *pVector) PURE; |
| 267 | STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, const D3DXVECTOR4 *pVector, UINT Count) PURE; |
| 268 | STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix) PURE; |
| 269 | STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix, UINT Count) PURE; |
| 270 | STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX **ppMatrix, UINT Count) PURE; |
| 271 | STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix) PURE; |
| 272 | STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX *pMatrix, UINT Count) PURE; |
| 273 | STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, const D3DXMATRIX **ppMatrix, UINT Count) PURE; |
| 274 | }; |
| 275 | #undef INTERFACE |
| 276 | |
| 277 | typedef struct _D3DXMACRO |
| 278 | { |
| 279 | const char *Name; |
| 280 | const char *Definition; |
| 281 | } D3DXMACRO, *LPD3DXMACRO; |
| 282 | |
| 283 | typedef struct _D3DXSEMANTIC { |
| 284 | UINT Usage; |
| 285 | UINT UsageIndex; |
| 286 | } D3DXSEMANTIC, *LPD3DXSEMANTIC; |
| 287 | |
| 288 | typedef enum _D3DXINCLUDE_TYPE |
| 289 | { |
| 290 | D3DXINC_LOCAL, |
| 291 | D3DXINC_SYSTEM, |
| 292 | D3DXINC_FORCE_DWORD = 0x7fffffff, |
| 293 | } D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE; |
| 294 | |
| 295 | #define INTERFACE ID3DXInclude |
| 296 | |
| 297 | DECLARE_INTERFACE(ID3DXInclude) |
| 298 | { |
| 299 | STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE include_type, const char *filename, |
| 300 | const void *parent_data, const void **data, UINT *bytes) PURE; |
| 301 | STDMETHOD(Close)(THIS_ const void *data) PURE; |
| 302 | }; |
| 303 | #undef INTERFACE |
| 304 | |
| 305 | #define ID3DXInclude_Open(p,a,b,c,d,e) (p)->lpVtbl->Open(p,a,b,c,d,e) |
| 306 | #define ID3DXInclude_Close(p,a) (p)->lpVtbl->Close(p,a) |
| 307 | |
| 308 | typedef struct ID3DXInclude *LPD3DXINCLUDE; |
| 309 | |
| 310 | typedef struct _D3DXFRAGMENT_DESC |
| 311 | { |
| 312 | const char *Name; |
| 313 | DWORD Target; |
| 314 | |
| 315 | } D3DXFRAGMENT_DESC, *LPD3DXFRAGMENT_DESC; |
| 316 | |
| 317 | |
| 318 | DEFINE_GUID(IID_ID3DXFragmentLinker, 0x1a2c0cc2, 0xe5b6, 0x4ebc, 0x9e, 0x8d, 0x39, 0xe, 0x5, 0x78, 0x11, 0xb6); |
| 319 | |
| 320 | #define INTERFACE ID3DXFragmentLinker |
| 321 | DECLARE_INTERFACE_(ID3DXFragmentLinker, IUnknown) |
| 322 | { |
| 323 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, void **ppv) PURE; |
| 324 | STDMETHOD_(ULONG, AddRef)(THIS) PURE; |
| 325 | STDMETHOD_(ULONG, Release)(THIS) PURE; |
| 326 | |
| 327 | STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice9 **device) PURE; |
| 328 | STDMETHOD_(UINT, GetNumberOfFragments)(THIS) PURE; |
| 329 | |
| 330 | STDMETHOD_(D3DXHANDLE, GetFragmentHandleByIndex)(THIS_ UINT index) PURE; |
| 331 | STDMETHOD_(D3DXHANDLE, GetFragmentHandleByName)(THIS_ const char *name) PURE; |
| 332 | STDMETHOD(GetFragmentDesc)(THIS_ D3DXHANDLE name, D3DXFRAGMENT_DESC *frag_desc) PURE; |
| 333 | |
| 334 | STDMETHOD(AddFragments)(THIS_ const DWORD *fragments) PURE; |
| 335 | |
| 336 | STDMETHOD(GetAllFragments)(THIS_ ID3DXBuffer **buffer) PURE; |
| 337 | STDMETHOD(GetFragment)(THIS_ D3DXHANDLE name, ID3DXBuffer **buffer) PURE; |
| 338 | |
| 339 | STDMETHOD(LinkShader)(THIS_ const char *profile, DWORD flags, const D3DXHANDLE *fragmenthandles, UINT fragments, ID3DXBuffer **buffer, ID3DXBuffer **errors) PURE; |
| 340 | STDMETHOD(LinkVertexShader)(THIS_ const char *profile, DWORD flags, const D3DXHANDLE *fragment_handles, UINT fragments, IDirect3DVertexShader9 **shader, ID3DXBuffer **errors) PURE; |
| 341 | STDMETHOD(LinkPixelShader)(THIS_ const char *profile, DWORD flags, const D3DXHANDLE *fragment_handles, UINT fragments, IDirect3DPixelShader9 **shader, ID3DXBuffer **errors) PURE; |
| 342 | |
| 343 | STDMETHOD(ClearCache)(THIS) PURE; |
| 344 | }; |
| 345 | #undef INTERFACE |
| 346 | |
| 347 | #ifdef __cplusplus |
| 348 | extern "C" { |
| 349 | #endif |
| 350 | |
| 351 | const char * WINAPI D3DXGetPixelShaderProfile(struct IDirect3DDevice9 *device); |
| 352 | UINT WINAPI D3DXGetShaderSize(const DWORD *byte_code); |
| 353 | DWORD WINAPI D3DXGetShaderVersion(const DWORD *byte_code); |
| 354 | const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device); |
| 355 | HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const void **data, UINT *size); |
| 356 | HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **samplers, UINT *count); |
| 357 | |
| 358 | HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines, |
| 359 | ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 360 | HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, |
| 361 | ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 362 | #define D3DXAssembleShaderFromFile __MINGW_NAME_AW(D3DXAssembleShaderFromFile) |
| 363 | |
| 364 | HRESULT WINAPI D3DXAssembleShaderFromResourceA(HMODULE module, const char *resource, const D3DXMACRO *defines, |
| 365 | ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 366 | HRESULT WINAPI D3DXAssembleShaderFromResourceW(HMODULE module, const WCHAR *resource, const D3DXMACRO *defines, |
| 367 | ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 368 | #define D3DXAssembleShaderFromResource __MINGW_NAME_AW(D3DXAssembleShaderFromResource) |
| 369 | |
| 370 | HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMACRO *defines, |
| 371 | ID3DXInclude *include, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 372 | |
| 373 | HRESULT WINAPI D3DXCompileShader(const char *src_data, UINT data_len, const D3DXMACRO *defines, |
| 374 | ID3DXInclude *include, const char *function_name, const char *profile, DWORD flags, |
| 375 | ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); |
| 376 | |
| 377 | HRESULT WINAPI D3DXDisassembleShader(const DWORD *pShader, WINBOOL EnableColorCode, const char *pComments, struct ID3DXBuffer **ppDisassembly); |
| 378 | |
| 379 | HRESULT WINAPI D3DXCompileShaderFromFileA(const char *filename, const D3DXMACRO *defines, |
| 380 | ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, |
| 381 | ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); |
| 382 | HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, |
| 383 | ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, |
| 384 | ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); |
| 385 | #define D3DXCompileShaderFromFile __MINGW_NAME_AW(D3DXCompileShaderFromFile) |
| 386 | |
| 387 | HRESULT WINAPI D3DXCompileShaderFromResourceA(HMODULE module, const char *resource, const D3DXMACRO *defines, |
| 388 | ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, |
| 389 | ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); |
| 390 | HRESULT WINAPI D3DXCompileShaderFromResourceW(HMODULE module, const WCHAR *resource, const D3DXMACRO *defines, |
| 391 | ID3DXInclude *include, const char *entrypoint, const char *profile, DWORD flags, |
| 392 | ID3DXBuffer **shader, ID3DXBuffer **error_messages, ID3DXConstantTable **constant_table); |
| 393 | #define D3DXCompileShaderFromResource __MINGW_NAME_AW(D3DXCompileShaderFromResource) |
| 394 | |
| 395 | HRESULT WINAPI D3DXPreprocessShader(const char *data, UINT data_len, const D3DXMACRO *defines, |
| 396 | ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 397 | |
| 398 | HRESULT WINAPI D3DXPreprocessShaderFromFileA(const char *filename, const D3DXMACRO *defines, |
| 399 | ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 400 | HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMACRO *defines, |
| 401 | ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 402 | #define D3DXPreprocessShaderFromFile __MINGW_NAME_AW(D3DXPreprocessShaderFromFile) |
| 403 | |
| 404 | HRESULT WINAPI D3DXPreprocessShaderFromResourceA(HMODULE module, const char *resource, const D3DXMACRO *defines, |
| 405 | ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 406 | HRESULT WINAPI D3DXPreprocessShaderFromResourceW(HMODULE module, const WCHAR *resource, const D3DXMACRO *defines, |
| 407 | ID3DXInclude *include, ID3DXBuffer **shader, ID3DXBuffer **error_messages); |
| 408 | #define D3DXPreprocessShaderFromResource __MINGW_NAME_AW(D3DXPreprocessShaderFromResource) |
| 409 | |
| 410 | HRESULT WINAPI D3DXGetShaderConstantTableEx(const DWORD *byte_code, DWORD flags, ID3DXConstantTable **constant_table); |
| 411 | |
| 412 | HRESULT WINAPI D3DXGetShaderConstantTable(const DWORD *byte_code, ID3DXConstantTable **constant_table); |
| 413 | |
| 414 | HRESULT WINAPI D3DXGetShaderInputSemantics(const DWORD *pFunction, D3DXSEMANTIC *pSemantics, UINT *pCount); |
| 415 | HRESULT WINAPI D3DXGetShaderOutputSemantics(const DWORD *pFunction, D3DXSEMANTIC *pSemantics, UINT *pCount); |
| 416 | |
| 417 | HRESULT WINAPI D3DXCreateTextureShader(const DWORD *pFunction, ID3DXTextureShader **ppTextureShader); |
| 418 | |
| 419 | HRESULT WINAPI D3DXCreateFragmentLinker(IDirect3DDevice9 *device, UINT size, ID3DXFragmentLinker **linker); |
| 420 | HRESULT WINAPI D3DXCreateFragmentLinkerEx(IDirect3DDevice9 *device, UINT size, DWORD flags, ID3DXFragmentLinker **linker); |
| 421 | |
| 422 | #ifdef __cplusplus |
| 423 | } |
| 424 | #endif |
| 425 | |
| 426 | typedef struct _D3DXSHADER_CONSTANTTABLE |
| 427 | { |
| 428 | DWORD Size; |
| 429 | DWORD Creator; |
| 430 | DWORD Version; |
| 431 | DWORD Constants; |
| 432 | DWORD ConstantInfo; |
| 433 | DWORD Flags; |
| 434 | DWORD Target; |
| 435 | } D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE; |
| 436 | |
| 437 | typedef struct _D3DXSHADER_CONSTANTINFO |
| 438 | { |
| 439 | DWORD Name; |
| 440 | WORD RegisterSet; |
| 441 | WORD RegisterIndex; |
| 442 | WORD RegisterCount; |
| 443 | WORD Reserved; |
| 444 | DWORD TypeInfo; |
| 445 | DWORD DefaultValue; |
| 446 | } D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO; |
| 447 | |
| 448 | typedef struct _D3DXSHADER_TYPEINFO |
| 449 | { |
| 450 | WORD Class; |
| 451 | WORD Type; |
| 452 | WORD Rows; |
| 453 | WORD Columns; |
| 454 | WORD Elements; |
| 455 | WORD StructMembers; |
| 456 | DWORD StructMemberInfo; |
| 457 | } D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO; |
| 458 | |
| 459 | typedef struct _D3DXSHADER_STRUCTMEMBERINFO |
| 460 | { |
| 461 | DWORD Name; |
| 462 | DWORD TypeInfo; |
| 463 | } D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO; |
| 464 | |
| 465 | #endif /* __D3DX9SHADER_H__ */ |