wined3d: Remove COM from the shader implementation.
[wine] / dlls / d3dx9_36 / effect.c
1 /*
2  * Copyright 2010 Christian Costa
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "config.h"
20 #include "wine/port.h"
21 #include "wine/debug.h"
22 #include "wine/unicode.h"
23 #include "windef.h"
24 #include "wingdi.h"
25 #include "d3dx9_36_private.h"
26
27 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
28
29 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl;
30 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl;
31 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl;
32
33 struct ID3DXBaseEffectImpl
34 {
35     ID3DXBaseEffect ID3DXBaseEffect_iface;
36     LONG ref;
37
38     struct ID3DXEffectImpl *effect;
39
40     UINT parameter_count;
41     UINT technique_count;
42 };
43
44 struct ID3DXEffectImpl
45 {
46     ID3DXEffect ID3DXEffect_iface;
47     LONG ref;
48
49     LPDIRECT3DDEVICE9 device;
50     LPD3DXEFFECTPOOL pool;
51
52     ID3DXBaseEffect *base_effect;
53 };
54
55 struct ID3DXEffectCompilerImpl
56 {
57     ID3DXEffectCompiler ID3DXEffectCompiler_iface;
58     LONG ref;
59
60     ID3DXBaseEffect *base_effect;
61 };
62
63 static inline void read_dword(const char **ptr, DWORD *d)
64 {
65     memcpy(d, *ptr, sizeof(*d));
66     *ptr += sizeof(*d);
67 }
68
69 static void skip_dword_unknown(const char **ptr, unsigned int count)
70 {
71     unsigned int i;
72     DWORD d;
73
74     FIXME("Skipping %u unknown DWORDs:\n", count);
75     for (i = 0; i < count; ++i)
76     {
77         read_dword(ptr, &d);
78         FIXME("\t0x%08x\n", d);
79     }
80 }
81
82 static void free_effect(struct ID3DXEffectImpl *effect)
83 {
84     TRACE("Free effect %p\n", effect);
85
86     if (effect->base_effect)
87     {
88         effect->base_effect->lpVtbl->Release(effect->base_effect);
89     }
90
91     if (effect->pool)
92     {
93         effect->pool->lpVtbl->Release(effect->pool);
94     }
95
96     IDirect3DDevice9_Release(effect->device);
97 }
98
99 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
100 {
101     TRACE("Free effect compiler %p\n", compiler);
102
103     if (compiler->base_effect)
104     {
105         compiler->base_effect->lpVtbl->Release(compiler->base_effect);
106     }
107 }
108
109 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
110 {
111     return (0xfeff0000 | ((major) << 8) | (minor));
112 }
113
114 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
115 {
116     return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
117 }
118
119 /*** IUnknown methods ***/
120 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
121 {
122     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
123
124     TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
125
126     if (IsEqualGUID(riid, &IID_IUnknown) ||
127         IsEqualGUID(riid, &IID_ID3DXBaseEffect))
128     {
129         This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
130         *object = This;
131         return S_OK;
132     }
133
134     ERR("Interface %s not found\n", debugstr_guid(riid));
135
136     return E_NOINTERFACE;
137 }
138
139 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
140 {
141     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
142
143     TRACE("iface %p: AddRef from %u\n", iface, This->ref);
144
145     return InterlockedIncrement(&This->ref);
146 }
147
148 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
149 {
150     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
151     ULONG ref = InterlockedDecrement(&This->ref);
152
153     TRACE("iface %p: Release from %u\n", iface, ref + 1);
154
155     if (!ref)
156     {
157         HeapFree(GetProcessHeap(), 0, This);
158     }
159
160     return ref;
161 }
162
163 /*** ID3DXBaseEffect methods ***/
164 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
165 {
166     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
167
168     FIXME("iface %p, desc %p stub\n", This, desc);
169
170     return E_NOTIMPL;
171 }
172
173 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
174 {
175     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
176
177     FIXME("iface %p, parameter %p, desc %p stub\n", This, parameter, desc);
178
179     return E_NOTIMPL;
180 }
181
182 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
183 {
184     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
185
186     FIXME("iface %p, technique %p, desc %p stub\n", This, technique, desc);
187
188     return E_NOTIMPL;
189 }
190
191 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
192 {
193     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
194
195     FIXME("iface %p, pass %p, desc %p stub\n", This, pass, desc);
196
197     return E_NOTIMPL;
198 }
199
200 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
201 {
202     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
203
204     FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
205
206     return E_NOTIMPL;
207 }
208
209 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
210 {
211     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
212
213     FIXME("iface %p, parameter %p, index %u stub\n", This, parameter, index);
214
215     return NULL;
216 }
217
218 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
219 {
220     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
221
222     FIXME("iface %p, parameter %p, name %s stub\n", This, parameter, debugstr_a(name));
223
224     return NULL;
225 }
226
227 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
228 {
229     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
230
231     FIXME("iface %p, parameter %p, semantic %s stub\n", This, parameter, debugstr_a(semantic));
232
233     return NULL;
234 }
235
236 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
237 {
238     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
239
240     FIXME("iface %p, parameter %p, index %u stub\n", This, parameter, index);
241
242     return NULL;
243 }
244
245 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
246 {
247     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
248
249     FIXME("iface %p, index %u stub\n", This, index);
250
251     return NULL;
252 }
253
254 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
255 {
256     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
257
258     FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
259
260     return NULL;
261 }
262
263 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
264 {
265     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
266
267     FIXME("iface %p, technique %p, index %u stub\n", This, technique, index);
268
269     return NULL;
270 }
271
272 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
273 {
274     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
275
276     FIXME("iface %p, technique %p, name %s stub\n", This, technique, debugstr_a(name));
277
278     return NULL;
279 }
280
281 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
282 {
283     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
284
285     FIXME("iface %p, index %u stub\n", This, index);
286
287     return NULL;
288 }
289
290 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
291 {
292     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
293
294     FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
295
296     return NULL;
297 }
298
299 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
300 {
301     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
302
303     FIXME("iface %p, object %p, index %u stub\n", This, object, index);
304
305     return NULL;
306 }
307
308 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
309 {
310     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
311
312     FIXME("iface %p, object %p, name %s stub\n", This, object, debugstr_a(name));
313
314     return NULL;
315 }
316
317 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
318 {
319     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
320
321     FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
322
323     return E_NOTIMPL;
324 }
325
326 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
327 {
328     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
329
330     FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
331
332     return E_NOTIMPL;
333 }
334
335 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
336 {
337     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
338
339     FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
340
341     return E_NOTIMPL;
342 }
343
344 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
345 {
346     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
347
348     FIXME("iface %p, parameter %p, b %p stub\n", This, parameter, b);
349
350     return E_NOTIMPL;
351 }
352
353 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
354 {
355     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
356
357     FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
358
359     return E_NOTIMPL;
360 }
361
362 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
363 {
364     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
365
366     FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
367
368     return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
372 {
373     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
374
375     FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
376
377     return E_NOTIMPL;
378 }
379
380 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
381 {
382     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
383
384     FIXME("iface %p, parameter %p, n %p stub\n", This, parameter, n);
385
386     return E_NOTIMPL;
387 }
388
389 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
390 {
391     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
392
393     FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
394
395     return E_NOTIMPL;
396 }
397
398 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
399 {
400     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
401
402     FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
403
404     return E_NOTIMPL;
405 }
406
407 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
408 {
409     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
410
411     FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
412
413     return E_NOTIMPL;
414 }
415
416 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
417 {
418     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
419
420     FIXME("iface %p, parameter %p, f %p stub\n", This, parameter, f);
421
422     return E_NOTIMPL;
423 }
424
425 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
426 {
427     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
428
429     FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
430
431     return E_NOTIMPL;
432 }
433
434 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
435 {
436     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
437
438     FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
439
440     return E_NOTIMPL;
441 }
442
443 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
444 {
445     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
446
447     FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
448
449     return E_NOTIMPL;
450 }
451
452 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
453 {
454     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
455
456     FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
457
458     return E_NOTIMPL;
459 }
460
461 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
462 {
463     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
464
465     FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
466
467     return E_NOTIMPL;
468 }
469
470 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
471 {
472     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
473
474     FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
475
476     return E_NOTIMPL;
477 }
478
479 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
480 {
481     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
482
483     FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
484
485     return E_NOTIMPL;
486 }
487
488 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
489 {
490     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
491
492     FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
493
494     return E_NOTIMPL;
495 }
496
497 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
498 {
499     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
500
501     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
502
503     return E_NOTIMPL;
504 }
505
506 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
507 {
508     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
509
510     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
511
512     return E_NOTIMPL;
513 }
514
515 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
516 {
517     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
518
519     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
520
521     return E_NOTIMPL;
522 }
523
524 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
525 {
526     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
527
528     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
529
530     return E_NOTIMPL;
531 }
532
533 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
534 {
535     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
536
537     FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
538
539     return E_NOTIMPL;
540 }
541
542 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
543 {
544     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
545
546     FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
547
548     return E_NOTIMPL;
549 }
550
551 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
552 {
553     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
554
555     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
556
557     return E_NOTIMPL;
558 }
559
560 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
561 {
562     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
563
564     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
565
566     return E_NOTIMPL;
567 }
568
569 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
570 {
571     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
572
573     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
574
575     return E_NOTIMPL;
576 }
577
578 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
579 {
580     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
581
582     FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
583
584     return E_NOTIMPL;
585 }
586
587 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
588 {
589     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
590
591     FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
592
593     return E_NOTIMPL;
594 }
595
596 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
597 {
598     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
599
600     FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
601
602     return E_NOTIMPL;
603 }
604
605 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
606 {
607     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
608
609     FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
610
611     return E_NOTIMPL;
612 }
613
614 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
615 {
616     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
617
618     FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
619
620     return E_NOTIMPL;
621 }
622
623 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
624 {
625     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
626
627     FIXME("iface %p, parameter %p, pshader %p stub\n", This, parameter, pshader);
628
629     return E_NOTIMPL;
630 }
631
632 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
633 {
634     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
635
636     FIXME("iface %p, parameter %p, vshader %p stub\n", This, parameter, vshader);
637
638     return E_NOTIMPL;
639 }
640
641 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
642 {
643     struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
644
645     FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
646
647     return E_NOTIMPL;
648 }
649
650 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
651 {
652     /*** IUnknown methods ***/
653     ID3DXBaseEffectImpl_QueryInterface,
654     ID3DXBaseEffectImpl_AddRef,
655     ID3DXBaseEffectImpl_Release,
656     /*** ID3DXBaseEffect methods ***/
657     ID3DXBaseEffectImpl_GetDesc,
658     ID3DXBaseEffectImpl_GetParameterDesc,
659     ID3DXBaseEffectImpl_GetTechniqueDesc,
660     ID3DXBaseEffectImpl_GetPassDesc,
661     ID3DXBaseEffectImpl_GetFunctionDesc,
662     ID3DXBaseEffectImpl_GetParameter,
663     ID3DXBaseEffectImpl_GetParameterByName,
664     ID3DXBaseEffectImpl_GetParameterBySemantic,
665     ID3DXBaseEffectImpl_GetParameterElement,
666     ID3DXBaseEffectImpl_GetTechnique,
667     ID3DXBaseEffectImpl_GetTechniqueByName,
668     ID3DXBaseEffectImpl_GetPass,
669     ID3DXBaseEffectImpl_GetPassByName,
670     ID3DXBaseEffectImpl_GetFunction,
671     ID3DXBaseEffectImpl_GetFunctionByName,
672     ID3DXBaseEffectImpl_GetAnnotation,
673     ID3DXBaseEffectImpl_GetAnnotationByName,
674     ID3DXBaseEffectImpl_SetValue,
675     ID3DXBaseEffectImpl_GetValue,
676     ID3DXBaseEffectImpl_SetBool,
677     ID3DXBaseEffectImpl_GetBool,
678     ID3DXBaseEffectImpl_SetBoolArray,
679     ID3DXBaseEffectImpl_GetBoolArray,
680     ID3DXBaseEffectImpl_SetInt,
681     ID3DXBaseEffectImpl_GetInt,
682     ID3DXBaseEffectImpl_SetIntArray,
683     ID3DXBaseEffectImpl_GetIntArray,
684     ID3DXBaseEffectImpl_SetFloat,
685     ID3DXBaseEffectImpl_GetFloat,
686     ID3DXBaseEffectImpl_SetFloatArray,
687     ID3DXBaseEffectImpl_GetFloatArray,
688     ID3DXBaseEffectImpl_SetVector,
689     ID3DXBaseEffectImpl_GetVector,
690     ID3DXBaseEffectImpl_SetVectorArray,
691     ID3DXBaseEffectImpl_GetVectorArray,
692     ID3DXBaseEffectImpl_SetMatrix,
693     ID3DXBaseEffectImpl_GetMatrix,
694     ID3DXBaseEffectImpl_SetMatrixArray,
695     ID3DXBaseEffectImpl_GetMatrixArray,
696     ID3DXBaseEffectImpl_SetMatrixPointerArray,
697     ID3DXBaseEffectImpl_GetMatrixPointerArray,
698     ID3DXBaseEffectImpl_SetMatrixTranspose,
699     ID3DXBaseEffectImpl_GetMatrixTranspose,
700     ID3DXBaseEffectImpl_SetMatrixTransposeArray,
701     ID3DXBaseEffectImpl_GetMatrixTransposeArray,
702     ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
703     ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
704     ID3DXBaseEffectImpl_SetString,
705     ID3DXBaseEffectImpl_GetString,
706     ID3DXBaseEffectImpl_SetTexture,
707     ID3DXBaseEffectImpl_GetTexture,
708     ID3DXBaseEffectImpl_GetPixelShader,
709     ID3DXBaseEffectImpl_GetVertexShader,
710     ID3DXBaseEffectImpl_SetArrayRange,
711 };
712
713 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
714 {
715     return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
716 }
717
718 /*** IUnknown methods ***/
719 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
720 {
721     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
722
723     TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
724
725     if (IsEqualGUID(riid, &IID_IUnknown) ||
726         IsEqualGUID(riid, &IID_ID3DXEffect))
727     {
728         This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
729         *object = This;
730         return S_OK;
731     }
732
733     ERR("Interface %s not found\n", debugstr_guid(riid));
734
735     return E_NOINTERFACE;
736 }
737
738 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
739 {
740     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
741
742     TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
743
744     return InterlockedIncrement(&This->ref);
745 }
746
747 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
748 {
749     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
750     ULONG ref = InterlockedDecrement(&This->ref);
751
752     TRACE("(%p)->(): Release from %u\n", This, ref + 1);
753
754     if (!ref)
755     {
756         free_effect(This);
757         HeapFree(GetProcessHeap(), 0, This);
758     }
759
760     return ref;
761 }
762
763 /*** ID3DXBaseEffect methods ***/
764 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
765 {
766     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
767     ID3DXBaseEffect *base = This->base_effect;
768
769     TRACE("Forward iface %p, base %p\n", This, base);
770
771     return ID3DXBaseEffectImpl_GetDesc(base, desc);
772 }
773
774 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
775 {
776     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
777     ID3DXBaseEffect *base = This->base_effect;
778
779     TRACE("Forward iface %p, base %p\n", This, base);
780
781     return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
782 }
783
784 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
785 {
786     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
787     ID3DXBaseEffect *base = This->base_effect;
788
789     TRACE("Forward iface %p, base %p\n", This, base);
790
791     return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
792 }
793
794 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
795 {
796     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
797     ID3DXBaseEffect *base = This->base_effect;
798
799     TRACE("Forward iface %p, base %p\n", This, base);
800
801     return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
802 }
803
804 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
805 {
806     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
807     ID3DXBaseEffect *base = This->base_effect;
808
809     TRACE("Forward iface %p, base %p\n", This, base);
810
811     return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
812 }
813
814 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
815 {
816     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
817     ID3DXBaseEffect *base = This->base_effect;
818
819     TRACE("Forward iface %p, base %p\n", This, base);
820
821     return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
822 }
823
824 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
825 {
826     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
827     ID3DXBaseEffect *base = This->base_effect;
828
829     TRACE("Forward iface %p, base %p\n", This, base);
830
831     return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
832 }
833
834 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
835 {
836     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
837     ID3DXBaseEffect *base = This->base_effect;
838
839     TRACE("Forward iface %p, base %p\n", This, base);
840
841     return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
842 }
843
844 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
845 {
846     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
847     ID3DXBaseEffect *base = This->base_effect;
848
849     TRACE("Forward iface %p, base %p\n", This, base);
850
851     return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
852 }
853
854 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
855 {
856     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
857     ID3DXBaseEffect *base = This->base_effect;
858
859     TRACE("Forward iface %p, base %p\n", This, base);
860
861     return ID3DXBaseEffectImpl_GetTechnique(base, index);
862 }
863
864 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
865 {
866     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
867     ID3DXBaseEffect *base = This->base_effect;
868
869     TRACE("Forward iface %p, base %p\n", This, base);
870
871     return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
872 }
873
874 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
875 {
876     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
877     ID3DXBaseEffect *base = This->base_effect;
878
879     TRACE("Forward iface %p, base %p\n", This, base);
880
881     return ID3DXBaseEffectImpl_GetPass(base, technique, index);
882 }
883
884 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
885 {
886     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
887     ID3DXBaseEffect *base = This->base_effect;
888
889     TRACE("Forward iface %p, base %p\n", This, base);
890
891     return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
892 }
893
894 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
895 {
896     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
897     ID3DXBaseEffect *base = This->base_effect;
898
899     TRACE("Forward iface %p, base %p\n", This, base);
900
901     return ID3DXBaseEffectImpl_GetFunction(base, index);
902 }
903
904 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
905 {
906     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
907     ID3DXBaseEffect *base = This->base_effect;
908
909     TRACE("Forward iface %p, base %p\n", This, base);
910
911     return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
912 }
913
914 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
915 {
916     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
917     ID3DXBaseEffect *base = This->base_effect;
918
919     TRACE("Forward iface %p, base %p\n", This, base);
920
921     return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
922 }
923
924 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
925 {
926     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
927     ID3DXBaseEffect *base = This->base_effect;
928
929     TRACE("Forward iface %p, base %p\n", This, base);
930
931     return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
932 }
933
934 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
935 {
936     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
937     ID3DXBaseEffect *base = This->base_effect;
938
939     TRACE("Forward iface %p, base %p\n", This, base);
940
941     return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
942 }
943
944 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
945 {
946     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
947     ID3DXBaseEffect *base = This->base_effect;
948
949     TRACE("Forward iface %p, base %p\n", This, base);
950
951     return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
952 }
953
954 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
955 {
956     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
957     ID3DXBaseEffect *base = This->base_effect;
958
959     TRACE("Forward iface %p, base %p\n", This, base);
960
961     return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
962 }
963
964 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
965 {
966     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
967     ID3DXBaseEffect *base = This->base_effect;
968
969     TRACE("Forward iface %p, base %p\n", This, base);
970
971     return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
972 }
973
974 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
975 {
976     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
977     ID3DXBaseEffect *base = This->base_effect;
978
979     TRACE("Forward iface %p, base %p\n", This, base);
980
981     return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
982 }
983
984 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
985 {
986     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
987     ID3DXBaseEffect *base = This->base_effect;
988
989     TRACE("Forward iface %p, base %p\n", This, base);
990
991     return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
992 }
993
994 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
995 {
996     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
997     ID3DXBaseEffect *base = This->base_effect;
998
999     TRACE("Forward iface %p, base %p\n", This, base);
1000
1001     return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1002 }
1003
1004 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1005 {
1006     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1007     ID3DXBaseEffect *base = This->base_effect;
1008
1009     TRACE("Forward iface %p, base %p\n", This, base);
1010
1011     return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1012 }
1013
1014 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1015 {
1016     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1017     ID3DXBaseEffect *base = This->base_effect;
1018
1019     TRACE("Forward iface %p, base %p\n", This, base);
1020
1021     return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1022 }
1023
1024 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1025 {
1026     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1027     ID3DXBaseEffect *base = This->base_effect;
1028
1029     TRACE("Forward iface %p, base %p\n", This, base);
1030
1031     return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1032 }
1033
1034 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
1035 {
1036     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1037     ID3DXBaseEffect *base = This->base_effect;
1038
1039     TRACE("Forward iface %p, base %p\n", This, base);
1040
1041     return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1042 }
1043
1044 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1045 {
1046     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1047     ID3DXBaseEffect *base = This->base_effect;
1048
1049     TRACE("Forward iface %p, base %p\n", This, base);
1050
1051     return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1052 }
1053
1054 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1055 {
1056     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1057     ID3DXBaseEffect *base = This->base_effect;
1058
1059     TRACE("Forward iface %p, base %p\n", This, base);
1060
1061     return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1062 }
1063
1064 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1065 {
1066     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1067     ID3DXBaseEffect *base = This->base_effect;
1068
1069     TRACE("Forward iface %p, base %p\n", This, base);
1070
1071     return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1072 }
1073
1074 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1075 {
1076     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1077     ID3DXBaseEffect *base = This->base_effect;
1078
1079     TRACE("Forward iface %p, base %p\n", This, base);
1080
1081     return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1082 }
1083
1084 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1085 {
1086     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1087     ID3DXBaseEffect *base = This->base_effect;
1088
1089     TRACE("Forward iface %p, base %p\n", This, base);
1090
1091     return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1092 }
1093
1094 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1095 {
1096     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1097     ID3DXBaseEffect *base = This->base_effect;
1098
1099     TRACE("Forward iface %p, base %p\n", This, base);
1100
1101     return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1102 }
1103
1104 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1105 {
1106     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1107     ID3DXBaseEffect *base = This->base_effect;
1108
1109     TRACE("Forward iface %p, base %p\n", This, base);
1110
1111     return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1112 }
1113
1114 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1115 {
1116     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1117     ID3DXBaseEffect *base = This->base_effect;
1118
1119     TRACE("Forward iface %p, base %p\n", This, base);
1120
1121     return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
1122 }
1123
1124 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1125 {
1126     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1127     ID3DXBaseEffect *base = This->base_effect;
1128
1129     TRACE("Forward iface %p, base %p\n", This, base);
1130
1131     return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
1132 }
1133
1134 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1135 {
1136     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1137     ID3DXBaseEffect *base = This->base_effect;
1138
1139     TRACE("Forward iface %p, base %p\n", This, base);
1140
1141     return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
1142 }
1143
1144 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1145 {
1146     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1147     ID3DXBaseEffect *base = This->base_effect;
1148
1149     TRACE("Forward iface %p, base %p\n", This, base);
1150
1151     return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
1152 }
1153
1154 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1155 {
1156     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1157     ID3DXBaseEffect *base = This->base_effect;
1158
1159     TRACE("Forward iface %p, base %p\n", This, base);
1160
1161     return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
1162 }
1163
1164 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1165 {
1166     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1167     ID3DXBaseEffect *base = This->base_effect;
1168
1169     TRACE("Forward iface %p, base %p\n", This, base);
1170
1171     return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
1172 }
1173
1174 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1175 {
1176     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1177     ID3DXBaseEffect *base = This->base_effect;
1178
1179     TRACE("Forward iface %p, base %p\n", This, base);
1180
1181     return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
1182 }
1183
1184 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1185 {
1186     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1187     ID3DXBaseEffect *base = This->base_effect;
1188
1189     TRACE("Forward iface %p, base %p\n", This, base);
1190
1191     return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
1192 }
1193
1194 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1195 {
1196     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1197     ID3DXBaseEffect *base = This->base_effect;
1198
1199     TRACE("Forward iface %p, base %p\n", This, base);
1200
1201     return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
1202 }
1203
1204 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1205 {
1206     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1207     ID3DXBaseEffect *base = This->base_effect;
1208
1209     TRACE("Forward iface %p, base %p\n", This, base);
1210
1211     return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
1212 }
1213
1214 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1215 {
1216     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1217     ID3DXBaseEffect *base = This->base_effect;
1218
1219     TRACE("Forward iface %p, base %p\n", This, base);
1220
1221     return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
1222 }
1223
1224 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1225 {
1226     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1227     ID3DXBaseEffect *base = This->base_effect;
1228
1229     TRACE("Forward iface %p, base %p\n", This, base);
1230
1231     return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
1232 }
1233
1234 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1235 {
1236     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1237     ID3DXBaseEffect *base = This->base_effect;
1238
1239     TRACE("Forward iface %p, base %p\n", This, base);
1240
1241     return ID3DXBaseEffectImpl_SetString(base, parameter, string);
1242 }
1243
1244 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1245 {
1246     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1247     ID3DXBaseEffect *base = This->base_effect;
1248
1249     TRACE("Forward iface %p, base %p\n", This, base);
1250
1251     return ID3DXBaseEffectImpl_GetString(base, parameter, string);
1252 }
1253
1254 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1255 {
1256     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1257     ID3DXBaseEffect *base = This->base_effect;
1258
1259     TRACE("Forward iface %p, base %p\n", This, base);
1260
1261     return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
1262 }
1263
1264 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1265 {
1266     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1267     ID3DXBaseEffect *base = This->base_effect;
1268
1269     TRACE("Forward iface %p, base %p\n", This, base);
1270
1271     return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
1272 }
1273
1274 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1275 {
1276     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1277     ID3DXBaseEffect *base = This->base_effect;
1278
1279     TRACE("Forward iface %p, base %p\n", This, base);
1280
1281     return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
1282 }
1283
1284 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1285 {
1286     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1287     ID3DXBaseEffect *base = This->base_effect;
1288
1289     TRACE("Forward iface %p, base %p\n", This, base);
1290
1291     return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
1292 }
1293
1294 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1295 {
1296     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1297     ID3DXBaseEffect *base = This->base_effect;
1298
1299     TRACE("Forward iface %p, base %p\n", This, base);
1300
1301     return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
1302 }
1303
1304 /*** ID3DXEffect methods ***/
1305 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
1306 {
1307     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1308
1309     TRACE("iface %p, pool %p\n", This, pool);
1310
1311     if (!pool)
1312     {
1313         WARN("Invalid argument supplied.\n");
1314         return D3DERR_INVALIDCALL;
1315     }
1316
1317     if (This->pool)
1318     {
1319         This->pool->lpVtbl->AddRef(This->pool);
1320     }
1321
1322     *pool = This->pool;
1323
1324     TRACE("Returning pool %p\n", *pool);
1325
1326     return S_OK;
1327 }
1328
1329 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1330 {
1331     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1332
1333     FIXME("(%p)->(%p): stub\n", This, technique);
1334
1335     return E_NOTIMPL;
1336 }
1337
1338 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
1339 {
1340     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1341
1342     FIXME("(%p)->(): stub\n", This);
1343
1344     return NULL;
1345 }
1346
1347 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1348 {
1349     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1350
1351     FIXME("(%p)->(%p): stub\n", This, technique);
1352
1353     return D3D_OK;
1354 }
1355
1356 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
1357 {
1358     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1359
1360     FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
1361
1362     return E_NOTIMPL;
1363 }
1364
1365 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
1366 {
1367     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1368
1369     FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
1370
1371     return FALSE;
1372 }
1373
1374 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
1375 {
1376     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1377
1378     FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
1379
1380     return E_NOTIMPL;
1381 }
1382
1383 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
1384 {
1385     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1386
1387     FIXME("(%p)->(%u): stub\n", This, pass);
1388
1389     return E_NOTIMPL;
1390 }
1391
1392 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
1393 {
1394     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1395
1396     FIXME("(%p)->(): stub\n", This);
1397
1398     return E_NOTIMPL;
1399 }
1400
1401 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
1402 {
1403     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1404
1405     FIXME("(%p)->(): stub\n", This);
1406
1407     return E_NOTIMPL;
1408 }
1409
1410 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
1411 {
1412     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1413
1414     FIXME("(%p)->(): stub\n", This);
1415
1416     return E_NOTIMPL;
1417 }
1418
1419 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
1420 {
1421     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1422
1423     TRACE("iface %p, device %p\n", This, device);
1424
1425     if (!device)
1426     {
1427         WARN("Invalid argument supplied.\n");
1428         return D3DERR_INVALIDCALL;
1429     }
1430
1431     IDirect3DDevice9_AddRef(This->device);
1432
1433     *device = This->device;
1434
1435     TRACE("Returning device %p\n", *device);
1436
1437     return S_OK;
1438 }
1439
1440 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
1441 {
1442     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1443
1444     FIXME("(%p)->(): stub\n", This);
1445
1446     return E_NOTIMPL;
1447 }
1448
1449 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
1450 {
1451     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1452
1453     FIXME("(%p)->(): stub\n", This);
1454
1455     return E_NOTIMPL;
1456 }
1457
1458 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER manager)
1459 {
1460     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1461
1462     FIXME("(%p)->(%p): stub\n", This, manager);
1463
1464     return E_NOTIMPL;
1465 }
1466
1467 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER* manager)
1468 {
1469     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1470
1471     FIXME("(%p)->(%p): stub\n", This, manager);
1472
1473     return E_NOTIMPL;
1474 }
1475
1476 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
1477 {
1478     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1479
1480     FIXME("(%p)->(): stub\n", This);
1481
1482     return E_NOTIMPL;
1483 }
1484
1485 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
1486 {
1487     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1488
1489     FIXME("(%p)->(): stub\n", This);
1490
1491     return NULL;
1492 }
1493
1494 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
1495 {
1496     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1497
1498     FIXME("(%p)->(%p): stub\n", This, parameter_block);
1499
1500     return E_NOTIMPL;
1501 }
1502
1503 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
1504 {
1505     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1506
1507     FIXME("(%p)->(%p): stub\n", This, parameter_block);
1508
1509     return E_NOTIMPL;
1510 }
1511
1512 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
1513 {
1514     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1515
1516     FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
1517
1518     return E_NOTIMPL;
1519 }
1520
1521 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
1522 {
1523     struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1524
1525     FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
1526
1527     return E_NOTIMPL;
1528 }
1529
1530 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
1531 {
1532     /*** IUnknown methods ***/
1533     ID3DXEffectImpl_QueryInterface,
1534     ID3DXEffectImpl_AddRef,
1535     ID3DXEffectImpl_Release,
1536     /*** ID3DXBaseEffect methods ***/
1537     ID3DXEffectImpl_GetDesc,
1538     ID3DXEffectImpl_GetParameterDesc,
1539     ID3DXEffectImpl_GetTechniqueDesc,
1540     ID3DXEffectImpl_GetPassDesc,
1541     ID3DXEffectImpl_GetFunctionDesc,
1542     ID3DXEffectImpl_GetParameter,
1543     ID3DXEffectImpl_GetParameterByName,
1544     ID3DXEffectImpl_GetParameterBySemantic,
1545     ID3DXEffectImpl_GetParameterElement,
1546     ID3DXEffectImpl_GetTechnique,
1547     ID3DXEffectImpl_GetTechniqueByName,
1548     ID3DXEffectImpl_GetPass,
1549     ID3DXEffectImpl_GetPassByName,
1550     ID3DXEffectImpl_GetFunction,
1551     ID3DXEffectImpl_GetFunctionByName,
1552     ID3DXEffectImpl_GetAnnotation,
1553     ID3DXEffectImpl_GetAnnotationByName,
1554     ID3DXEffectImpl_SetValue,
1555     ID3DXEffectImpl_GetValue,
1556     ID3DXEffectImpl_SetBool,
1557     ID3DXEffectImpl_GetBool,
1558     ID3DXEffectImpl_SetBoolArray,
1559     ID3DXEffectImpl_GetBoolArray,
1560     ID3DXEffectImpl_SetInt,
1561     ID3DXEffectImpl_GetInt,
1562     ID3DXEffectImpl_SetIntArray,
1563     ID3DXEffectImpl_GetIntArray,
1564     ID3DXEffectImpl_SetFloat,
1565     ID3DXEffectImpl_GetFloat,
1566     ID3DXEffectImpl_SetFloatArray,
1567     ID3DXEffectImpl_GetFloatArray,
1568     ID3DXEffectImpl_SetVector,
1569     ID3DXEffectImpl_GetVector,
1570     ID3DXEffectImpl_SetVectorArray,
1571     ID3DXEffectImpl_GetVectorArray,
1572     ID3DXEffectImpl_SetMatrix,
1573     ID3DXEffectImpl_GetMatrix,
1574     ID3DXEffectImpl_SetMatrixArray,
1575     ID3DXEffectImpl_GetMatrixArray,
1576     ID3DXEffectImpl_SetMatrixPointerArray,
1577     ID3DXEffectImpl_GetMatrixPointerArray,
1578     ID3DXEffectImpl_SetMatrixTranspose,
1579     ID3DXEffectImpl_GetMatrixTranspose,
1580     ID3DXEffectImpl_SetMatrixTransposeArray,
1581     ID3DXEffectImpl_GetMatrixTransposeArray,
1582     ID3DXEffectImpl_SetMatrixTransposePointerArray,
1583     ID3DXEffectImpl_GetMatrixTransposePointerArray,
1584     ID3DXEffectImpl_SetString,
1585     ID3DXEffectImpl_GetString,
1586     ID3DXEffectImpl_SetTexture,
1587     ID3DXEffectImpl_GetTexture,
1588     ID3DXEffectImpl_GetPixelShader,
1589     ID3DXEffectImpl_GetVertexShader,
1590     ID3DXEffectImpl_SetArrayRange,
1591     /*** ID3DXEffect methods ***/
1592     ID3DXEffectImpl_GetPool,
1593     ID3DXEffectImpl_SetTechnique,
1594     ID3DXEffectImpl_GetCurrentTechnique,
1595     ID3DXEffectImpl_ValidateTechnique,
1596     ID3DXEffectImpl_FindNextValidTechnique,
1597     ID3DXEffectImpl_IsParameterUsed,
1598     ID3DXEffectImpl_Begin,
1599     ID3DXEffectImpl_BeginPass,
1600     ID3DXEffectImpl_CommitChanges,
1601     ID3DXEffectImpl_EndPass,
1602     ID3DXEffectImpl_End,
1603     ID3DXEffectImpl_GetDevice,
1604     ID3DXEffectImpl_OnLostDevice,
1605     ID3DXEffectImpl_OnResetDevice,
1606     ID3DXEffectImpl_SetStateManager,
1607     ID3DXEffectImpl_GetStateManager,
1608     ID3DXEffectImpl_BeginParameterBlock,
1609     ID3DXEffectImpl_EndParameterBlock,
1610     ID3DXEffectImpl_ApplyParameterBlock,
1611     ID3DXEffectImpl_DeleteParameterBlock,
1612     ID3DXEffectImpl_CloneEffect,
1613     ID3DXEffectImpl_SetRawValue
1614 };
1615
1616 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
1617 {
1618     return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
1619 }
1620
1621 /*** IUnknown methods ***/
1622 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
1623 {
1624     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1625
1626     TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
1627
1628     if (IsEqualGUID(riid, &IID_IUnknown) ||
1629         IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
1630     {
1631         This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
1632         *object = This;
1633         return S_OK;
1634     }
1635
1636     ERR("Interface %s not found\n", debugstr_guid(riid));
1637
1638     return E_NOINTERFACE;
1639 }
1640
1641 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
1642 {
1643     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1644
1645     TRACE("iface %p: AddRef from %u\n", iface, This->ref);
1646
1647     return InterlockedIncrement(&This->ref);
1648 }
1649
1650 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
1651 {
1652     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1653     ULONG ref = InterlockedDecrement(&This->ref);
1654
1655     TRACE("iface %p: Release from %u\n", iface, ref + 1);
1656
1657     if (!ref)
1658     {
1659         free_effect_compiler(This);
1660         HeapFree(GetProcessHeap(), 0, This);
1661     }
1662
1663     return ref;
1664 }
1665
1666 /*** ID3DXBaseEffect methods ***/
1667 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
1668 {
1669     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1670     ID3DXBaseEffect *base = This->base_effect;
1671
1672     TRACE("Forward iface %p, base %p\n", This, base);
1673
1674     return ID3DXBaseEffectImpl_GetDesc(base, desc);
1675 }
1676
1677 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1678 {
1679     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1680     ID3DXBaseEffect *base = This->base_effect;
1681
1682     TRACE("Forward iface %p, base %p\n", This, base);
1683
1684     return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1685 }
1686
1687 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1688 {
1689     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1690     ID3DXBaseEffect *base = This->base_effect;
1691
1692     TRACE("Forward iface %p, base %p\n", This, base);
1693
1694     return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1695 }
1696
1697 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1698 {
1699     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1700     ID3DXBaseEffect *base = This->base_effect;
1701
1702     TRACE("Forward iface %p, base %p\n", This, base);
1703
1704     return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1705 }
1706
1707 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1708 {
1709     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1710     ID3DXBaseEffect *base = This->base_effect;
1711
1712     TRACE("Forward iface %p, base %p\n", This, base);
1713
1714     return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1715 }
1716
1717 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
1718 {
1719     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1720     ID3DXBaseEffect *base = This->base_effect;
1721
1722     TRACE("Forward iface %p, base %p\n", This, base);
1723
1724     return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1725 }
1726
1727 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
1728 {
1729     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1730     ID3DXBaseEffect *base = This->base_effect;
1731
1732     TRACE("Forward iface %p, base %p\n", This, base);
1733
1734     return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1735 }
1736
1737 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
1738 {
1739     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1740     ID3DXBaseEffect *base = This->base_effect;
1741
1742     TRACE("Forward iface %p, base %p\n", This, base);
1743
1744     return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1745 }
1746
1747 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
1748 {
1749     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1750     ID3DXBaseEffect *base = This->base_effect;
1751
1752     TRACE("Forward iface %p, base %p\n", This, base);
1753
1754     return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1755 }
1756
1757 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
1758 {
1759     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1760     ID3DXBaseEffect *base = This->base_effect;
1761
1762     TRACE("Forward iface %p, base %p\n", This, base);
1763
1764     return ID3DXBaseEffectImpl_GetTechnique(base, index);
1765 }
1766
1767 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
1768 {
1769     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1770     ID3DXBaseEffect *base = This->base_effect;
1771
1772     TRACE("Forward iface %p, base %p\n", This, base);
1773
1774     return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1775 }
1776
1777 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
1778 {
1779     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1780     ID3DXBaseEffect *base = This->base_effect;
1781
1782     TRACE("Forward iface %p, base %p\n", This, base);
1783
1784     return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1785 }
1786
1787 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
1788 {
1789     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1790     ID3DXBaseEffect *base = This->base_effect;
1791
1792     TRACE("Forward iface %p, base %p\n", This, base);
1793
1794     return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1795 }
1796
1797 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
1798 {
1799     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1800     ID3DXBaseEffect *base = This->base_effect;
1801
1802     TRACE("Forward iface %p, base %p\n", This, base);
1803
1804     return ID3DXBaseEffectImpl_GetFunction(base, index);
1805 }
1806
1807 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
1808 {
1809     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1810     ID3DXBaseEffect *base = This->base_effect;
1811
1812     TRACE("Forward iface %p, base %p\n", This, base);
1813
1814     return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1815 }
1816
1817 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
1818 {
1819     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1820     ID3DXBaseEffect *base = This->base_effect;
1821
1822     TRACE("Forward iface %p, base %p\n", This, base);
1823
1824     return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1825 }
1826
1827 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
1828 {
1829     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1830     ID3DXBaseEffect *base = This->base_effect;
1831
1832     TRACE("Forward iface %p, base %p\n", This, base);
1833
1834     return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1835 }
1836
1837 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1838 {
1839     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1840     ID3DXBaseEffect *base = This->base_effect;
1841
1842     TRACE("Forward iface %p, base %p\n", This, base);
1843
1844     return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1845 }
1846
1847 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1848 {
1849     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1850     ID3DXBaseEffect *base = This->base_effect;
1851
1852     TRACE("Forward iface %p, base %p\n", This, base);
1853
1854     return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1855 }
1856
1857 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
1858 {
1859     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1860     ID3DXBaseEffect *base = This->base_effect;
1861
1862     TRACE("Forward iface %p, base %p\n", This, base);
1863
1864     return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1865 }
1866
1867 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
1868 {
1869     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1870     ID3DXBaseEffect *base = This->base_effect;
1871
1872     TRACE("Forward iface %p, base %p\n", This, base);
1873
1874     return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1875 }
1876
1877 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1878 {
1879     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1880     ID3DXBaseEffect *base = This->base_effect;
1881
1882     TRACE("Forward iface %p, base %p\n", This, base);
1883
1884     return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1885 }
1886
1887 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1888 {
1889     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1890     ID3DXBaseEffect *base = This->base_effect;
1891
1892     TRACE("Forward iface %p, base %p\n", This, base);
1893
1894     return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1895 }
1896
1897 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
1898 {
1899     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1900     ID3DXBaseEffect *base = This->base_effect;
1901
1902     TRACE("Forward iface %p, base %p\n", This, base);
1903
1904     return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1905 }
1906
1907 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
1908 {
1909     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1910     ID3DXBaseEffect *base = This->base_effect;
1911
1912     TRACE("Forward iface %p, base %p\n", This, base);
1913
1914     return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1915 }
1916
1917 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1918 {
1919     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1920     ID3DXBaseEffect *base = This->base_effect;
1921
1922     TRACE("Forward iface %p, base %p\n", This, base);
1923
1924     return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1925 }
1926
1927 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
1928 {
1929     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1930     ID3DXBaseEffect *base = This->base_effect;
1931
1932     TRACE("Forward iface %p, base %p\n", This, base);
1933
1934     return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1935 }
1936
1937 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
1938 {
1939     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1940     ID3DXBaseEffect *base = This->base_effect;
1941
1942     TRACE("Forward iface %p, base %p\n", This, base);
1943
1944     return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1945 }
1946
1947 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
1948 {
1949     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1950     ID3DXBaseEffect *base = This->base_effect;
1951
1952     TRACE("Forward iface %p, base %p\n", This, base);
1953
1954     return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1955 }
1956
1957 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1958 {
1959     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1960     ID3DXBaseEffect *base = This->base_effect;
1961
1962     TRACE("Forward iface %p, base %p\n", This, base);
1963
1964     return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1965 }
1966
1967 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1968 {
1969     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1970     ID3DXBaseEffect *base = This->base_effect;
1971
1972     TRACE("Forward iface %p, base %p\n", This, base);
1973
1974     return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1975 }
1976
1977 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1978 {
1979     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1980     ID3DXBaseEffect *base = This->base_effect;
1981
1982     TRACE("Forward iface %p, base %p\n", This, base);
1983
1984     return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1985 }
1986
1987 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1988 {
1989     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1990     ID3DXBaseEffect *base = This->base_effect;
1991
1992     TRACE("Forward iface %p, base %p\n", This, base);
1993
1994     return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1995 }
1996
1997 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1998 {
1999     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2000     ID3DXBaseEffect *base = This->base_effect;
2001
2002     TRACE("Forward iface %p, base %p\n", This, base);
2003
2004     return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2005 }
2006
2007 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2008 {
2009     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2010     ID3DXBaseEffect *base = This->base_effect;
2011
2012     TRACE("Forward iface %p, base %p\n", This, base);
2013
2014     return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2015 }
2016
2017 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2018 {
2019     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2020     ID3DXBaseEffect *base = This->base_effect;
2021
2022     TRACE("Forward iface %p, base %p\n", This, base);
2023
2024     return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2025 }
2026
2027 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2028 {
2029     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2030     ID3DXBaseEffect *base = This->base_effect;
2031
2032     TRACE("Forward iface %p, base %p\n", This, base);
2033
2034     return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2035 }
2036
2037 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2038 {
2039     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2040     ID3DXBaseEffect *base = This->base_effect;
2041
2042     TRACE("Forward iface %p, base %p\n", This, base);
2043
2044     return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2045 }
2046
2047 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2048 {
2049     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2050     ID3DXBaseEffect *base = This->base_effect;
2051
2052     TRACE("Forward iface %p, base %p\n", This, base);
2053
2054     return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2055 }
2056
2057 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2058 {
2059     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2060     ID3DXBaseEffect *base = This->base_effect;
2061
2062     TRACE("Forward iface %p, base %p\n", This, base);
2063
2064     return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2065 }
2066
2067 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2068 {
2069     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2070     ID3DXBaseEffect *base = This->base_effect;
2071
2072     TRACE("Forward iface %p, base %p\n", This, base);
2073
2074     return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2075 }
2076
2077 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2078 {
2079     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2080     ID3DXBaseEffect *base = This->base_effect;
2081
2082     TRACE("Forward iface %p, base %p\n", This, base);
2083
2084     return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2085 }
2086
2087 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2088 {
2089     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2090     ID3DXBaseEffect *base = This->base_effect;
2091
2092     TRACE("Forward iface %p, base %p\n", This, base);
2093
2094     return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2095 }
2096
2097 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2098 {
2099     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2100     ID3DXBaseEffect *base = This->base_effect;
2101
2102     TRACE("Forward iface %p, base %p\n", This, base);
2103
2104     return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2105 }
2106
2107 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2108 {
2109     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2110     ID3DXBaseEffect *base = This->base_effect;
2111
2112     TRACE("Forward iface %p, base %p\n", This, base);
2113
2114     return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2115 }
2116
2117 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2118 {
2119     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2120     ID3DXBaseEffect *base = This->base_effect;
2121
2122     TRACE("Forward iface %p, base %p\n", This, base);
2123
2124     return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2125 }
2126
2127 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2128 {
2129     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2130     ID3DXBaseEffect *base = This->base_effect;
2131
2132     TRACE("Forward iface %p, base %p\n", This, base);
2133
2134     return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2135 }
2136
2137 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
2138 {
2139     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2140     ID3DXBaseEffect *base = This->base_effect;
2141
2142     TRACE("Forward iface %p, base %p\n", This, base);
2143
2144     return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2145 }
2146
2147 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
2148 {
2149     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2150     ID3DXBaseEffect *base = This->base_effect;
2151
2152     TRACE("Forward iface %p, base %p\n", This, base);
2153
2154     return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2155 }
2156
2157 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2158 {
2159     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2160     ID3DXBaseEffect *base = This->base_effect;
2161
2162     TRACE("Forward iface %p, base %p\n", This, base);
2163
2164     return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2165 }
2166
2167 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2168 {
2169     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2170     ID3DXBaseEffect *base = This->base_effect;
2171
2172     TRACE("Forward iface %p, base %p\n", This, base);
2173
2174     return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2175 }
2176
2177 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2178 {
2179     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2180     ID3DXBaseEffect *base = This->base_effect;
2181
2182     TRACE("Forward iface %p, base %p\n", This, base);
2183
2184     return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2185 }
2186
2187 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2188 {
2189     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2190     ID3DXBaseEffect *base = This->base_effect;
2191
2192     TRACE("Forward iface %p, base %p\n", This, base);
2193
2194     return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2195 }
2196
2197 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
2198 {
2199     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2200     ID3DXBaseEffect *base = This->base_effect;
2201
2202     TRACE("Forward iface %p, base %p\n", This, base);
2203
2204     return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2205 }
2206
2207 /*** ID3DXEffectCompiler methods ***/
2208 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
2209 {
2210     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2211
2212     FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
2213
2214     return E_NOTIMPL;
2215 }
2216
2217 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
2218 {
2219     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2220
2221     FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
2222
2223     return E_NOTIMPL;
2224 }
2225
2226 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
2227         LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
2228 {
2229     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2230
2231     FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
2232
2233     return E_NOTIMPL;
2234 }
2235
2236 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
2237         LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
2238 {
2239     struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2240
2241     FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
2242             This, function, target, flags, shader, error_msgs, constant_table);
2243
2244     return E_NOTIMPL;
2245 }
2246
2247 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
2248 {
2249     /*** IUnknown methods ***/
2250     ID3DXEffectCompilerImpl_QueryInterface,
2251     ID3DXEffectCompilerImpl_AddRef,
2252     ID3DXEffectCompilerImpl_Release,
2253     /*** ID3DXBaseEffect methods ***/
2254     ID3DXEffectCompilerImpl_GetDesc,
2255     ID3DXEffectCompilerImpl_GetParameterDesc,
2256     ID3DXEffectCompilerImpl_GetTechniqueDesc,
2257     ID3DXEffectCompilerImpl_GetPassDesc,
2258     ID3DXEffectCompilerImpl_GetFunctionDesc,
2259     ID3DXEffectCompilerImpl_GetParameter,
2260     ID3DXEffectCompilerImpl_GetParameterByName,
2261     ID3DXEffectCompilerImpl_GetParameterBySemantic,
2262     ID3DXEffectCompilerImpl_GetParameterElement,
2263     ID3DXEffectCompilerImpl_GetTechnique,
2264     ID3DXEffectCompilerImpl_GetTechniqueByName,
2265     ID3DXEffectCompilerImpl_GetPass,
2266     ID3DXEffectCompilerImpl_GetPassByName,
2267     ID3DXEffectCompilerImpl_GetFunction,
2268     ID3DXEffectCompilerImpl_GetFunctionByName,
2269     ID3DXEffectCompilerImpl_GetAnnotation,
2270     ID3DXEffectCompilerImpl_GetAnnotationByName,
2271     ID3DXEffectCompilerImpl_SetValue,
2272     ID3DXEffectCompilerImpl_GetValue,
2273     ID3DXEffectCompilerImpl_SetBool,
2274     ID3DXEffectCompilerImpl_GetBool,
2275     ID3DXEffectCompilerImpl_SetBoolArray,
2276     ID3DXEffectCompilerImpl_GetBoolArray,
2277     ID3DXEffectCompilerImpl_SetInt,
2278     ID3DXEffectCompilerImpl_GetInt,
2279     ID3DXEffectCompilerImpl_SetIntArray,
2280     ID3DXEffectCompilerImpl_GetIntArray,
2281     ID3DXEffectCompilerImpl_SetFloat,
2282     ID3DXEffectCompilerImpl_GetFloat,
2283     ID3DXEffectCompilerImpl_SetFloatArray,
2284     ID3DXEffectCompilerImpl_GetFloatArray,
2285     ID3DXEffectCompilerImpl_SetVector,
2286     ID3DXEffectCompilerImpl_GetVector,
2287     ID3DXEffectCompilerImpl_SetVectorArray,
2288     ID3DXEffectCompilerImpl_GetVectorArray,
2289     ID3DXEffectCompilerImpl_SetMatrix,
2290     ID3DXEffectCompilerImpl_GetMatrix,
2291     ID3DXEffectCompilerImpl_SetMatrixArray,
2292     ID3DXEffectCompilerImpl_GetMatrixArray,
2293     ID3DXEffectCompilerImpl_SetMatrixPointerArray,
2294     ID3DXEffectCompilerImpl_GetMatrixPointerArray,
2295     ID3DXEffectCompilerImpl_SetMatrixTranspose,
2296     ID3DXEffectCompilerImpl_GetMatrixTranspose,
2297     ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
2298     ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
2299     ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
2300     ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
2301     ID3DXEffectCompilerImpl_SetString,
2302     ID3DXEffectCompilerImpl_GetString,
2303     ID3DXEffectCompilerImpl_SetTexture,
2304     ID3DXEffectCompilerImpl_GetTexture,
2305     ID3DXEffectCompilerImpl_GetPixelShader,
2306     ID3DXEffectCompilerImpl_GetVertexShader,
2307     ID3DXEffectCompilerImpl_SetArrayRange,
2308     /*** ID3DXEffectCompiler methods ***/
2309     ID3DXEffectCompilerImpl_SetLiteral,
2310     ID3DXEffectCompilerImpl_GetLiteral,
2311     ID3DXEffectCompilerImpl_CompileEffect,
2312     ID3DXEffectCompilerImpl_CompileShader,
2313 };
2314
2315 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
2316 {
2317     const char *ptr = data + start;
2318
2319     read_dword(&ptr, &base->parameter_count);
2320     TRACE("Parameter count: %u\n", base->parameter_count);
2321
2322     read_dword(&ptr, &base->technique_count);
2323     TRACE("Technique count: %u\n", base->technique_count);
2324
2325     skip_dword_unknown(&ptr, 2);
2326
2327     /* todo: Parse parameter */
2328
2329     /* todo: Parse techniques */
2330
2331     return S_OK;
2332 }
2333
2334 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
2335         const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
2336 {
2337     DWORD tag, offset;
2338     const char *ptr = data;
2339     HRESULT hr;
2340
2341     TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
2342
2343     base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
2344     base->ref = 1;
2345     base->effect = effect;
2346
2347     read_dword(&ptr, &tag);
2348     TRACE("Tag: %x\n", tag);
2349
2350     if (tag != d3dx9_effect_version(9, 1))
2351     {
2352         /* todo: compile hlsl ascii code */
2353         FIXME("HLSL ascii effects not supported, yet\n");
2354
2355         /* Show the start of the shader for debugging info. */
2356         TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
2357     }
2358     else
2359     {
2360         read_dword(&ptr, &offset);
2361         TRACE("Offset: %x\n", offset);
2362
2363         hr = d3dx9_parse_effect(base, ptr, data_size, offset);
2364         if (hr != S_OK)
2365         {
2366             FIXME("Failed to parse effect.\n");
2367             return hr;
2368         }
2369     }
2370
2371     return S_OK;
2372 }
2373
2374 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
2375         const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
2376 {
2377     HRESULT hr;
2378     struct ID3DXBaseEffectImpl *object = NULL;
2379
2380     TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
2381
2382     effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
2383     effect->ref = 1;
2384
2385     if (pool) pool->lpVtbl->AddRef(pool);
2386     effect->pool = pool;
2387
2388     IDirect3DDevice9_AddRef(device);
2389     effect->device = device;
2390
2391     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2392     if (!object)
2393     {
2394         ERR("Out of memory\n");
2395         hr = E_OUTOFMEMORY;
2396         goto err_out;
2397     }
2398
2399     hr = d3dx9_base_effect_init(object, data, data_size, effect);
2400     if (hr != S_OK)
2401     {
2402         FIXME("Failed to parse effect.\n");
2403         goto err_out;
2404     }
2405
2406     effect->base_effect = &object->ID3DXBaseEffect_iface;
2407
2408     return S_OK;
2409
2410 err_out:
2411
2412     HeapFree(GetProcessHeap(), 0, object);
2413     free_effect(effect);
2414
2415     return hr;
2416 }
2417
2418 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
2419                                   LPCVOID srcdata,
2420                                   UINT srcdatalen,
2421                                   CONST D3DXMACRO* defines,
2422                                   LPD3DXINCLUDE include,
2423                                   LPCSTR skip_constants,
2424                                   DWORD flags,
2425                                   LPD3DXEFFECTPOOL pool,
2426                                   LPD3DXEFFECT* effect,
2427                                   LPD3DXBUFFER* compilation_errors)
2428 {
2429     struct ID3DXEffectImpl *object;
2430     HRESULT hr;
2431
2432     FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
2433         skip_constants, flags, pool, effect, compilation_errors);
2434
2435     if (!device || !srcdata)
2436         return D3DERR_INVALIDCALL;
2437
2438     if (!srcdatalen)
2439         return E_FAIL;
2440
2441     /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
2442     if (!effect)
2443         return D3D_OK;
2444
2445     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2446     if (!object)
2447     {
2448         ERR("Out of memory\n");
2449         return E_OUTOFMEMORY;
2450     }
2451
2452     hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
2453     if (FAILED(hr))
2454     {
2455         WARN("Failed to initialize shader reflection\n");
2456         HeapFree(GetProcessHeap(), 0, object);
2457         return hr;
2458     }
2459
2460     *effect = &object->ID3DXEffect_iface;
2461
2462     TRACE("Created ID3DXEffect %p\n", object);
2463
2464     return D3D_OK;
2465 }
2466
2467 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
2468                                 LPCVOID srcdata,
2469                                 UINT srcdatalen,
2470                                 CONST D3DXMACRO* defines,
2471                                 LPD3DXINCLUDE include,
2472                                 DWORD flags,
2473                                 LPD3DXEFFECTPOOL pool,
2474                                 LPD3DXEFFECT* effect,
2475                                 LPD3DXBUFFER* compilation_errors)
2476 {
2477     TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
2478         include, flags, pool, effect, compilation_errors);
2479
2480     return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
2481 }
2482
2483 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
2484 {
2485     HRESULT hr;
2486     struct ID3DXBaseEffectImpl *object = NULL;
2487
2488     TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
2489
2490     compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
2491     compiler->ref = 1;
2492
2493     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2494     if (!object)
2495     {
2496         ERR("Out of memory\n");
2497         hr = E_OUTOFMEMORY;
2498         goto err_out;
2499     }
2500
2501     hr = d3dx9_base_effect_init(object, data, data_size, NULL);
2502     if (hr != S_OK)
2503     {
2504         FIXME("Failed to parse effect.\n");
2505         goto err_out;
2506     }
2507
2508     compiler->base_effect = &object->ID3DXBaseEffect_iface;
2509
2510     return S_OK;
2511
2512 err_out:
2513
2514     HeapFree(GetProcessHeap(), 0, object);
2515     free_effect_compiler(compiler);
2516
2517     return hr;
2518 }
2519
2520 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
2521                                         UINT srcdatalen,
2522                                         CONST D3DXMACRO *defines,
2523                                         LPD3DXINCLUDE include,
2524                                         DWORD flags,
2525                                         LPD3DXEFFECTCOMPILER *compiler,
2526                                         LPD3DXBUFFER *parse_errors)
2527 {
2528     struct ID3DXEffectCompilerImpl *object;
2529     HRESULT hr;
2530
2531     TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
2532             srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
2533
2534     if (!srcdata || !compiler)
2535     {
2536         WARN("Invalid arguments supplied\n");
2537         return D3DERR_INVALIDCALL;
2538     }
2539
2540     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2541     if (!object)
2542     {
2543         ERR("Out of memory\n");
2544         return E_OUTOFMEMORY;
2545     }
2546
2547     hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
2548     if (FAILED(hr))
2549     {
2550         WARN("Failed to initialize effect compiler\n");
2551         HeapFree(GetProcessHeap(), 0, object);
2552         return hr;
2553     }
2554
2555     *compiler = &object->ID3DXEffectCompiler_iface;
2556
2557     TRACE("Created ID3DXEffectCompiler %p\n", object);
2558
2559     return D3D_OK;
2560 }
2561
2562 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
2563
2564 struct ID3DXEffectPoolImpl
2565 {
2566     ID3DXEffectPool ID3DXEffectPool_iface;
2567     LONG ref;
2568 };
2569
2570 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
2571 {
2572     return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
2573 }
2574
2575 /*** IUnknown methods ***/
2576 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
2577 {
2578     struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
2579
2580     TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
2581
2582     if (IsEqualGUID(riid, &IID_IUnknown) ||
2583         IsEqualGUID(riid, &IID_ID3DXEffectPool))
2584     {
2585         This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
2586         *object = This;
2587         return S_OK;
2588     }
2589
2590     WARN("Interface %s not found\n", debugstr_guid(riid));
2591
2592     return E_NOINTERFACE;
2593 }
2594
2595 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
2596 {
2597     struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
2598
2599     TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
2600
2601     return InterlockedIncrement(&This->ref);
2602 }
2603
2604 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
2605 {
2606     struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
2607     ULONG ref = InterlockedDecrement(&This->ref);
2608
2609     TRACE("(%p)->(): Release from %u\n", This, ref + 1);
2610
2611     if (!ref)
2612         HeapFree(GetProcessHeap(), 0, This);
2613
2614     return ref;
2615 }
2616
2617 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
2618 {
2619     /*** IUnknown methods ***/
2620     ID3DXEffectPoolImpl_QueryInterface,
2621     ID3DXEffectPoolImpl_AddRef,
2622     ID3DXEffectPoolImpl_Release
2623 };
2624
2625 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
2626 {
2627     struct ID3DXEffectPoolImpl *object;
2628
2629     TRACE("(%p)\n", pool);
2630
2631     if (!pool)
2632         return D3DERR_INVALIDCALL;
2633
2634     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2635     if (!object)
2636     {
2637         ERR("Out of memory\n");
2638         return E_OUTOFMEMORY;
2639     }
2640
2641     object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
2642     object->ref = 1;
2643
2644     *pool = &object->ID3DXEffectPool_iface;
2645
2646     return S_OK;
2647 }
2648
2649 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
2650     const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
2651     LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2652 {
2653     LPVOID buffer;
2654     HRESULT ret;
2655     DWORD size;
2656
2657     TRACE("(%s): relay\n", debugstr_w(srcfile));
2658
2659     if (!device || !srcfile || !defines)
2660         return D3DERR_INVALIDCALL;
2661
2662     ret = map_view_of_file(srcfile, &buffer, &size);
2663
2664     if (FAILED(ret))
2665         return D3DXERR_INVALIDDATA;
2666
2667     ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
2668     UnmapViewOfFile(buffer);
2669
2670     return ret;
2671 }
2672
2673 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
2674     const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
2675     LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2676 {
2677     LPWSTR srcfileW;
2678     HRESULT ret;
2679     DWORD len;
2680
2681     TRACE("(void): relay\n");
2682
2683     if (!srcfile || !defines)
2684         return D3DERR_INVALIDCALL;
2685
2686     len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
2687     srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
2688     MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
2689
2690     ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
2691     HeapFree(GetProcessHeap(), 0, srcfileW);
2692
2693     return ret;
2694 }
2695
2696 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
2697     const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
2698     LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2699 {
2700     TRACE("(void): relay\n");
2701     return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
2702 }
2703
2704 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
2705     const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
2706     LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2707 {
2708     TRACE("(void): relay\n");
2709     return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
2710 }
2711
2712 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
2713     const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
2714     LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2715 {
2716     HRSRC resinfo;
2717
2718     TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
2719
2720     if (!device || !defines)
2721         return D3DERR_INVALIDCALL;
2722
2723     resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
2724
2725     if (resinfo)
2726     {
2727         LPVOID buffer;
2728         HRESULT ret;
2729         DWORD size;
2730
2731         ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
2732
2733         if (FAILED(ret))
2734             return D3DXERR_INVALIDDATA;
2735
2736         return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
2737     }
2738
2739     return D3DXERR_INVALIDDATA;
2740 }
2741
2742 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
2743     const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
2744     LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2745 {
2746     HRSRC resinfo;
2747
2748     TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
2749
2750     if (!device || !defines)
2751         return D3DERR_INVALIDCALL;
2752
2753     resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
2754
2755     if (resinfo)
2756     {
2757         LPVOID buffer;
2758         HRESULT ret;
2759         DWORD size;
2760
2761         ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
2762
2763         if (FAILED(ret))
2764             return D3DXERR_INVALIDDATA;
2765
2766         return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
2767     }
2768
2769     return D3DXERR_INVALIDDATA;
2770 }
2771
2772 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
2773     const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
2774     LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2775 {
2776     TRACE("(void): relay\n");
2777     return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
2778 }
2779
2780 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
2781     const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
2782     LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
2783 {
2784     TRACE("(void): relay\n");
2785     return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
2786 }
2787
2788 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
2789     DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
2790 {
2791     LPVOID buffer;
2792     HRESULT ret;
2793     DWORD size;
2794
2795     TRACE("(%s): relay\n", debugstr_w(srcfile));
2796
2797     if (!srcfile || !defines)
2798         return D3DERR_INVALIDCALL;
2799
2800     ret = map_view_of_file(srcfile, &buffer, &size);
2801
2802     if (FAILED(ret))
2803         return D3DXERR_INVALIDDATA;
2804
2805     ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
2806     UnmapViewOfFile(buffer);
2807
2808     return ret;
2809 }
2810
2811 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
2812     DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
2813 {
2814     LPWSTR srcfileW;
2815     HRESULT ret;
2816     DWORD len;
2817
2818     TRACE("(void): relay\n");
2819
2820     if (!srcfile || !defines)
2821         return D3DERR_INVALIDCALL;
2822
2823     len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
2824     srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
2825     MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
2826
2827     ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
2828     HeapFree(GetProcessHeap(), 0, srcfileW);
2829
2830     return ret;
2831 }
2832
2833 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
2834     LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
2835 {
2836     HRSRC resinfo;
2837
2838     TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
2839
2840     resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
2841
2842     if (resinfo)
2843     {
2844         LPVOID buffer;
2845         HRESULT ret;
2846         DWORD size;
2847
2848         ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
2849
2850         if (FAILED(ret))
2851             return D3DXERR_INVALIDDATA;
2852
2853         return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
2854     }
2855
2856     return D3DXERR_INVALIDDATA;
2857 }
2858
2859 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
2860     LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
2861 {
2862     HRSRC resinfo;
2863
2864     TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
2865
2866     resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
2867
2868     if (resinfo)
2869     {
2870         LPVOID buffer;
2871         HRESULT ret;
2872         DWORD size;
2873
2874         ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
2875
2876         if (FAILED(ret))
2877             return D3DXERR_INVALIDDATA;
2878
2879         return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
2880     }
2881
2882     return D3DXERR_INVALIDDATA;
2883 }