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