[AMSTREAM] Sync with Wine Staging 3.9. CORE-14656
[reactos.git] / dll / directx / wine / d3dx9_25 / effect.c
1 /*
2 * Copyright 2010 Christian Costa
3 * Copyright 2011 Rico Schüller
4 * Copyright 2015 Sebastian Lackner
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "config.h"
22 #include "wine/port.h"
23 #define NONAMELESSUNION
24 #include "wine/debug.h"
25 #define INITGUID
26 #include "initguid.h"
27 #define COBJMACROS
28 #include "wingdi.h"
29 #include "d3dx9.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
32
33 DEFINE_GUID(IID_ID3DXEffect25, 0xd165ccb1, 0x62b0, 0x4a33, 0xb3, 0xfa, 0xa9, 0x23, 0x0, 0x30, 0x5a, 0x11);
34
35 #define INTERFACE ID3DXEffect25
36 DECLARE_INTERFACE_(ID3DXEffect25, ID3DXBaseEffect)
37 {
38 /*** IUnknown methods ***/
39 STDMETHOD(QueryInterface)(THIS_ REFIID riid, void **out) PURE;
40 STDMETHOD_(ULONG, AddRef)(THIS) PURE;
41 STDMETHOD_(ULONG, Release)(THIS) PURE;
42 /*** ID3DXBaseEffect methods ***/
43 STDMETHOD(GetDesc)(THIS_ D3DXEFFECT_DESC* desc) PURE;
44 STDMETHOD(GetParameterDesc)(THIS_ D3DXHANDLE parameter, D3DXPARAMETER_DESC* desc) PURE;
45 STDMETHOD(GetTechniqueDesc)(THIS_ D3DXHANDLE technique, D3DXTECHNIQUE_DESC* desc) PURE;
46 STDMETHOD(GetPassDesc)(THIS_ D3DXHANDLE pass, D3DXPASS_DESC* desc) PURE;
47 STDMETHOD(GetFunctionDesc)(THIS_ D3DXHANDLE shader, D3DXFUNCTION_DESC* desc) PURE;
48 STDMETHOD_(D3DXHANDLE, GetParameter)(THIS_ D3DXHANDLE parameter, UINT index) PURE;
49 STDMETHOD_(D3DXHANDLE, GetParameterByName)(THIS_ D3DXHANDLE parameter, const char *name) PURE;
50 STDMETHOD_(D3DXHANDLE, GetParameterBySemantic)(THIS_ D3DXHANDLE parameter, const char *semantic) PURE;
51 STDMETHOD_(D3DXHANDLE, GetParameterElement)(THIS_ D3DXHANDLE parameter, UINT index) PURE;
52 STDMETHOD_(D3DXHANDLE, GetTechnique)(THIS_ UINT index) PURE;
53 STDMETHOD_(D3DXHANDLE, GetTechniqueByName)(THIS_ const char *name) PURE;
54 STDMETHOD_(D3DXHANDLE, GetPass)(THIS_ D3DXHANDLE technique, UINT index) PURE;
55 STDMETHOD_(D3DXHANDLE, GetPassByName)(THIS_ D3DXHANDLE technique, const char *name) PURE;
56 STDMETHOD_(D3DXHANDLE, GetFunction)(THIS_ UINT index);
57 STDMETHOD_(D3DXHANDLE, GetFunctionByName)(THIS_ const char *name);
58 STDMETHOD_(D3DXHANDLE, GetAnnotation)(THIS_ D3DXHANDLE object, UINT index) PURE;
59 STDMETHOD_(D3DXHANDLE, GetAnnotationByName)(THIS_ D3DXHANDLE object, const char *name) PURE;
60 STDMETHOD(SetValue)(THIS_ D3DXHANDLE parameter, const void *data, UINT bytes) PURE;
61 STDMETHOD(GetValue)(THIS_ D3DXHANDLE parameter, void *data, UINT bytes) PURE;
62 STDMETHOD(SetBool)(THIS_ D3DXHANDLE parameter, BOOL b) PURE;
63 STDMETHOD(GetBool)(THIS_ D3DXHANDLE parameter, BOOL* b) PURE;
64 STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE parameter, const BOOL *b, UINT count) PURE;
65 STDMETHOD(GetBoolArray)(THIS_ D3DXHANDLE parameter, BOOL* b, UINT count) PURE;
66 STDMETHOD(SetInt)(THIS_ D3DXHANDLE parameter, INT n) PURE;
67 STDMETHOD(GetInt)(THIS_ D3DXHANDLE parameter, INT* n) PURE;
68 STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE parameter, const INT *n, UINT count) PURE;
69 STDMETHOD(GetIntArray)(THIS_ D3DXHANDLE parameter, INT* n, UINT count) PURE;
70 STDMETHOD(SetFloat)(THIS_ D3DXHANDLE parameter, FLOAT f) PURE;
71 STDMETHOD(GetFloat)(THIS_ D3DXHANDLE parameter, FLOAT* f) PURE;
72 STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE parameter, const FLOAT *f, UINT count) PURE;
73 STDMETHOD(GetFloatArray)(THIS_ D3DXHANDLE parameter, FLOAT* f, UINT count) PURE;
74 STDMETHOD(SetVector)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector) PURE;
75 STDMETHOD(GetVector)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector) PURE;
76 STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count) PURE;
77 STDMETHOD(GetVectorArray)(THIS_ D3DXHANDLE parameter, D3DXVECTOR4* vector, UINT count) PURE;
78 STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE;
79 STDMETHOD(GetMatrix)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE;
80 STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE;
81 STDMETHOD(GetMatrixArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE;
82 STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE;
83 STDMETHOD(GetMatrixPointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE;
84 STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix) PURE;
85 STDMETHOD(GetMatrixTranspose)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix) PURE;
86 STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count) PURE;
87 STDMETHOD(GetMatrixTransposeArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX* matrix, UINT count) PURE;
88 STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count) PURE;
89 STDMETHOD(GetMatrixTransposePointerArray)(THIS_ D3DXHANDLE parameter, D3DXMATRIX** matrix, UINT count) PURE;
90 STDMETHOD(SetString)(THIS_ D3DXHANDLE parameter, const char *string) PURE;
91 STDMETHOD(GetString)(THIS_ D3DXHANDLE parameter, const char **string) PURE;
92 STDMETHOD(SetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture) PURE;
93 STDMETHOD(GetTexture)(THIS_ D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture) PURE;
94 STDMETHOD(GetPixelShader)(THIS_ D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader) PURE;
95 STDMETHOD(GetVertexShader)(THIS_ D3DXHANDLE parameter, struct IDirect3DVertexShader9 **shader) PURE;
96 STDMETHOD(SetArrayRange)(THIS_ D3DXHANDLE parameter, UINT start, UINT end) PURE;
97 /*** ID3DXEffect methods ***/
98 STDMETHOD(GetPool)(THIS_ ID3DXEffectPool **pool) PURE;
99 STDMETHOD(SetTechnique)(THIS_ D3DXHANDLE technique) PURE;
100 STDMETHOD_(D3DXHANDLE, GetCurrentTechnique)(THIS) PURE;
101 STDMETHOD(ValidateTechnique)(THIS_ D3DXHANDLE technique) PURE;
102 STDMETHOD(FindNextValidTechnique)(THIS_ D3DXHANDLE technique, D3DXHANDLE* next_technique) PURE;
103 STDMETHOD_(BOOL, IsParameterUsed)(THIS_ D3DXHANDLE parameter, D3DXHANDLE technique) PURE;
104 STDMETHOD(Begin)(THIS_ UINT *passes, DWORD flags) PURE;
105 STDMETHOD(BeginPass)(THIS_ UINT pass) PURE;
106 STDMETHOD(CommitChanges)(THIS) PURE;
107 STDMETHOD(EndPass)(THIS) PURE;
108 STDMETHOD(End)(THIS) PURE;
109 STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice9 **device) PURE;
110 STDMETHOD(OnLostDevice)(THIS) PURE;
111 STDMETHOD(OnResetDevice)(THIS) PURE;
112 STDMETHOD(SetStateManager)(THIS_ ID3DXEffectStateManager *manager) PURE;
113 STDMETHOD(GetStateManager)(THIS_ ID3DXEffectStateManager **manager) PURE;
114 STDMETHOD(BeginParameterBlock)(THIS) PURE;
115 STDMETHOD_(D3DXHANDLE, EndParameterBlock)(THIS) PURE;
116 STDMETHOD(ApplyParameterBlock)(THIS_ D3DXHANDLE parameter_block) PURE;
117 /* DeleteParameterBlock missing */
118 STDMETHOD(CloneEffect)(THIS_ struct IDirect3DDevice9 *device, struct ID3DXEffect25 **effect) PURE;
119 /* SetRawValue missing */
120 };
121 #undef INTERFACE
122
123 struct ID3DXEffect25Impl
124 {
125 ID3DXEffect25 ID3DXEffect25_iface;
126 ID3DXEffect *effect;
127 LONG ref;
128 };
129
130 static const struct ID3DXEffect25Vtbl ID3DXEffect25_Vtbl;
131
132 static inline struct ID3DXEffect25Impl *impl_from_ID3DXEffect25(ID3DXEffect25 *iface)
133 {
134 return CONTAINING_RECORD(iface, struct ID3DXEffect25Impl, ID3DXEffect25_iface);
135 }
136
137 /*** IUnknown methods ***/
138 static HRESULT WINAPI ID3DXEffect25Impl_QueryInterface(ID3DXEffect25 *iface, REFIID riid, void **object)
139 {
140 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
141
142 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
143
144 if (IsEqualGUID(riid, &IID_IUnknown) ||
145 IsEqualGUID(riid, &IID_ID3DXEffect25))
146 {
147 iface->lpVtbl->AddRef(iface);
148 *object = This;
149 return S_OK;
150 }
151
152 ERR("Interface %s not found\n", debugstr_guid(riid));
153
154 return E_NOINTERFACE;
155 }
156
157 static ULONG WINAPI ID3DXEffect25Impl_AddRef(ID3DXEffect25 *iface)
158 {
159 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
160
161 TRACE("iface %p: AddRef from %u\n", This, This->ref);
162
163 return InterlockedIncrement(&This->ref);
164 }
165
166 static ULONG WINAPI ID3DXEffect25Impl_Release(ID3DXEffect25 *iface)
167 {
168 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
169 ULONG ref = InterlockedDecrement(&This->ref);
170
171 TRACE("iface %p: Release from %u\n", This, ref + 1);
172
173 if (!ref)
174 {
175 ID3DXEffect *effect = This->effect;
176
177 effect->lpVtbl->Release(effect);
178 HeapFree(GetProcessHeap(), 0, This);
179 }
180
181 return ref;
182 }
183
184 /*** ID3DXBaseEffect methods ***/
185 static HRESULT WINAPI ID3DXEffect25Impl_GetDesc(ID3DXEffect25 *iface, D3DXEFFECT_DESC *desc)
186 {
187 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
188 ID3DXEffect *effect = This->effect;
189
190 TRACE("Forward iface %p, effect %p\n", This, effect);
191
192 return effect->lpVtbl->GetDesc(effect, desc);
193 }
194
195 static HRESULT WINAPI ID3DXEffect25Impl_GetParameterDesc(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
196 {
197 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
198 ID3DXEffect *effect = This->effect;
199
200 TRACE("Forward iface %p, effect %p\n", This, effect);
201
202 return effect->lpVtbl->GetParameterDesc(effect, parameter, desc);
203 }
204
205 static HRESULT WINAPI ID3DXEffect25Impl_GetTechniqueDesc(ID3DXEffect25 *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
206 {
207 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
208 ID3DXEffect *effect = This->effect;
209
210 TRACE("Forward iface %p, effect %p\n", This, effect);
211
212 return effect->lpVtbl->GetTechniqueDesc(effect, technique, desc);
213 }
214
215 static HRESULT WINAPI ID3DXEffect25Impl_GetPassDesc(ID3DXEffect25 *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
216 {
217 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
218 ID3DXEffect *effect = This->effect;
219
220 TRACE("Forward iface %p, effect %p\n", This, effect);
221
222 return effect->lpVtbl->GetPassDesc(effect, pass, desc);
223 }
224
225 static HRESULT WINAPI ID3DXEffect25Impl_GetFunctionDesc(ID3DXEffect25 *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
226 {
227 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
228 ID3DXEffect *effect = This->effect;
229
230 TRACE("Forward iface %p, effect %p\n", This, effect);
231
232 return effect->lpVtbl->GetFunctionDesc(effect, shader, desc);
233 }
234
235 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetParameter(ID3DXEffect25 *iface, D3DXHANDLE parameter, UINT index)
236 {
237 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
238 ID3DXEffect *effect = This->effect;
239
240 TRACE("Forward iface %p, effect %p\n", This, effect);
241
242 return effect->lpVtbl->GetParameter(effect, parameter, index);
243 }
244
245 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetParameterByName(ID3DXEffect25 *iface, D3DXHANDLE parameter, LPCSTR name)
246 {
247 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
248 ID3DXEffect *effect = This->effect;
249
250 TRACE("Forward iface %p, effect %p\n", This, effect);
251
252 return effect->lpVtbl->GetParameterByName(effect, parameter, name);
253 }
254
255 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetParameterBySemantic(ID3DXEffect25 *iface, D3DXHANDLE parameter, LPCSTR semantic)
256 {
257 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
258 ID3DXEffect *effect = This->effect;
259
260 TRACE("Forward iface %p, effect %p\n", This, effect);
261
262 return effect->lpVtbl->GetParameterBySemantic(effect, parameter, semantic);
263 }
264
265 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetParameterElement(ID3DXEffect25 *iface, D3DXHANDLE parameter, UINT index)
266 {
267 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
268 ID3DXEffect *effect = This->effect;
269
270 TRACE("Forward iface %p, effect %p\n", This, effect);
271
272 return effect->lpVtbl->GetParameterElement(effect, parameter, index);
273 }
274
275 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetTechnique(ID3DXEffect25 *iface, UINT index)
276 {
277 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
278 ID3DXEffect *effect = This->effect;
279
280 TRACE("Forward iface %p, effect %p\n", This, effect);
281
282 return effect->lpVtbl->GetTechnique(effect, index);
283 }
284
285 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetTechniqueByName(ID3DXEffect25 *iface, LPCSTR name)
286 {
287 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
288 ID3DXEffect *effect = This->effect;
289
290 TRACE("Forward iface %p, effect %p\n", This, effect);
291
292 return effect->lpVtbl->GetTechniqueByName(effect, name);
293 }
294
295 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetPass(ID3DXEffect25 *iface, D3DXHANDLE technique, UINT index)
296 {
297 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
298 ID3DXEffect *effect = This->effect;
299
300 TRACE("Forward iface %p, effect %p\n", This, effect);
301
302 return effect->lpVtbl->GetPass(effect, technique, index);
303 }
304
305 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetPassByName(ID3DXEffect25 *iface, D3DXHANDLE technique, LPCSTR name)
306 {
307 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
308 ID3DXEffect *effect = This->effect;
309
310 TRACE("Forward iface %p, effect %p\n", This, effect);
311
312 return effect->lpVtbl->GetPassByName(effect, technique, name);
313 }
314
315 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetFunction(ID3DXEffect25 *iface, UINT index)
316 {
317 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
318 ID3DXEffect *effect = This->effect;
319
320 TRACE("Forward iface %p, effect %p\n", This, effect);
321
322 return effect->lpVtbl->GetFunction(effect, index);
323 }
324
325 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetFunctionByName(ID3DXEffect25 *iface, LPCSTR name)
326 {
327 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
328 ID3DXEffect *effect = This->effect;
329
330 TRACE("Forward iface %p, effect %p\n", This, effect);
331
332 return effect->lpVtbl->GetFunctionByName(effect, name);
333 }
334
335 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetAnnotation(ID3DXEffect25 *iface, D3DXHANDLE object, UINT index)
336 {
337 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
338 ID3DXEffect *effect = This->effect;
339
340 TRACE("Forward iface %p, effect %p\n", This, effect);
341
342 return effect->lpVtbl->GetAnnotation(effect, object, index);
343 }
344
345 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetAnnotationByName(ID3DXEffect25 *iface, D3DXHANDLE object, LPCSTR name)
346 {
347 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
348 ID3DXEffect *effect = This->effect;
349
350 TRACE("Forward iface %p, effect %p\n", This, effect);
351
352 return effect->lpVtbl->GetAnnotationByName(effect, object, name);
353 }
354
355 static HRESULT WINAPI ID3DXEffect25Impl_SetValue(ID3DXEffect25 *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
356 {
357 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
358 ID3DXEffect *effect = This->effect;
359
360 TRACE("Forward iface %p, effect %p\n", This, effect);
361
362 return effect->lpVtbl->SetValue(effect, parameter, data, bytes);
363 }
364
365 static HRESULT WINAPI ID3DXEffect25Impl_GetValue(ID3DXEffect25 *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
366 {
367 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
368 ID3DXEffect *effect = This->effect;
369
370 TRACE("Forward iface %p, effect %p\n", This, effect);
371
372 return effect->lpVtbl->GetValue(effect, parameter, data, bytes);
373 }
374
375 static HRESULT WINAPI ID3DXEffect25Impl_SetBool(ID3DXEffect25 *iface, D3DXHANDLE parameter, BOOL b)
376 {
377 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
378 ID3DXEffect *effect = This->effect;
379
380 TRACE("Forward iface %p, effect %p\n", This, effect);
381
382 return effect->lpVtbl->SetBool(effect, parameter, b);
383 }
384
385 static HRESULT WINAPI ID3DXEffect25Impl_GetBool(ID3DXEffect25 *iface, D3DXHANDLE parameter, BOOL *b)
386 {
387 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
388 ID3DXEffect *effect = This->effect;
389
390 TRACE("Forward iface %p, effect %p\n", This, effect);
391
392 return effect->lpVtbl->GetBool(effect, parameter, b);
393 }
394
395 static HRESULT WINAPI ID3DXEffect25Impl_SetBoolArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const BOOL *b, UINT count)
396 {
397 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
398 ID3DXEffect *effect = This->effect;
399
400 TRACE("Forward iface %p, effect %p\n", This, effect);
401
402 return effect->lpVtbl->SetBoolArray(effect, parameter, b, count);
403 }
404
405 static HRESULT WINAPI ID3DXEffect25Impl_GetBoolArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
406 {
407 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
408 ID3DXEffect *effect = This->effect;
409
410 TRACE("Forward iface %p, effect %p\n", This, effect);
411
412 return effect->lpVtbl->GetBoolArray(effect, parameter, b, count);
413 }
414
415 static HRESULT WINAPI ID3DXEffect25Impl_SetInt(ID3DXEffect25 *iface, D3DXHANDLE parameter, INT n)
416 {
417 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
418 ID3DXEffect *effect = This->effect;
419
420 TRACE("Forward iface %p, effect %p\n", This, effect);
421
422 return effect->lpVtbl->SetInt(effect, parameter, n);
423 }
424
425 static HRESULT WINAPI ID3DXEffect25Impl_GetInt(ID3DXEffect25 *iface, D3DXHANDLE parameter, INT *n)
426 {
427 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
428 ID3DXEffect *effect = This->effect;
429
430 TRACE("Forward iface %p, effect %p\n", This, effect);
431
432 return effect->lpVtbl->GetInt(effect, parameter, n);
433 }
434
435 static HRESULT WINAPI ID3DXEffect25Impl_SetIntArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const INT *n, UINT count)
436 {
437 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
438 ID3DXEffect *effect = This->effect;
439
440 TRACE("Forward iface %p, effect %p\n", This, effect);
441
442 return effect->lpVtbl->SetIntArray(effect, parameter, n, count);
443 }
444
445 static HRESULT WINAPI ID3DXEffect25Impl_GetIntArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, INT *n, UINT count)
446 {
447 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
448 ID3DXEffect *effect = This->effect;
449
450 TRACE("Forward iface %p, effect %p\n", This, effect);
451
452 return effect->lpVtbl->GetIntArray(effect, parameter, n, count);
453 }
454
455 static HRESULT WINAPI ID3DXEffect25Impl_SetFloat(ID3DXEffect25 *iface, D3DXHANDLE parameter, FLOAT f)
456 {
457 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
458 ID3DXEffect *effect = This->effect;
459
460 TRACE("Forward iface %p, effect %p\n", This, effect);
461
462 return effect->lpVtbl->SetFloat(effect, parameter, f);
463 }
464
465 static HRESULT WINAPI ID3DXEffect25Impl_GetFloat(ID3DXEffect25 *iface, D3DXHANDLE parameter, FLOAT *f)
466 {
467 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
468 ID3DXEffect *effect = This->effect;
469
470 TRACE("Forward iface %p, effect %p\n", This, effect);
471
472 return effect->lpVtbl->GetFloat(effect, parameter, f);
473 }
474
475 static HRESULT WINAPI ID3DXEffect25Impl_SetFloatArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const FLOAT *f, UINT count)
476 {
477 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
478 ID3DXEffect *effect = This->effect;
479
480 TRACE("Forward iface %p, effect %p\n", This, effect);
481
482 return effect->lpVtbl->SetFloatArray(effect, parameter, f, count);
483 }
484
485 static HRESULT WINAPI ID3DXEffect25Impl_GetFloatArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
486 {
487 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
488 ID3DXEffect *effect = This->effect;
489
490 TRACE("Forward iface %p, effect %p\n", This, effect);
491
492 return effect->lpVtbl->GetFloatArray(effect, parameter, f, count);
493 }
494
495 static HRESULT WINAPI ID3DXEffect25Impl_SetVector(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXVECTOR4 *vector)
496 {
497 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
498 ID3DXEffect *effect = This->effect;
499
500 TRACE("Forward iface %p, effect %p\n", This, effect);
501
502 return effect->lpVtbl->SetVector(effect, parameter, vector);
503 }
504
505 static HRESULT WINAPI ID3DXEffect25Impl_GetVector(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
506 {
507 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
508 ID3DXEffect *effect = This->effect;
509
510 TRACE("Forward iface %p, effect %p\n", This, effect);
511
512 return effect->lpVtbl->GetVector(effect, parameter, vector);
513 }
514
515 static HRESULT WINAPI ID3DXEffect25Impl_SetVectorArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXVECTOR4 *vector, UINT count)
516 {
517 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
518 ID3DXEffect *effect = This->effect;
519
520 TRACE("Forward iface %p, effect %p\n", This, effect);
521
522 return effect->lpVtbl->SetVectorArray(effect, parameter, vector, count);
523 }
524
525 static HRESULT WINAPI ID3DXEffect25Impl_GetVectorArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
526 {
527 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
528 ID3DXEffect *effect = This->effect;
529
530 TRACE("Forward iface %p, effect %p\n", This, effect);
531
532 return effect->lpVtbl->GetVectorArray(effect, parameter, vector, count);
533 }
534
535 static HRESULT WINAPI ID3DXEffect25Impl_SetMatrix(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix)
536 {
537 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
538 ID3DXEffect *effect = This->effect;
539
540 TRACE("Forward iface %p, effect %p\n", This, effect);
541
542 return effect->lpVtbl->SetMatrix(effect, parameter, matrix);
543 }
544
545 static HRESULT WINAPI ID3DXEffect25Impl_GetMatrix(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
546 {
547 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
548 ID3DXEffect *effect = This->effect;
549
550 TRACE("Forward iface %p, effect %p\n", This, effect);
551
552 return effect->lpVtbl->GetMatrix(effect, parameter, matrix);
553 }
554
555 static HRESULT WINAPI ID3DXEffect25Impl_SetMatrixArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count)
556 {
557 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
558 ID3DXEffect *effect = This->effect;
559
560 TRACE("Forward iface %p, effect %p\n", This, effect);
561
562 return effect->lpVtbl->SetMatrixArray(effect, parameter, matrix, count);
563 }
564
565 static HRESULT WINAPI ID3DXEffect25Impl_GetMatrixArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
566 {
567 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
568 ID3DXEffect *effect = This->effect;
569
570 TRACE("Forward iface %p, effect %p\n", This, effect);
571
572 return effect->lpVtbl->GetMatrixArray(effect, parameter, matrix, count);
573 }
574
575 static HRESULT WINAPI ID3DXEffect25Impl_SetMatrixPointerArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count)
576 {
577 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
578 ID3DXEffect *effect = This->effect;
579
580 TRACE("Forward iface %p, effect %p\n", This, effect);
581
582 return effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix, count);
583 }
584
585 static HRESULT WINAPI ID3DXEffect25Impl_GetMatrixPointerArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
586 {
587 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
588 ID3DXEffect *effect = This->effect;
589
590 TRACE("Forward iface %p, effect %p\n", This, effect);
591
592 return effect->lpVtbl->GetMatrixPointerArray(effect, parameter, matrix, count);
593 }
594
595 static HRESULT WINAPI ID3DXEffect25Impl_SetMatrixTranspose(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix)
596 {
597 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
598 ID3DXEffect *effect = This->effect;
599
600 TRACE("Forward iface %p, effect %p\n", This, effect);
601
602 return effect->lpVtbl->SetMatrixTranspose(effect, parameter, matrix);
603 }
604
605 static HRESULT WINAPI ID3DXEffect25Impl_GetMatrixTranspose(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
606 {
607 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
608 ID3DXEffect *effect = This->effect;
609
610 TRACE("Forward iface %p, effect %p\n", This, effect);
611
612 return effect->lpVtbl->GetMatrixTranspose(effect, parameter, matrix);
613 }
614
615 static HRESULT WINAPI ID3DXEffect25Impl_SetMatrixTransposeArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXMATRIX *matrix, UINT count)
616 {
617 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
618 ID3DXEffect *effect = This->effect;
619
620 TRACE("Forward iface %p, effect %p\n", This, effect);
621
622 return effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, matrix, count);
623 }
624
625 static HRESULT WINAPI ID3DXEffect25Impl_GetMatrixTransposeArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
626 {
627 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
628 ID3DXEffect *effect = This->effect;
629
630 TRACE("Forward iface %p, effect %p\n", This, effect);
631
632 return effect->lpVtbl->GetMatrixTransposeArray(effect, parameter, matrix, count);
633 }
634
635 static HRESULT WINAPI ID3DXEffect25Impl_SetMatrixTransposePointerArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, const D3DXMATRIX **matrix, UINT count)
636 {
637 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
638 ID3DXEffect *effect = This->effect;
639
640 TRACE("Forward iface %p, effect %p\n", This, effect);
641
642 return effect->lpVtbl->SetMatrixTransposePointerArray(effect, parameter, matrix, count);
643 }
644
645 static HRESULT WINAPI ID3DXEffect25Impl_GetMatrixTransposePointerArray(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
646 {
647 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
648 ID3DXEffect *effect = This->effect;
649
650 TRACE("Forward iface %p, effect %p\n", This, effect);
651
652 return effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, matrix, count);
653 }
654
655 static HRESULT WINAPI ID3DXEffect25Impl_SetString(ID3DXEffect25 *iface, D3DXHANDLE parameter, LPCSTR string)
656 {
657 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
658 ID3DXEffect *effect = This->effect;
659
660 TRACE("Forward iface %p, effect %p\n", This, effect);
661
662 return effect->lpVtbl->SetString(effect, parameter, string);
663 }
664
665 static HRESULT WINAPI ID3DXEffect25Impl_GetString(ID3DXEffect25 *iface, D3DXHANDLE parameter, LPCSTR *string)
666 {
667 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
668 ID3DXEffect *effect = This->effect;
669
670 TRACE("Forward iface %p, effect %p\n", This, effect);
671
672 return effect->lpVtbl->GetString(effect, parameter, string);
673 }
674
675 static HRESULT WINAPI ID3DXEffect25Impl_SetTexture(ID3DXEffect25 *iface, D3DXHANDLE parameter, IDirect3DBaseTexture9 *texture)
676 {
677 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
678 ID3DXEffect *effect = This->effect;
679
680 TRACE("Forward iface %p, effect %p\n", This, effect);
681
682 return effect->lpVtbl->SetTexture(effect, parameter, texture);
683 }
684
685 static HRESULT WINAPI ID3DXEffect25Impl_GetTexture(ID3DXEffect25 *iface, D3DXHANDLE parameter, IDirect3DBaseTexture9 **texture)
686 {
687 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
688 ID3DXEffect *effect = This->effect;
689
690 TRACE("Forward iface %p, effect %p\n", This, effect);
691
692 return effect->lpVtbl->GetTexture(effect, parameter, texture);
693 }
694
695 static HRESULT WINAPI ID3DXEffect25Impl_GetPixelShader(ID3DXEffect25 *iface, D3DXHANDLE parameter, IDirect3DPixelShader9 **pshader)
696 {
697 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
698 ID3DXEffect *effect = This->effect;
699
700 TRACE("Forward iface %p, effect %p\n", This, effect);
701
702 return effect->lpVtbl->GetPixelShader(effect, parameter, pshader);
703 }
704
705 static HRESULT WINAPI ID3DXEffect25Impl_GetVertexShader(ID3DXEffect25 *iface, D3DXHANDLE parameter, IDirect3DVertexShader9 **vshader)
706 {
707 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
708 ID3DXEffect *effect = This->effect;
709
710 TRACE("Forward iface %p, effect %p\n", This, effect);
711
712 return effect->lpVtbl->GetVertexShader(effect, parameter, vshader);
713 }
714
715 static HRESULT WINAPI ID3DXEffect25Impl_SetArrayRange(ID3DXEffect25 *iface, D3DXHANDLE parameter, UINT start, UINT end)
716 {
717 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
718 ID3DXEffect *effect = This->effect;
719
720 TRACE("Forward iface %p, effect %p\n", This, effect);
721
722 return effect->lpVtbl->SetArrayRange(effect, parameter, start, end);
723 }
724
725 /*** ID3DXEffect25 methods ***/
726 static HRESULT WINAPI ID3DXEffect25Impl_GetPool(ID3DXEffect25 *iface, ID3DXEffectPool **pool)
727 {
728 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
729 ID3DXEffect *effect = This->effect;
730
731 TRACE("Forward iface %p, effect %p\n", This, effect);
732
733 return effect->lpVtbl->GetPool(effect, pool);
734 }
735
736 static HRESULT WINAPI ID3DXEffect25Impl_SetTechnique(ID3DXEffect25 *iface, D3DXHANDLE technique)
737 {
738 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
739 ID3DXEffect *effect = This->effect;
740
741 TRACE("Forward iface %p, effect %p\n", This, effect);
742
743 return effect->lpVtbl->SetTechnique(effect, technique);
744 }
745
746 static D3DXHANDLE WINAPI ID3DXEffect25Impl_GetCurrentTechnique(ID3DXEffect25 *iface)
747 {
748 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
749 ID3DXEffect *effect = This->effect;
750
751 TRACE("Forward iface %p, effect %p\n", This, effect);
752
753 return effect->lpVtbl->GetCurrentTechnique(effect);
754 }
755
756 static HRESULT WINAPI ID3DXEffect25Impl_ValidateTechnique(ID3DXEffect25 *iface, D3DXHANDLE technique)
757 {
758 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
759 ID3DXEffect *effect = This->effect;
760
761 TRACE("Forward iface %p, effect %p\n", This, effect);
762
763 return effect->lpVtbl->ValidateTechnique(effect, technique);
764 }
765
766 static HRESULT WINAPI ID3DXEffect25Impl_FindNextValidTechnique(ID3DXEffect25 *iface, D3DXHANDLE technique, D3DXHANDLE *next_technique)
767 {
768 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
769 ID3DXEffect *effect = This->effect;
770
771 TRACE("Forward iface %p, effect %p\n", This, effect);
772
773 return effect->lpVtbl->FindNextValidTechnique(effect, technique, next_technique);
774 }
775
776 static BOOL WINAPI ID3DXEffect25Impl_IsParameterUsed(ID3DXEffect25 *iface, D3DXHANDLE parameter, D3DXHANDLE technique)
777 {
778 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
779 ID3DXEffect *effect = This->effect;
780
781 TRACE("Forward iface %p, effect %p\n", This, effect);
782
783 return effect->lpVtbl->IsParameterUsed(effect, parameter, technique);
784 }
785
786 static HRESULT WINAPI ID3DXEffect25Impl_Begin(ID3DXEffect25 *iface, UINT *passes, DWORD flags)
787 {
788 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
789 ID3DXEffect *effect = This->effect;
790
791 TRACE("Forward iface %p, effect %p\n", This, effect);
792
793 return effect->lpVtbl->Begin(effect, passes, flags);
794 }
795
796 static HRESULT WINAPI ID3DXEffect25Impl_BeginPass(ID3DXEffect25 *iface, UINT pass)
797 {
798 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
799 ID3DXEffect *effect = This->effect;
800
801 TRACE("Forward iface %p, effect %p\n", This, effect);
802
803 return effect->lpVtbl->BeginPass(effect, pass);
804 }
805
806 static HRESULT WINAPI ID3DXEffect25Impl_CommitChanges(ID3DXEffect25 *iface)
807 {
808 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
809 ID3DXEffect *effect = This->effect;
810
811 TRACE("Forward iface %p, effect %p\n", This, effect);
812
813 return effect->lpVtbl->CommitChanges(effect);
814 }
815
816 static HRESULT WINAPI ID3DXEffect25Impl_EndPass(ID3DXEffect25 *iface)
817 {
818 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
819 ID3DXEffect *effect = This->effect;
820
821 TRACE("Forward iface %p, effect %p\n", This, effect);
822
823 return effect->lpVtbl->EndPass(effect);
824 }
825
826 static HRESULT WINAPI ID3DXEffect25Impl_End(ID3DXEffect25 *iface)
827 {
828 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
829 ID3DXEffect *effect = This->effect;
830
831 TRACE("Forward iface %p, effect %p\n", This, effect);
832
833 return effect->lpVtbl->End(effect);
834 }
835
836 static HRESULT WINAPI ID3DXEffect25Impl_GetDevice(ID3DXEffect25 *iface, IDirect3DDevice9 **device)
837 {
838 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
839 ID3DXEffect *effect = This->effect;
840
841 TRACE("Forward iface %p, effect %p\n", This, effect);
842
843 return effect->lpVtbl->GetDevice(effect, device);
844 }
845
846 static HRESULT WINAPI ID3DXEffect25Impl_OnLostDevice(ID3DXEffect25* iface)
847 {
848 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
849 ID3DXEffect *effect = This->effect;
850
851 TRACE("Forward iface %p, effect %p\n", This, effect);
852
853 return effect->lpVtbl->OnLostDevice(effect);
854 }
855
856 static HRESULT WINAPI ID3DXEffect25Impl_OnResetDevice(ID3DXEffect25* iface)
857 {
858 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
859 ID3DXEffect *effect = This->effect;
860
861 TRACE("Forward iface %p, effect %p\n", This, effect);
862
863 return effect->lpVtbl->OnResetDevice(effect);
864 }
865
866 static HRESULT WINAPI ID3DXEffect25Impl_SetStateManager(ID3DXEffect25 *iface, ID3DXEffectStateManager *manager)
867 {
868 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
869 ID3DXEffect *effect = This->effect;
870
871 TRACE("Forward iface %p, effect %p\n", This, effect);
872
873 return effect->lpVtbl->SetStateManager(effect, manager);
874 }
875
876 static HRESULT WINAPI ID3DXEffect25Impl_GetStateManager(ID3DXEffect25 *iface, ID3DXEffectStateManager **manager)
877 {
878 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
879 ID3DXEffect *effect = This->effect;
880
881 TRACE("Forward iface %p, effect %p\n", This, effect);
882
883 return effect->lpVtbl->GetStateManager(effect, manager);
884 }
885
886 static HRESULT WINAPI ID3DXEffect25Impl_BeginParameterBlock(ID3DXEffect25 *iface)
887 {
888 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
889 ID3DXEffect *effect = This->effect;
890
891 TRACE("Forward iface %p, effect %p\n", This, effect);
892
893 return effect->lpVtbl->BeginParameterBlock(effect);
894 }
895
896 static D3DXHANDLE WINAPI ID3DXEffect25Impl_EndParameterBlock(ID3DXEffect25 *iface)
897 {
898 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
899 ID3DXEffect *effect = This->effect;
900
901 TRACE("Forward iface %p, effect %p\n", This, effect);
902
903 return effect->lpVtbl->EndParameterBlock(effect);
904 }
905
906 static HRESULT WINAPI ID3DXEffect25Impl_ApplyParameterBlock(ID3DXEffect25 *iface, D3DXHANDLE parameter_block)
907 {
908 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
909 ID3DXEffect *effect = This->effect;
910
911 TRACE("Forward iface %p, effect %p\n", This, effect);
912
913 return effect->lpVtbl->ApplyParameterBlock(effect, parameter_block);
914 }
915
916 static HRESULT WINAPI ID3DXEffect25Impl_CloneEffect(ID3DXEffect25 *iface, IDirect3DDevice9 *device, ID3DXEffect25 **clone)
917 {
918 struct ID3DXEffect25Impl *This = impl_from_ID3DXEffect25(iface);
919 ID3DXEffect *effect = This->effect;
920 struct ID3DXEffect25Impl *object;
921 HRESULT hr;
922
923 TRACE("Forward iface %p, effect %p\n", This, effect);
924
925 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
926 if (!object)
927 {
928 ERR("Out of memory\n");
929 return E_OUTOFMEMORY;
930 }
931
932 object->ID3DXEffect25_iface.lpVtbl = &ID3DXEffect25_Vtbl;
933 object->ref = 1;
934
935 hr = effect->lpVtbl->CloneEffect(effect, device, &object->effect);
936 if (FAILED(hr))
937 {
938 WARN("Failed to clone effect\n");
939 HeapFree(GetProcessHeap(), 0, object);
940 return hr;
941 }
942
943 *clone = &object->ID3DXEffect25_iface;
944
945 TRACE("Created ID3DXEffect %p\n", clone);
946
947 return hr;
948 }
949
950 static const struct ID3DXEffect25Vtbl ID3DXEffect25_Vtbl =
951 {
952 /*** IUnknown methods ***/
953 ID3DXEffect25Impl_QueryInterface,
954 ID3DXEffect25Impl_AddRef,
955 ID3DXEffect25Impl_Release,
956 /*** ID3DXBaseEffect methods ***/
957 ID3DXEffect25Impl_GetDesc,
958 ID3DXEffect25Impl_GetParameterDesc,
959 ID3DXEffect25Impl_GetTechniqueDesc,
960 ID3DXEffect25Impl_GetPassDesc,
961 ID3DXEffect25Impl_GetFunctionDesc,
962 ID3DXEffect25Impl_GetParameter,
963 ID3DXEffect25Impl_GetParameterByName,
964 ID3DXEffect25Impl_GetParameterBySemantic,
965 ID3DXEffect25Impl_GetParameterElement,
966 ID3DXEffect25Impl_GetTechnique,
967 ID3DXEffect25Impl_GetTechniqueByName,
968 ID3DXEffect25Impl_GetPass,
969 ID3DXEffect25Impl_GetPassByName,
970 ID3DXEffect25Impl_GetFunction,
971 ID3DXEffect25Impl_GetFunctionByName,
972 ID3DXEffect25Impl_GetAnnotation,
973 ID3DXEffect25Impl_GetAnnotationByName,
974 ID3DXEffect25Impl_SetValue,
975 ID3DXEffect25Impl_GetValue,
976 ID3DXEffect25Impl_SetBool,
977 ID3DXEffect25Impl_GetBool,
978 ID3DXEffect25Impl_SetBoolArray,
979 ID3DXEffect25Impl_GetBoolArray,
980 ID3DXEffect25Impl_SetInt,
981 ID3DXEffect25Impl_GetInt,
982 ID3DXEffect25Impl_SetIntArray,
983 ID3DXEffect25Impl_GetIntArray,
984 ID3DXEffect25Impl_SetFloat,
985 ID3DXEffect25Impl_GetFloat,
986 ID3DXEffect25Impl_SetFloatArray,
987 ID3DXEffect25Impl_GetFloatArray,
988 ID3DXEffect25Impl_SetVector,
989 ID3DXEffect25Impl_GetVector,
990 ID3DXEffect25Impl_SetVectorArray,
991 ID3DXEffect25Impl_GetVectorArray,
992 ID3DXEffect25Impl_SetMatrix,
993 ID3DXEffect25Impl_GetMatrix,
994 ID3DXEffect25Impl_SetMatrixArray,
995 ID3DXEffect25Impl_GetMatrixArray,
996 ID3DXEffect25Impl_SetMatrixPointerArray,
997 ID3DXEffect25Impl_GetMatrixPointerArray,
998 ID3DXEffect25Impl_SetMatrixTranspose,
999 ID3DXEffect25Impl_GetMatrixTranspose,
1000 ID3DXEffect25Impl_SetMatrixTransposeArray,
1001 ID3DXEffect25Impl_GetMatrixTransposeArray,
1002 ID3DXEffect25Impl_SetMatrixTransposePointerArray,
1003 ID3DXEffect25Impl_GetMatrixTransposePointerArray,
1004 ID3DXEffect25Impl_SetString,
1005 ID3DXEffect25Impl_GetString,
1006 ID3DXEffect25Impl_SetTexture,
1007 ID3DXEffect25Impl_GetTexture,
1008 ID3DXEffect25Impl_GetPixelShader,
1009 ID3DXEffect25Impl_GetVertexShader,
1010 ID3DXEffect25Impl_SetArrayRange,
1011 /*** ID3DXEffect25 methods ***/
1012 ID3DXEffect25Impl_GetPool,
1013 ID3DXEffect25Impl_SetTechnique,
1014 ID3DXEffect25Impl_GetCurrentTechnique,
1015 ID3DXEffect25Impl_ValidateTechnique,
1016 ID3DXEffect25Impl_FindNextValidTechnique,
1017 ID3DXEffect25Impl_IsParameterUsed,
1018 ID3DXEffect25Impl_Begin,
1019 ID3DXEffect25Impl_BeginPass,
1020 ID3DXEffect25Impl_CommitChanges,
1021 ID3DXEffect25Impl_EndPass,
1022 ID3DXEffect25Impl_End,
1023 ID3DXEffect25Impl_GetDevice,
1024 ID3DXEffect25Impl_OnLostDevice,
1025 ID3DXEffect25Impl_OnResetDevice,
1026 ID3DXEffect25Impl_SetStateManager,
1027 ID3DXEffect25Impl_GetStateManager,
1028 ID3DXEffect25Impl_BeginParameterBlock,
1029 ID3DXEffect25Impl_EndParameterBlock,
1030 ID3DXEffect25Impl_ApplyParameterBlock,
1031 ID3DXEffect25Impl_CloneEffect,
1032 };
1033
1034 HRESULT WINAPI D3DXCreateEffectEx25(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatalen,
1035 const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants, DWORD flags,
1036 struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1037 {
1038 struct ID3DXEffect25Impl *object;
1039 HRESULT hr;
1040
1041 TRACE("device %p, srcdata %p, srcdatalen %u, defines %p, include %p, "
1042 "skip_constants %s, flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1043 device, srcdata, srcdatalen, defines, include,
1044 debugstr_a(skip_constants), flags, pool, effect, compilation_errors);
1045
1046 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1047 if (!object)
1048 {
1049 ERR("Out of memory\n");
1050 return E_OUTOFMEMORY;
1051 }
1052
1053 object->ID3DXEffect25_iface.lpVtbl = &ID3DXEffect25_Vtbl;
1054 object->ref = 1;
1055
1056 hr = D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include,
1057 skip_constants, flags, pool, &object->effect, compilation_errors);
1058 if (FAILED(hr))
1059 {
1060 WARN("Failed to create effect\n");
1061 HeapFree(GetProcessHeap(), 0, object);
1062 return hr;
1063 }
1064
1065 *effect = &object->ID3DXEffect25_iface;
1066 TRACE("Created ID3DXEffect25 %p\n", object);
1067 return hr;
1068 }
1069
1070 HRESULT WINAPI D3DXCreateEffect25(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatalen,
1071 const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags,
1072 struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1073 {
1074 TRACE("device %p, srcdata %p, srcdatalen %u, defines %p, include %p, "
1075 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1076 device, srcdata, srcdatalen, defines, include, flags, pool, effect, compilation_errors);
1077
1078 return D3DXCreateEffectEx25(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
1079 }
1080
1081
1082 HRESULT WINAPI D3DXCreateEffectFromFileExW25(struct IDirect3DDevice9 *device, const WCHAR *srcfile,
1083 const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants, DWORD flags,
1084 struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1085 {
1086 struct ID3DXEffect25Impl *object;
1087 HRESULT hr;
1088
1089 TRACE("device %p, srcfile %s, defines %p, include %p, skip_constants %s, "
1090 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1091 device, debugstr_w(srcfile), defines, include, debugstr_a(skip_constants),
1092 flags, pool, effect, compilation_errors);
1093
1094 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1095 if (!object)
1096 {
1097 ERR("Out of memory\n");
1098 return E_OUTOFMEMORY;
1099 }
1100
1101 object->ID3DXEffect25_iface.lpVtbl = &ID3DXEffect25_Vtbl;
1102 object->ref = 1;
1103
1104 hr = D3DXCreateEffectFromFileExW(device, srcfile, defines, include,
1105 skip_constants, flags, pool, &object->effect, compilation_errors);
1106 if (FAILED(hr))
1107 {
1108 WARN("Failed to create effect\n");
1109 HeapFree(GetProcessHeap(), 0, object);
1110 return hr;
1111 }
1112
1113 *effect = &object->ID3DXEffect25_iface;
1114 TRACE("Created ID3DXEffect25 %p\n", object);
1115 return hr;
1116 }
1117
1118 HRESULT WINAPI D3DXCreateEffectFromFileExA25(struct IDirect3DDevice9 *device, const char *srcfile,
1119 const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants, DWORD flags,
1120 struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1121 {
1122 struct ID3DXEffect25Impl *object;
1123 HRESULT hr;
1124
1125 TRACE("device %p, srcfile %s, defines %p, include %p, skip_constants %s, "
1126 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1127 device, debugstr_a(srcfile), defines, include, debugstr_a(skip_constants),
1128 flags, pool, effect, compilation_errors);
1129
1130 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1131 if (!object)
1132 {
1133 ERR("Out of memory\n");
1134 return E_OUTOFMEMORY;
1135 }
1136
1137 object->ID3DXEffect25_iface.lpVtbl = &ID3DXEffect25_Vtbl;
1138 object->ref = 1;
1139
1140 hr = D3DXCreateEffectFromFileExA(device, srcfile, defines, include, skip_constants, flags,
1141 pool, &object->effect, compilation_errors);
1142 if (FAILED(hr))
1143 {
1144 WARN("Failed to create effect\n");
1145 HeapFree(GetProcessHeap(), 0, object);
1146 return hr;
1147 }
1148
1149 *effect = &object->ID3DXEffect25_iface;
1150 TRACE("Created ID3DXEffect25 %p\n", object);
1151 return hr;
1152 }
1153
1154 HRESULT WINAPI D3DXCreateEffectFromFileW25(struct IDirect3DDevice9 *device, const WCHAR *srcfile,
1155 const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool,
1156 struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1157 {
1158 TRACE("device %p, srcfile %s, defines %p, include %p, "
1159 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1160 device, debugstr_w(srcfile), defines, include, flags, pool, effect, compilation_errors);
1161
1162 return D3DXCreateEffectFromFileExW25(device, srcfile, defines, include, NULL, flags, pool, effect, compilation_errors);
1163 }
1164
1165 HRESULT WINAPI D3DXCreateEffectFromFileA25(struct IDirect3DDevice9 *device, const char *srcfile,
1166 const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool,
1167 struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1168 {
1169 TRACE("device %p, srcfile %s, defines %p, include %p, "
1170 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1171 device, debugstr_a(srcfile), defines, include, flags, pool, effect, compilation_errors);
1172
1173 return D3DXCreateEffectFromFileExA25(device, srcfile, defines, include, NULL, flags, pool, effect, compilation_errors);
1174 }
1175
1176 HRESULT WINAPI D3DXCreateEffectFromResourceExW25(struct IDirect3DDevice9 *device, HMODULE srcmodule,
1177 const WCHAR *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants,
1178 DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1179 {
1180 struct ID3DXEffect25Impl *object;
1181 HRESULT hr;
1182
1183 TRACE("device %p, srcmodule %p, srcresource %s, defines %p, include %p, skip_constants %s, "
1184 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1185 device, srcmodule, debugstr_w(srcresource), defines, include, debugstr_a(skip_constants),
1186 flags, pool, effect, compilation_errors);
1187
1188 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1189 if (!object)
1190 {
1191 ERR("Out of memory\n");
1192 return E_OUTOFMEMORY;
1193 }
1194
1195 object->ID3DXEffect25_iface.lpVtbl = &ID3DXEffect25_Vtbl;
1196 object->ref = 1;
1197
1198 hr = D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include,
1199 skip_constants, flags, pool, &object->effect, compilation_errors);
1200 if (FAILED(hr))
1201 {
1202 WARN("Failed to create effect\n");
1203 HeapFree(GetProcessHeap(), 0, object);
1204 return hr;
1205 }
1206
1207 *effect = &object->ID3DXEffect25_iface;
1208 TRACE("Created ID3DXEffect25 %p\n", object);
1209 return hr;
1210 }
1211
1212 HRESULT WINAPI D3DXCreateEffectFromResourceExA25(struct IDirect3DDevice9 *device, HMODULE srcmodule,
1213 const char *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants,
1214 DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1215 {
1216 struct ID3DXEffect25Impl *object;
1217 HRESULT hr;
1218
1219 TRACE("device %p, srcmodule %p, srcresource %s, defines %p, include %p, skip_constants %s, "
1220 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1221 device, srcmodule, debugstr_a(srcresource), defines, include, debugstr_a(skip_constants),
1222 flags, pool, effect, compilation_errors);
1223
1224 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
1225 if (!object)
1226 {
1227 ERR("Out of memory\n");
1228 return E_OUTOFMEMORY;
1229 }
1230
1231 object->ID3DXEffect25_iface.lpVtbl = &ID3DXEffect25_Vtbl;
1232 object->ref = 1;
1233
1234 hr = D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include,
1235 skip_constants, flags, pool, &object->effect, compilation_errors);
1236 if (FAILED(hr))
1237 {
1238 WARN("Failed to create effect\n");
1239 HeapFree(GetProcessHeap(), 0, object);
1240 return hr;
1241 }
1242
1243 *effect = &object->ID3DXEffect25_iface;
1244 TRACE("Created ID3DXEffect25 %p\n", object);
1245 return hr;
1246 }
1247
1248 HRESULT WINAPI D3DXCreateEffectFromResourceW25(struct IDirect3DDevice9 *device, HMODULE srcmodule,
1249 const WCHAR *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags,
1250 struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1251 {
1252 TRACE("device %p, srcmodule %p, srcresource %s, defines %p, include %p, "
1253 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1254 device, srcmodule, debugstr_w(srcresource), defines, include,
1255 flags, pool, effect, compilation_errors);
1256
1257 return D3DXCreateEffectFromResourceExW25(device, srcmodule, srcresource, defines, include, NULL,
1258 flags, pool, effect, compilation_errors);
1259 }
1260
1261 HRESULT WINAPI D3DXCreateEffectFromResourceA25(struct IDirect3DDevice9 *device, HMODULE srcmodule,
1262 const char *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags,
1263 struct ID3DXEffectPool *pool, struct ID3DXEffect25 **effect, struct ID3DXBuffer **compilation_errors)
1264 {
1265 TRACE("device %p, srcmodule %p, srcresource %s, defines %p, include %p, "
1266 "flags %#x, pool %p, effect %p, compilation_errors %p.\n",
1267 device, srcmodule, debugstr_a(srcresource), defines, include,
1268 flags, pool, effect, compilation_errors);
1269
1270 return D3DXCreateEffectFromResourceExA25(device, srcmodule, srcresource, defines, include, NULL,
1271 flags, pool, effect, compilation_errors);
1272 }
1273
1274 HRESULT WINAPI D3DXDisassembleEffect25(ID3DXEffect25 *effect, BOOL enable_color_code, ID3DXBuffer **disassembly)
1275 {
1276 struct ID3DXEffect25Impl *object = impl_from_ID3DXEffect25(effect);
1277
1278 TRACE("effect %p, enable_color_code %u, disassembly %p.\n",
1279 effect, enable_color_code, disassembly);
1280
1281 return D3DXDisassembleEffect(object->effect, enable_color_code, disassembly);
1282 }