d3dx9: Parse value data.
[wine.git] / dlls / d3dx9_36 / effect.c
blobf31ac318936b38c11c45fbe7581fc06c39cce317
1 /*
2 * Copyright 2010 Christian Costa
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.
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.
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
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"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
29 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl;
30 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl;
31 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl;
33 struct d3dx_parameter
35 struct ID3DXBaseEffectImpl *base;
37 char *name;
38 char *semantic;
39 void *data;
40 D3DXPARAMETER_CLASS class;
41 D3DXPARAMETER_TYPE type;
42 UINT rows;
43 UINT columns;
44 UINT element_count;
45 UINT annotation_count;
46 UINT member_count;
47 DWORD flags;
48 UINT bytes;
50 D3DXHANDLE *annotation_handles;
51 D3DXHANDLE *member_handles;
54 struct ID3DXBaseEffectImpl
56 ID3DXBaseEffect ID3DXBaseEffect_iface;
57 LONG ref;
59 struct ID3DXEffectImpl *effect;
61 UINT parameter_count;
62 UINT technique_count;
64 D3DXHANDLE *parameter_handles;
67 struct ID3DXEffectImpl
69 ID3DXEffect ID3DXEffect_iface;
70 LONG ref;
72 LPDIRECT3DDEVICE9 device;
73 LPD3DXEFFECTPOOL pool;
75 ID3DXBaseEffect *base_effect;
78 struct ID3DXEffectCompilerImpl
80 ID3DXEffectCompiler ID3DXEffectCompiler_iface;
81 LONG ref;
83 ID3DXBaseEffect *base_effect;
86 static inline void read_dword(const char **ptr, DWORD *d)
88 memcpy(d, *ptr, sizeof(*d));
89 *ptr += sizeof(*d);
92 static void skip_dword_unknown(const char **ptr, unsigned int count)
94 unsigned int i;
95 DWORD d;
97 FIXME("Skipping %u unknown DWORDs:\n", count);
98 for (i = 0; i < count; ++i)
100 read_dword(ptr, &d);
101 FIXME("\t0x%08x\n", d);
105 static struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle)
107 return (struct d3dx_parameter *) handle;
110 static D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
112 return (D3DXHANDLE) parameter;
115 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
117 unsigned int i;
118 struct d3dx_parameter *param = get_parameter_struct(handle);
120 TRACE("Free parameter %p, child %s\n", param, child ? "yes" : "no");
122 if (!param)
124 return;
127 if (!child)
129 HeapFree(GetProcessHeap(), 0, param->data);
132 if (param->annotation_handles)
134 for (i = 0; i < param->annotation_count; ++i)
136 free_parameter(param->annotation_handles[i], FALSE, FALSE);
138 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
141 if (param->member_handles)
143 unsigned int count;
145 if (param->element_count) count = param->element_count;
146 else count = param->member_count;
148 for (i = 0; i < count; ++i)
150 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
152 HeapFree(GetProcessHeap(), 0, param->member_handles);
155 /* only the parent has to release name and semantic */
156 if (!element)
158 HeapFree(GetProcessHeap(), 0, param->name);
159 HeapFree(GetProcessHeap(), 0, param->semantic);
162 HeapFree(GetProcessHeap(), 0, param);
165 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
167 unsigned int i;
169 TRACE("Free base effect %p\n", base);
171 if (base->parameter_handles)
173 for (i = 0; i < base->parameter_count; ++i)
175 free_parameter(base->parameter_handles[i], FALSE, FALSE);
177 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
181 static void free_effect(struct ID3DXEffectImpl *effect)
183 TRACE("Free effect %p\n", effect);
185 if (effect->base_effect)
187 effect->base_effect->lpVtbl->Release(effect->base_effect);
190 if (effect->pool)
192 effect->pool->lpVtbl->Release(effect->pool);
195 IDirect3DDevice9_Release(effect->device);
198 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
200 TRACE("Free effect compiler %p\n", compiler);
202 if (compiler->base_effect)
204 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
208 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
210 return (0xfeff0000 | ((major) << 8) | (minor));
213 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
215 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
218 /*** IUnknown methods ***/
219 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
221 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
223 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
225 if (IsEqualGUID(riid, &IID_IUnknown) ||
226 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
228 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
229 *object = This;
230 return S_OK;
233 ERR("Interface %s not found\n", debugstr_guid(riid));
235 return E_NOINTERFACE;
238 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
240 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
242 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
244 return InterlockedIncrement(&This->ref);
247 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
249 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
250 ULONG ref = InterlockedDecrement(&This->ref);
252 TRACE("iface %p: Release from %u\n", iface, ref + 1);
254 if (!ref)
256 free_base_effect(This);
257 HeapFree(GetProcessHeap(), 0, This);
260 return ref;
263 /*** ID3DXBaseEffect methods ***/
264 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
266 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
268 FIXME("iface %p, desc %p stub\n", This, desc);
270 return E_NOTIMPL;
273 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
275 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
277 FIXME("iface %p, parameter %p, desc %p stub\n", This, parameter, desc);
279 return E_NOTIMPL;
282 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
284 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
286 FIXME("iface %p, technique %p, desc %p stub\n", This, technique, desc);
288 return E_NOTIMPL;
291 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
293 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
295 FIXME("iface %p, pass %p, desc %p stub\n", This, pass, desc);
297 return E_NOTIMPL;
300 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
302 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
304 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
306 return E_NOTIMPL;
309 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
311 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
313 FIXME("iface %p, parameter %p, index %u stub\n", This, parameter, index);
315 return NULL;
318 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
320 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
322 FIXME("iface %p, parameter %p, name %s stub\n", This, parameter, debugstr_a(name));
324 return NULL;
327 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
329 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
331 FIXME("iface %p, parameter %p, semantic %s stub\n", This, parameter, debugstr_a(semantic));
333 return NULL;
336 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
338 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
340 FIXME("iface %p, parameter %p, index %u stub\n", This, parameter, index);
342 return NULL;
345 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
347 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
349 FIXME("iface %p, index %u stub\n", This, index);
351 return NULL;
354 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
356 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
358 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
360 return NULL;
363 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
365 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
367 FIXME("iface %p, technique %p, index %u stub\n", This, technique, index);
369 return NULL;
372 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
374 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
376 FIXME("iface %p, technique %p, name %s stub\n", This, technique, debugstr_a(name));
378 return NULL;
381 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
383 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
385 FIXME("iface %p, index %u stub\n", This, index);
387 return NULL;
390 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
392 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
394 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
396 return NULL;
399 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
401 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
403 FIXME("iface %p, object %p, index %u stub\n", This, object, index);
405 return NULL;
408 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
410 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
412 FIXME("iface %p, object %p, name %s stub\n", This, object, debugstr_a(name));
414 return NULL;
417 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
419 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
421 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
423 return E_NOTIMPL;
426 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
428 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
430 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
432 return E_NOTIMPL;
435 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
437 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
439 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
441 return E_NOTIMPL;
444 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
446 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
448 FIXME("iface %p, parameter %p, b %p stub\n", This, parameter, b);
450 return E_NOTIMPL;
453 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
455 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
457 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
459 return E_NOTIMPL;
462 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
464 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
466 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
468 return E_NOTIMPL;
471 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
473 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
475 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
477 return E_NOTIMPL;
480 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
482 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
484 FIXME("iface %p, parameter %p, n %p stub\n", This, parameter, n);
486 return E_NOTIMPL;
489 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
491 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
493 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
495 return E_NOTIMPL;
498 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
500 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
502 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
504 return E_NOTIMPL;
507 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
509 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
511 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
513 return E_NOTIMPL;
516 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
518 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
520 FIXME("iface %p, parameter %p, f %p stub\n", This, parameter, f);
522 return E_NOTIMPL;
525 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
527 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
529 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
531 return E_NOTIMPL;
534 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
536 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
538 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
540 return E_NOTIMPL;
543 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
545 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
547 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
549 return E_NOTIMPL;
552 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
554 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
556 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
558 return E_NOTIMPL;
561 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
563 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
565 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
567 return E_NOTIMPL;
570 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
572 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
574 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
576 return E_NOTIMPL;
579 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
581 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
583 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
585 return E_NOTIMPL;
588 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
590 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
592 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
594 return E_NOTIMPL;
597 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
599 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
601 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
603 return E_NOTIMPL;
606 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
608 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
610 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
612 return E_NOTIMPL;
615 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
617 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
619 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
621 return E_NOTIMPL;
624 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
626 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
628 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
630 return E_NOTIMPL;
633 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
635 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
637 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
639 return E_NOTIMPL;
642 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
644 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
646 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
648 return E_NOTIMPL;
651 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
653 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
655 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
657 return E_NOTIMPL;
660 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
662 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
664 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
666 return E_NOTIMPL;
669 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
671 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
673 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
675 return E_NOTIMPL;
678 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
680 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
682 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
684 return E_NOTIMPL;
687 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
689 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
691 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
693 return E_NOTIMPL;
696 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
698 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
700 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
702 return E_NOTIMPL;
705 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
707 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
709 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
711 return E_NOTIMPL;
714 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
716 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
718 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
720 return E_NOTIMPL;
723 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
725 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
727 FIXME("iface %p, parameter %p, pshader %p stub\n", This, parameter, pshader);
729 return E_NOTIMPL;
732 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
734 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
736 FIXME("iface %p, parameter %p, vshader %p stub\n", This, parameter, vshader);
738 return E_NOTIMPL;
741 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
743 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
745 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
747 return E_NOTIMPL;
750 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
752 /*** IUnknown methods ***/
753 ID3DXBaseEffectImpl_QueryInterface,
754 ID3DXBaseEffectImpl_AddRef,
755 ID3DXBaseEffectImpl_Release,
756 /*** ID3DXBaseEffect methods ***/
757 ID3DXBaseEffectImpl_GetDesc,
758 ID3DXBaseEffectImpl_GetParameterDesc,
759 ID3DXBaseEffectImpl_GetTechniqueDesc,
760 ID3DXBaseEffectImpl_GetPassDesc,
761 ID3DXBaseEffectImpl_GetFunctionDesc,
762 ID3DXBaseEffectImpl_GetParameter,
763 ID3DXBaseEffectImpl_GetParameterByName,
764 ID3DXBaseEffectImpl_GetParameterBySemantic,
765 ID3DXBaseEffectImpl_GetParameterElement,
766 ID3DXBaseEffectImpl_GetTechnique,
767 ID3DXBaseEffectImpl_GetTechniqueByName,
768 ID3DXBaseEffectImpl_GetPass,
769 ID3DXBaseEffectImpl_GetPassByName,
770 ID3DXBaseEffectImpl_GetFunction,
771 ID3DXBaseEffectImpl_GetFunctionByName,
772 ID3DXBaseEffectImpl_GetAnnotation,
773 ID3DXBaseEffectImpl_GetAnnotationByName,
774 ID3DXBaseEffectImpl_SetValue,
775 ID3DXBaseEffectImpl_GetValue,
776 ID3DXBaseEffectImpl_SetBool,
777 ID3DXBaseEffectImpl_GetBool,
778 ID3DXBaseEffectImpl_SetBoolArray,
779 ID3DXBaseEffectImpl_GetBoolArray,
780 ID3DXBaseEffectImpl_SetInt,
781 ID3DXBaseEffectImpl_GetInt,
782 ID3DXBaseEffectImpl_SetIntArray,
783 ID3DXBaseEffectImpl_GetIntArray,
784 ID3DXBaseEffectImpl_SetFloat,
785 ID3DXBaseEffectImpl_GetFloat,
786 ID3DXBaseEffectImpl_SetFloatArray,
787 ID3DXBaseEffectImpl_GetFloatArray,
788 ID3DXBaseEffectImpl_SetVector,
789 ID3DXBaseEffectImpl_GetVector,
790 ID3DXBaseEffectImpl_SetVectorArray,
791 ID3DXBaseEffectImpl_GetVectorArray,
792 ID3DXBaseEffectImpl_SetMatrix,
793 ID3DXBaseEffectImpl_GetMatrix,
794 ID3DXBaseEffectImpl_SetMatrixArray,
795 ID3DXBaseEffectImpl_GetMatrixArray,
796 ID3DXBaseEffectImpl_SetMatrixPointerArray,
797 ID3DXBaseEffectImpl_GetMatrixPointerArray,
798 ID3DXBaseEffectImpl_SetMatrixTranspose,
799 ID3DXBaseEffectImpl_GetMatrixTranspose,
800 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
801 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
802 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
803 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
804 ID3DXBaseEffectImpl_SetString,
805 ID3DXBaseEffectImpl_GetString,
806 ID3DXBaseEffectImpl_SetTexture,
807 ID3DXBaseEffectImpl_GetTexture,
808 ID3DXBaseEffectImpl_GetPixelShader,
809 ID3DXBaseEffectImpl_GetVertexShader,
810 ID3DXBaseEffectImpl_SetArrayRange,
813 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
815 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
818 /*** IUnknown methods ***/
819 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
821 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
823 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
825 if (IsEqualGUID(riid, &IID_IUnknown) ||
826 IsEqualGUID(riid, &IID_ID3DXEffect))
828 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
829 *object = This;
830 return S_OK;
833 ERR("Interface %s not found\n", debugstr_guid(riid));
835 return E_NOINTERFACE;
838 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
840 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
842 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
844 return InterlockedIncrement(&This->ref);
847 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
849 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
850 ULONG ref = InterlockedDecrement(&This->ref);
852 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
854 if (!ref)
856 free_effect(This);
857 HeapFree(GetProcessHeap(), 0, This);
860 return ref;
863 /*** ID3DXBaseEffect methods ***/
864 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
866 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
867 ID3DXBaseEffect *base = This->base_effect;
869 TRACE("Forward iface %p, base %p\n", This, base);
871 return ID3DXBaseEffectImpl_GetDesc(base, desc);
874 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
876 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
877 ID3DXBaseEffect *base = This->base_effect;
879 TRACE("Forward iface %p, base %p\n", This, base);
881 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
884 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
886 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
887 ID3DXBaseEffect *base = This->base_effect;
889 TRACE("Forward iface %p, base %p\n", This, base);
891 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
894 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
896 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
897 ID3DXBaseEffect *base = This->base_effect;
899 TRACE("Forward iface %p, base %p\n", This, base);
901 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
904 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
906 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
907 ID3DXBaseEffect *base = This->base_effect;
909 TRACE("Forward iface %p, base %p\n", This, base);
911 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
914 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
916 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
917 ID3DXBaseEffect *base = This->base_effect;
919 TRACE("Forward iface %p, base %p\n", This, base);
921 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
924 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
926 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
927 ID3DXBaseEffect *base = This->base_effect;
929 TRACE("Forward iface %p, base %p\n", This, base);
931 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
934 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
936 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
937 ID3DXBaseEffect *base = This->base_effect;
939 TRACE("Forward iface %p, base %p\n", This, base);
941 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
944 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
946 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
947 ID3DXBaseEffect *base = This->base_effect;
949 TRACE("Forward iface %p, base %p\n", This, base);
951 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
954 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
956 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
957 ID3DXBaseEffect *base = This->base_effect;
959 TRACE("Forward iface %p, base %p\n", This, base);
961 return ID3DXBaseEffectImpl_GetTechnique(base, index);
964 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
966 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
967 ID3DXBaseEffect *base = This->base_effect;
969 TRACE("Forward iface %p, base %p\n", This, base);
971 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
974 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
976 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
977 ID3DXBaseEffect *base = This->base_effect;
979 TRACE("Forward iface %p, base %p\n", This, base);
981 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
984 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
986 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
987 ID3DXBaseEffect *base = This->base_effect;
989 TRACE("Forward iface %p, base %p\n", This, base);
991 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
994 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
996 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
997 ID3DXBaseEffect *base = This->base_effect;
999 TRACE("Forward iface %p, base %p\n", This, base);
1001 return ID3DXBaseEffectImpl_GetFunction(base, index);
1004 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1006 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1007 ID3DXBaseEffect *base = This->base_effect;
1009 TRACE("Forward iface %p, base %p\n", This, base);
1011 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1014 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1016 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1017 ID3DXBaseEffect *base = This->base_effect;
1019 TRACE("Forward iface %p, base %p\n", This, base);
1021 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1024 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1026 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1027 ID3DXBaseEffect *base = This->base_effect;
1029 TRACE("Forward iface %p, base %p\n", This, base);
1031 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1034 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1036 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1037 ID3DXBaseEffect *base = This->base_effect;
1039 TRACE("Forward iface %p, base %p\n", This, base);
1041 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1044 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1046 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1047 ID3DXBaseEffect *base = This->base_effect;
1049 TRACE("Forward iface %p, base %p\n", This, base);
1051 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1054 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1056 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1057 ID3DXBaseEffect *base = This->base_effect;
1059 TRACE("Forward iface %p, base %p\n", This, base);
1061 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1064 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1066 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1067 ID3DXBaseEffect *base = This->base_effect;
1069 TRACE("Forward iface %p, base %p\n", This, base);
1071 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1074 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1076 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1077 ID3DXBaseEffect *base = This->base_effect;
1079 TRACE("Forward iface %p, base %p\n", This, base);
1081 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1084 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1086 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1087 ID3DXBaseEffect *base = This->base_effect;
1089 TRACE("Forward iface %p, base %p\n", This, base);
1091 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1094 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
1096 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1097 ID3DXBaseEffect *base = This->base_effect;
1099 TRACE("Forward iface %p, base %p\n", This, base);
1101 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1104 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1106 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1107 ID3DXBaseEffect *base = This->base_effect;
1109 TRACE("Forward iface %p, base %p\n", This, base);
1111 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1114 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1116 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1117 ID3DXBaseEffect *base = This->base_effect;
1119 TRACE("Forward iface %p, base %p\n", This, base);
1121 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1124 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1126 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1127 ID3DXBaseEffect *base = This->base_effect;
1129 TRACE("Forward iface %p, base %p\n", This, base);
1131 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1134 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
1136 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1137 ID3DXBaseEffect *base = This->base_effect;
1139 TRACE("Forward iface %p, base %p\n", This, base);
1141 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1144 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1146 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1147 ID3DXBaseEffect *base = This->base_effect;
1149 TRACE("Forward iface %p, base %p\n", This, base);
1151 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1154 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1156 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1157 ID3DXBaseEffect *base = This->base_effect;
1159 TRACE("Forward iface %p, base %p\n", This, base);
1161 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1164 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1166 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1167 ID3DXBaseEffect *base = This->base_effect;
1169 TRACE("Forward iface %p, base %p\n", This, base);
1171 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1174 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1176 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1177 ID3DXBaseEffect *base = This->base_effect;
1179 TRACE("Forward iface %p, base %p\n", This, base);
1181 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1184 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1186 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1187 ID3DXBaseEffect *base = This->base_effect;
1189 TRACE("Forward iface %p, base %p\n", This, base);
1191 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1194 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1196 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1197 ID3DXBaseEffect *base = This->base_effect;
1199 TRACE("Forward iface %p, base %p\n", This, base);
1201 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1204 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1206 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1207 ID3DXBaseEffect *base = This->base_effect;
1209 TRACE("Forward iface %p, base %p\n", This, base);
1211 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1214 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1216 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1217 ID3DXBaseEffect *base = This->base_effect;
1219 TRACE("Forward iface %p, base %p\n", This, base);
1221 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
1224 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1226 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1227 ID3DXBaseEffect *base = This->base_effect;
1229 TRACE("Forward iface %p, base %p\n", This, base);
1231 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
1234 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1236 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1237 ID3DXBaseEffect *base = This->base_effect;
1239 TRACE("Forward iface %p, base %p\n", This, base);
1241 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
1244 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1246 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1247 ID3DXBaseEffect *base = This->base_effect;
1249 TRACE("Forward iface %p, base %p\n", This, base);
1251 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
1254 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1256 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1257 ID3DXBaseEffect *base = This->base_effect;
1259 TRACE("Forward iface %p, base %p\n", This, base);
1261 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
1264 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1266 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1267 ID3DXBaseEffect *base = This->base_effect;
1269 TRACE("Forward iface %p, base %p\n", This, base);
1271 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
1274 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1276 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1277 ID3DXBaseEffect *base = This->base_effect;
1279 TRACE("Forward iface %p, base %p\n", This, base);
1281 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
1284 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1286 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1287 ID3DXBaseEffect *base = This->base_effect;
1289 TRACE("Forward iface %p, base %p\n", This, base);
1291 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
1294 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1296 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1297 ID3DXBaseEffect *base = This->base_effect;
1299 TRACE("Forward iface %p, base %p\n", This, base);
1301 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
1304 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1306 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1307 ID3DXBaseEffect *base = This->base_effect;
1309 TRACE("Forward iface %p, base %p\n", This, base);
1311 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
1314 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1316 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1317 ID3DXBaseEffect *base = This->base_effect;
1319 TRACE("Forward iface %p, base %p\n", This, base);
1321 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
1324 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1326 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1327 ID3DXBaseEffect *base = This->base_effect;
1329 TRACE("Forward iface %p, base %p\n", This, base);
1331 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
1334 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1336 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1337 ID3DXBaseEffect *base = This->base_effect;
1339 TRACE("Forward iface %p, base %p\n", This, base);
1341 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
1344 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1346 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1347 ID3DXBaseEffect *base = This->base_effect;
1349 TRACE("Forward iface %p, base %p\n", This, base);
1351 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
1354 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1356 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1357 ID3DXBaseEffect *base = This->base_effect;
1359 TRACE("Forward iface %p, base %p\n", This, base);
1361 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
1364 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1366 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1367 ID3DXBaseEffect *base = This->base_effect;
1369 TRACE("Forward iface %p, base %p\n", This, base);
1371 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
1374 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1376 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1377 ID3DXBaseEffect *base = This->base_effect;
1379 TRACE("Forward iface %p, base %p\n", This, base);
1381 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
1384 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1386 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1387 ID3DXBaseEffect *base = This->base_effect;
1389 TRACE("Forward iface %p, base %p\n", This, base);
1391 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
1394 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1396 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1397 ID3DXBaseEffect *base = This->base_effect;
1399 TRACE("Forward iface %p, base %p\n", This, base);
1401 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
1404 /*** ID3DXEffect methods ***/
1405 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
1407 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1409 TRACE("iface %p, pool %p\n", This, pool);
1411 if (!pool)
1413 WARN("Invalid argument supplied.\n");
1414 return D3DERR_INVALIDCALL;
1417 if (This->pool)
1419 This->pool->lpVtbl->AddRef(This->pool);
1422 *pool = This->pool;
1424 TRACE("Returning pool %p\n", *pool);
1426 return S_OK;
1429 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1431 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1433 FIXME("(%p)->(%p): stub\n", This, technique);
1435 return E_NOTIMPL;
1438 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
1440 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1442 FIXME("(%p)->(): stub\n", This);
1444 return NULL;
1447 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1449 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1451 FIXME("(%p)->(%p): stub\n", This, technique);
1453 return D3D_OK;
1456 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
1458 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1460 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
1462 return E_NOTIMPL;
1465 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
1467 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1469 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
1471 return FALSE;
1474 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
1476 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1478 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
1480 return E_NOTIMPL;
1483 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
1485 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1487 FIXME("(%p)->(%u): stub\n", This, pass);
1489 return E_NOTIMPL;
1492 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
1494 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1496 FIXME("(%p)->(): stub\n", This);
1498 return E_NOTIMPL;
1501 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
1503 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1505 FIXME("(%p)->(): stub\n", This);
1507 return E_NOTIMPL;
1510 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
1512 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1514 FIXME("(%p)->(): stub\n", This);
1516 return E_NOTIMPL;
1519 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
1521 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1523 TRACE("iface %p, device %p\n", This, device);
1525 if (!device)
1527 WARN("Invalid argument supplied.\n");
1528 return D3DERR_INVALIDCALL;
1531 IDirect3DDevice9_AddRef(This->device);
1533 *device = This->device;
1535 TRACE("Returning device %p\n", *device);
1537 return S_OK;
1540 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
1542 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1544 FIXME("(%p)->(): stub\n", This);
1546 return E_NOTIMPL;
1549 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
1551 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1553 FIXME("(%p)->(): stub\n", This);
1555 return E_NOTIMPL;
1558 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER manager)
1560 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1562 FIXME("(%p)->(%p): stub\n", This, manager);
1564 return E_NOTIMPL;
1567 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER* manager)
1569 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1571 FIXME("(%p)->(%p): stub\n", This, manager);
1573 return E_NOTIMPL;
1576 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
1578 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1580 FIXME("(%p)->(): stub\n", This);
1582 return E_NOTIMPL;
1585 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
1587 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1589 FIXME("(%p)->(): stub\n", This);
1591 return NULL;
1594 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
1596 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1598 FIXME("(%p)->(%p): stub\n", This, parameter_block);
1600 return E_NOTIMPL;
1603 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
1605 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1607 FIXME("(%p)->(%p): stub\n", This, parameter_block);
1609 return E_NOTIMPL;
1612 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
1614 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1616 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
1618 return E_NOTIMPL;
1621 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
1623 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1625 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
1627 return E_NOTIMPL;
1630 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
1632 /*** IUnknown methods ***/
1633 ID3DXEffectImpl_QueryInterface,
1634 ID3DXEffectImpl_AddRef,
1635 ID3DXEffectImpl_Release,
1636 /*** ID3DXBaseEffect methods ***/
1637 ID3DXEffectImpl_GetDesc,
1638 ID3DXEffectImpl_GetParameterDesc,
1639 ID3DXEffectImpl_GetTechniqueDesc,
1640 ID3DXEffectImpl_GetPassDesc,
1641 ID3DXEffectImpl_GetFunctionDesc,
1642 ID3DXEffectImpl_GetParameter,
1643 ID3DXEffectImpl_GetParameterByName,
1644 ID3DXEffectImpl_GetParameterBySemantic,
1645 ID3DXEffectImpl_GetParameterElement,
1646 ID3DXEffectImpl_GetTechnique,
1647 ID3DXEffectImpl_GetTechniqueByName,
1648 ID3DXEffectImpl_GetPass,
1649 ID3DXEffectImpl_GetPassByName,
1650 ID3DXEffectImpl_GetFunction,
1651 ID3DXEffectImpl_GetFunctionByName,
1652 ID3DXEffectImpl_GetAnnotation,
1653 ID3DXEffectImpl_GetAnnotationByName,
1654 ID3DXEffectImpl_SetValue,
1655 ID3DXEffectImpl_GetValue,
1656 ID3DXEffectImpl_SetBool,
1657 ID3DXEffectImpl_GetBool,
1658 ID3DXEffectImpl_SetBoolArray,
1659 ID3DXEffectImpl_GetBoolArray,
1660 ID3DXEffectImpl_SetInt,
1661 ID3DXEffectImpl_GetInt,
1662 ID3DXEffectImpl_SetIntArray,
1663 ID3DXEffectImpl_GetIntArray,
1664 ID3DXEffectImpl_SetFloat,
1665 ID3DXEffectImpl_GetFloat,
1666 ID3DXEffectImpl_SetFloatArray,
1667 ID3DXEffectImpl_GetFloatArray,
1668 ID3DXEffectImpl_SetVector,
1669 ID3DXEffectImpl_GetVector,
1670 ID3DXEffectImpl_SetVectorArray,
1671 ID3DXEffectImpl_GetVectorArray,
1672 ID3DXEffectImpl_SetMatrix,
1673 ID3DXEffectImpl_GetMatrix,
1674 ID3DXEffectImpl_SetMatrixArray,
1675 ID3DXEffectImpl_GetMatrixArray,
1676 ID3DXEffectImpl_SetMatrixPointerArray,
1677 ID3DXEffectImpl_GetMatrixPointerArray,
1678 ID3DXEffectImpl_SetMatrixTranspose,
1679 ID3DXEffectImpl_GetMatrixTranspose,
1680 ID3DXEffectImpl_SetMatrixTransposeArray,
1681 ID3DXEffectImpl_GetMatrixTransposeArray,
1682 ID3DXEffectImpl_SetMatrixTransposePointerArray,
1683 ID3DXEffectImpl_GetMatrixTransposePointerArray,
1684 ID3DXEffectImpl_SetString,
1685 ID3DXEffectImpl_GetString,
1686 ID3DXEffectImpl_SetTexture,
1687 ID3DXEffectImpl_GetTexture,
1688 ID3DXEffectImpl_GetPixelShader,
1689 ID3DXEffectImpl_GetVertexShader,
1690 ID3DXEffectImpl_SetArrayRange,
1691 /*** ID3DXEffect methods ***/
1692 ID3DXEffectImpl_GetPool,
1693 ID3DXEffectImpl_SetTechnique,
1694 ID3DXEffectImpl_GetCurrentTechnique,
1695 ID3DXEffectImpl_ValidateTechnique,
1696 ID3DXEffectImpl_FindNextValidTechnique,
1697 ID3DXEffectImpl_IsParameterUsed,
1698 ID3DXEffectImpl_Begin,
1699 ID3DXEffectImpl_BeginPass,
1700 ID3DXEffectImpl_CommitChanges,
1701 ID3DXEffectImpl_EndPass,
1702 ID3DXEffectImpl_End,
1703 ID3DXEffectImpl_GetDevice,
1704 ID3DXEffectImpl_OnLostDevice,
1705 ID3DXEffectImpl_OnResetDevice,
1706 ID3DXEffectImpl_SetStateManager,
1707 ID3DXEffectImpl_GetStateManager,
1708 ID3DXEffectImpl_BeginParameterBlock,
1709 ID3DXEffectImpl_EndParameterBlock,
1710 ID3DXEffectImpl_ApplyParameterBlock,
1711 ID3DXEffectImpl_DeleteParameterBlock,
1712 ID3DXEffectImpl_CloneEffect,
1713 ID3DXEffectImpl_SetRawValue
1716 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
1718 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
1721 /*** IUnknown methods ***/
1722 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
1724 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1726 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
1728 if (IsEqualGUID(riid, &IID_IUnknown) ||
1729 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
1731 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
1732 *object = This;
1733 return S_OK;
1736 ERR("Interface %s not found\n", debugstr_guid(riid));
1738 return E_NOINTERFACE;
1741 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
1743 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1745 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
1747 return InterlockedIncrement(&This->ref);
1750 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
1752 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1753 ULONG ref = InterlockedDecrement(&This->ref);
1755 TRACE("iface %p: Release from %u\n", iface, ref + 1);
1757 if (!ref)
1759 free_effect_compiler(This);
1760 HeapFree(GetProcessHeap(), 0, This);
1763 return ref;
1766 /*** ID3DXBaseEffect methods ***/
1767 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
1769 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1770 ID3DXBaseEffect *base = This->base_effect;
1772 TRACE("Forward iface %p, base %p\n", This, base);
1774 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1777 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1779 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1780 ID3DXBaseEffect *base = This->base_effect;
1782 TRACE("Forward iface %p, base %p\n", This, base);
1784 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1787 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1789 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1790 ID3DXBaseEffect *base = This->base_effect;
1792 TRACE("Forward iface %p, base %p\n", This, base);
1794 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1797 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1799 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1800 ID3DXBaseEffect *base = This->base_effect;
1802 TRACE("Forward iface %p, base %p\n", This, base);
1804 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1807 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1809 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1810 ID3DXBaseEffect *base = This->base_effect;
1812 TRACE("Forward iface %p, base %p\n", This, base);
1814 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1817 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
1819 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1820 ID3DXBaseEffect *base = This->base_effect;
1822 TRACE("Forward iface %p, base %p\n", This, base);
1824 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1827 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
1829 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1830 ID3DXBaseEffect *base = This->base_effect;
1832 TRACE("Forward iface %p, base %p\n", This, base);
1834 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1837 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
1839 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1840 ID3DXBaseEffect *base = This->base_effect;
1842 TRACE("Forward iface %p, base %p\n", This, base);
1844 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1847 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
1849 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1850 ID3DXBaseEffect *base = This->base_effect;
1852 TRACE("Forward iface %p, base %p\n", This, base);
1854 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1857 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
1859 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1860 ID3DXBaseEffect *base = This->base_effect;
1862 TRACE("Forward iface %p, base %p\n", This, base);
1864 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1867 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
1869 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1870 ID3DXBaseEffect *base = This->base_effect;
1872 TRACE("Forward iface %p, base %p\n", This, base);
1874 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1877 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
1879 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1880 ID3DXBaseEffect *base = This->base_effect;
1882 TRACE("Forward iface %p, base %p\n", This, base);
1884 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1887 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
1889 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1890 ID3DXBaseEffect *base = This->base_effect;
1892 TRACE("Forward iface %p, base %p\n", This, base);
1894 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1897 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
1899 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1900 ID3DXBaseEffect *base = This->base_effect;
1902 TRACE("Forward iface %p, base %p\n", This, base);
1904 return ID3DXBaseEffectImpl_GetFunction(base, index);
1907 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
1909 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1910 ID3DXBaseEffect *base = This->base_effect;
1912 TRACE("Forward iface %p, base %p\n", This, base);
1914 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1917 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
1919 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1920 ID3DXBaseEffect *base = This->base_effect;
1922 TRACE("Forward iface %p, base %p\n", This, base);
1924 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1927 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
1929 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1930 ID3DXBaseEffect *base = This->base_effect;
1932 TRACE("Forward iface %p, base %p\n", This, base);
1934 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1937 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1939 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1940 ID3DXBaseEffect *base = This->base_effect;
1942 TRACE("Forward iface %p, base %p\n", This, base);
1944 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1947 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1949 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1950 ID3DXBaseEffect *base = This->base_effect;
1952 TRACE("Forward iface %p, base %p\n", This, base);
1954 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1957 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
1959 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1960 ID3DXBaseEffect *base = This->base_effect;
1962 TRACE("Forward iface %p, base %p\n", This, base);
1964 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1967 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
1969 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1970 ID3DXBaseEffect *base = This->base_effect;
1972 TRACE("Forward iface %p, base %p\n", This, base);
1974 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1977 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1979 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1980 ID3DXBaseEffect *base = This->base_effect;
1982 TRACE("Forward iface %p, base %p\n", This, base);
1984 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1987 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1989 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1990 ID3DXBaseEffect *base = This->base_effect;
1992 TRACE("Forward iface %p, base %p\n", This, base);
1994 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1997 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
1999 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2000 ID3DXBaseEffect *base = This->base_effect;
2002 TRACE("Forward iface %p, base %p\n", This, base);
2004 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2007 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2009 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2010 ID3DXBaseEffect *base = This->base_effect;
2012 TRACE("Forward iface %p, base %p\n", This, base);
2014 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2017 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2019 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2020 ID3DXBaseEffect *base = This->base_effect;
2022 TRACE("Forward iface %p, base %p\n", This, base);
2024 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2027 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2029 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2030 ID3DXBaseEffect *base = This->base_effect;
2032 TRACE("Forward iface %p, base %p\n", This, base);
2034 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2037 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2039 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2040 ID3DXBaseEffect *base = This->base_effect;
2042 TRACE("Forward iface %p, base %p\n", This, base);
2044 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2047 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2049 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2050 ID3DXBaseEffect *base = This->base_effect;
2052 TRACE("Forward iface %p, base %p\n", This, base);
2054 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2057 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2059 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2060 ID3DXBaseEffect *base = This->base_effect;
2062 TRACE("Forward iface %p, base %p\n", This, base);
2064 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2067 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2069 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2070 ID3DXBaseEffect *base = This->base_effect;
2072 TRACE("Forward iface %p, base %p\n", This, base);
2074 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2077 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2079 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2080 ID3DXBaseEffect *base = This->base_effect;
2082 TRACE("Forward iface %p, base %p\n", This, base);
2084 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2087 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2089 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2090 ID3DXBaseEffect *base = This->base_effect;
2092 TRACE("Forward iface %p, base %p\n", This, base);
2094 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2097 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2099 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2100 ID3DXBaseEffect *base = This->base_effect;
2102 TRACE("Forward iface %p, base %p\n", This, base);
2104 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2107 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2109 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2110 ID3DXBaseEffect *base = This->base_effect;
2112 TRACE("Forward iface %p, base %p\n", This, base);
2114 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2117 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2119 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2120 ID3DXBaseEffect *base = This->base_effect;
2122 TRACE("Forward iface %p, base %p\n", This, base);
2124 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2127 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2129 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2130 ID3DXBaseEffect *base = This->base_effect;
2132 TRACE("Forward iface %p, base %p\n", This, base);
2134 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2137 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2139 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2140 ID3DXBaseEffect *base = This->base_effect;
2142 TRACE("Forward iface %p, base %p\n", This, base);
2144 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2147 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2149 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2150 ID3DXBaseEffect *base = This->base_effect;
2152 TRACE("Forward iface %p, base %p\n", This, base);
2154 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2157 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2159 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2160 ID3DXBaseEffect *base = This->base_effect;
2162 TRACE("Forward iface %p, base %p\n", This, base);
2164 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2167 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2169 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2170 ID3DXBaseEffect *base = This->base_effect;
2172 TRACE("Forward iface %p, base %p\n", This, base);
2174 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2177 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2179 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2180 ID3DXBaseEffect *base = This->base_effect;
2182 TRACE("Forward iface %p, base %p\n", This, base);
2184 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2187 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2189 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2190 ID3DXBaseEffect *base = This->base_effect;
2192 TRACE("Forward iface %p, base %p\n", This, base);
2194 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2197 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2199 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2200 ID3DXBaseEffect *base = This->base_effect;
2202 TRACE("Forward iface %p, base %p\n", This, base);
2204 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2207 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2209 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2210 ID3DXBaseEffect *base = This->base_effect;
2212 TRACE("Forward iface %p, base %p\n", This, base);
2214 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2217 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2219 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2220 ID3DXBaseEffect *base = This->base_effect;
2222 TRACE("Forward iface %p, base %p\n", This, base);
2224 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2227 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2229 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2230 ID3DXBaseEffect *base = This->base_effect;
2232 TRACE("Forward iface %p, base %p\n", This, base);
2234 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2237 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
2239 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2240 ID3DXBaseEffect *base = This->base_effect;
2242 TRACE("Forward iface %p, base %p\n", This, base);
2244 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2247 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
2249 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2250 ID3DXBaseEffect *base = This->base_effect;
2252 TRACE("Forward iface %p, base %p\n", This, base);
2254 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2257 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2259 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2260 ID3DXBaseEffect *base = This->base_effect;
2262 TRACE("Forward iface %p, base %p\n", This, base);
2264 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2267 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2269 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2270 ID3DXBaseEffect *base = This->base_effect;
2272 TRACE("Forward iface %p, base %p\n", This, base);
2274 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2277 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2279 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2280 ID3DXBaseEffect *base = This->base_effect;
2282 TRACE("Forward iface %p, base %p\n", This, base);
2284 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2287 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2289 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2290 ID3DXBaseEffect *base = This->base_effect;
2292 TRACE("Forward iface %p, base %p\n", This, base);
2294 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2297 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
2299 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2300 ID3DXBaseEffect *base = This->base_effect;
2302 TRACE("Forward iface %p, base %p\n", This, base);
2304 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2307 /*** ID3DXEffectCompiler methods ***/
2308 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
2310 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2312 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
2314 return E_NOTIMPL;
2317 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
2319 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2321 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
2323 return E_NOTIMPL;
2326 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
2327 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
2329 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2331 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
2333 return E_NOTIMPL;
2336 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
2337 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
2339 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2341 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
2342 This, function, target, flags, shader, error_msgs, constant_table);
2344 return E_NOTIMPL;
2347 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
2349 /*** IUnknown methods ***/
2350 ID3DXEffectCompilerImpl_QueryInterface,
2351 ID3DXEffectCompilerImpl_AddRef,
2352 ID3DXEffectCompilerImpl_Release,
2353 /*** ID3DXBaseEffect methods ***/
2354 ID3DXEffectCompilerImpl_GetDesc,
2355 ID3DXEffectCompilerImpl_GetParameterDesc,
2356 ID3DXEffectCompilerImpl_GetTechniqueDesc,
2357 ID3DXEffectCompilerImpl_GetPassDesc,
2358 ID3DXEffectCompilerImpl_GetFunctionDesc,
2359 ID3DXEffectCompilerImpl_GetParameter,
2360 ID3DXEffectCompilerImpl_GetParameterByName,
2361 ID3DXEffectCompilerImpl_GetParameterBySemantic,
2362 ID3DXEffectCompilerImpl_GetParameterElement,
2363 ID3DXEffectCompilerImpl_GetTechnique,
2364 ID3DXEffectCompilerImpl_GetTechniqueByName,
2365 ID3DXEffectCompilerImpl_GetPass,
2366 ID3DXEffectCompilerImpl_GetPassByName,
2367 ID3DXEffectCompilerImpl_GetFunction,
2368 ID3DXEffectCompilerImpl_GetFunctionByName,
2369 ID3DXEffectCompilerImpl_GetAnnotation,
2370 ID3DXEffectCompilerImpl_GetAnnotationByName,
2371 ID3DXEffectCompilerImpl_SetValue,
2372 ID3DXEffectCompilerImpl_GetValue,
2373 ID3DXEffectCompilerImpl_SetBool,
2374 ID3DXEffectCompilerImpl_GetBool,
2375 ID3DXEffectCompilerImpl_SetBoolArray,
2376 ID3DXEffectCompilerImpl_GetBoolArray,
2377 ID3DXEffectCompilerImpl_SetInt,
2378 ID3DXEffectCompilerImpl_GetInt,
2379 ID3DXEffectCompilerImpl_SetIntArray,
2380 ID3DXEffectCompilerImpl_GetIntArray,
2381 ID3DXEffectCompilerImpl_SetFloat,
2382 ID3DXEffectCompilerImpl_GetFloat,
2383 ID3DXEffectCompilerImpl_SetFloatArray,
2384 ID3DXEffectCompilerImpl_GetFloatArray,
2385 ID3DXEffectCompilerImpl_SetVector,
2386 ID3DXEffectCompilerImpl_GetVector,
2387 ID3DXEffectCompilerImpl_SetVectorArray,
2388 ID3DXEffectCompilerImpl_GetVectorArray,
2389 ID3DXEffectCompilerImpl_SetMatrix,
2390 ID3DXEffectCompilerImpl_GetMatrix,
2391 ID3DXEffectCompilerImpl_SetMatrixArray,
2392 ID3DXEffectCompilerImpl_GetMatrixArray,
2393 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
2394 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
2395 ID3DXEffectCompilerImpl_SetMatrixTranspose,
2396 ID3DXEffectCompilerImpl_GetMatrixTranspose,
2397 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
2398 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
2399 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
2400 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
2401 ID3DXEffectCompilerImpl_SetString,
2402 ID3DXEffectCompilerImpl_GetString,
2403 ID3DXEffectCompilerImpl_SetTexture,
2404 ID3DXEffectCompilerImpl_GetTexture,
2405 ID3DXEffectCompilerImpl_GetPixelShader,
2406 ID3DXEffectCompilerImpl_GetVertexShader,
2407 ID3DXEffectCompilerImpl_SetArrayRange,
2408 /*** ID3DXEffectCompiler methods ***/
2409 ID3DXEffectCompilerImpl_SetLiteral,
2410 ID3DXEffectCompilerImpl_GetLiteral,
2411 ID3DXEffectCompilerImpl_CompileEffect,
2412 ID3DXEffectCompilerImpl_CompileShader,
2415 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value)
2417 unsigned int i;
2418 HRESULT hr;
2419 UINT old_size = 0;
2421 if (param->element_count)
2423 param->data = value;
2425 for (i = 0; i < param->element_count; ++i)
2427 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
2429 hr = d3dx9_parse_value(member, (char *)value + old_size);
2430 if (hr != D3D_OK)
2432 WARN("Failed to parse value\n");
2433 return hr;
2436 old_size += member->bytes;
2439 return D3D_OK;
2442 switch(param->class)
2444 case D3DXPC_SCALAR:
2445 case D3DXPC_VECTOR:
2446 case D3DXPC_MATRIX_ROWS:
2447 case D3DXPC_MATRIX_COLUMNS:
2448 param->data = value;
2449 break;
2451 case D3DXPC_STRUCT:
2452 param->data = value;
2454 for (i = 0; i < param->member_count; ++i)
2456 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
2458 hr = d3dx9_parse_value(member, (char *)value + old_size);
2459 if (hr != D3D_OK)
2461 WARN("Failed to parse value\n");
2462 return hr;
2465 old_size += member->bytes;
2467 break;
2469 default:
2470 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2471 break;
2474 return D3D_OK;
2478 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
2480 UINT size = param->bytes;
2481 HRESULT hr;
2482 void *value;
2484 TRACE("param size: %u\n", size);
2486 value = HeapAlloc(GetProcessHeap(), 0, size);
2487 if (!value)
2489 ERR("Failed to allocate data memory.\n");
2490 return E_OUTOFMEMORY;
2493 TRACE("Data: %s.\n", debugstr_an(ptr, size));
2494 memcpy(value, ptr, size);
2496 hr = d3dx9_parse_value(param, value);
2497 if (hr != D3D_OK)
2499 WARN("Failed to parse value\n");
2500 HeapFree(GetProcessHeap(), 0, value);
2501 return hr;
2504 param->data = value;
2506 return D3D_OK;
2509 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
2511 DWORD size;
2513 read_dword(&ptr, &size);
2514 TRACE("Name size: %#x\n", size);
2516 if (!size)
2518 return D3D_OK;
2521 *name = HeapAlloc(GetProcessHeap(), 0, size);
2522 if (!*name)
2524 ERR("Failed to allocate name memory.\n");
2525 return E_OUTOFMEMORY;
2528 TRACE("Name: %s.\n", debugstr_an(ptr, size));
2529 memcpy(*name, ptr, size);
2531 return D3D_OK;
2534 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr, struct d3dx_parameter *parent)
2536 DWORD offset;
2537 HRESULT hr;
2538 D3DXHANDLE *member_handles = NULL;
2539 UINT i;
2541 if (!parent)
2543 read_dword(ptr, &param->type);
2544 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
2546 read_dword(ptr, &param->class);
2547 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
2549 read_dword(ptr, &offset);
2550 TRACE("Type name offset: %#x\n", offset);
2551 hr = d3dx9_parse_name(&param->name, data + offset);
2552 if (hr != D3D_OK)
2554 WARN("Failed to parse name\n");
2555 goto err_out;
2558 read_dword(ptr, &offset);
2559 TRACE("Type semantic offset: %#x\n", offset);
2560 hr = d3dx9_parse_name(&param->semantic, data + offset);
2561 if (hr != D3D_OK)
2563 WARN("Failed to parse semantic\n");
2564 goto err_out;
2567 read_dword(ptr, &param->element_count);
2568 TRACE("Elements: %u\n", param->element_count);
2570 switch (param->class)
2572 case D3DXPC_VECTOR:
2573 read_dword(ptr, &param->columns);
2574 TRACE("Columns: %u\n", param->columns);
2576 read_dword(ptr, &param->rows);
2577 TRACE("Rows: %u\n", param->rows);
2579 /* sizeof(DWORD) * rows * columns */
2580 param->bytes = 4 * param->rows * param->columns;
2581 break;
2583 case D3DXPC_SCALAR:
2584 case D3DXPC_MATRIX_ROWS:
2585 case D3DXPC_MATRIX_COLUMNS:
2586 read_dword(ptr, &param->rows);
2587 TRACE("Rows: %u\n", param->rows);
2589 read_dword(ptr, &param->columns);
2590 TRACE("Columns: %u\n", param->columns);
2592 /* sizeof(DWORD) * rows * columns */
2593 param->bytes = 4 * param->rows * param->columns;
2594 break;
2596 case D3DXPC_STRUCT:
2597 read_dword(ptr, &param->member_count);
2598 TRACE("Members: %u\n", param->member_count);
2599 break;
2601 default:
2602 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2603 break;
2606 else
2608 /* elements */
2609 param->type = parent->type;
2610 param->class = parent->class;
2611 param->name = parent->name;
2612 param->semantic = parent->semantic;
2613 param->element_count = 0;
2614 param->annotation_count = 0;
2615 param->member_count = parent->member_count;
2616 param->bytes = parent->bytes;
2617 param->flags = parent->flags;
2618 param->rows = parent->rows;
2619 param->columns = parent->columns;
2622 if (param->element_count)
2624 unsigned int param_bytes = 0;
2626 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
2627 if (!member_handles)
2629 ERR("Out of memory\n");
2630 hr = E_OUTOFMEMORY;
2631 goto err_out;
2634 for (i = 0; i < param->element_count; ++i)
2636 struct d3dx_parameter *member;
2638 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
2639 if (!member)
2641 ERR("Out of memory\n");
2642 hr = E_OUTOFMEMORY;
2643 goto err_out;
2646 member_handles[i] = get_parameter_handle(member);
2647 member->base = param->base;
2649 hr = d3dx9_parse_effect_typedef(member, data, ptr, param);
2650 if (hr != D3D_OK)
2652 WARN("Failed to parse member\n");
2653 goto err_out;
2656 param_bytes += member->bytes;
2659 param->bytes = param_bytes;
2661 else if (param->member_count)
2663 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
2664 if (!member_handles)
2666 ERR("Out of memory\n");
2667 hr = E_OUTOFMEMORY;
2668 goto err_out;
2671 for (i = 0; i < param->member_count; ++i)
2673 struct d3dx_parameter *member;
2675 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
2676 if (!member)
2678 ERR("Out of memory\n");
2679 hr = E_OUTOFMEMORY;
2680 goto err_out;
2683 member_handles[i] = get_parameter_handle(member);
2684 member->base = param->base;
2686 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL);
2687 if (hr != D3D_OK)
2689 WARN("Failed to parse member\n");
2690 goto err_out;
2693 param->bytes += member->bytes;
2697 param->member_handles = member_handles;
2699 return D3D_OK;
2701 err_out:
2703 if (member_handles)
2705 unsigned int count;
2707 if (param->element_count) count = param->element_count;
2708 else count = param->member_count;
2710 for (i = 0; i < count; ++i)
2712 free_parameter(member_handles[i], param->element_count != 0, TRUE);
2714 HeapFree(GetProcessHeap(), 0, member_handles);
2717 if (!parent)
2719 HeapFree(GetProcessHeap(), 0, param->name);
2720 HeapFree(GetProcessHeap(), 0, param->semantic);
2722 param->name = NULL;
2723 param->semantic = NULL;
2725 return hr;
2728 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
2730 DWORD offset;
2731 const char *ptr2;
2732 HRESULT hr;
2734 anno->flags = D3DX_PARAMETER_ANNOTATION;
2736 read_dword(ptr, &offset);
2737 TRACE("Typedef offset: %#x\n", offset);
2738 ptr2 = data + offset;
2739 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL);
2740 if (hr != D3D_OK)
2742 WARN("Failed to parse type definition\n");
2743 return hr;
2746 read_dword(ptr, &offset);
2747 TRACE("Value offset: %#x\n", offset);
2748 hr = d3dx9_parse_init_value(anno, data + offset);
2749 if (hr != D3D_OK)
2751 WARN("Failed to parse value\n");
2752 return hr;
2755 return D3D_OK;
2758 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
2760 DWORD offset;
2761 HRESULT hr;
2762 unsigned int i;
2763 D3DXHANDLE *annotation_handles = NULL;
2764 const char *ptr2;
2766 read_dword(ptr, &offset);
2767 TRACE("Typedef offset: %#x\n", offset);
2768 ptr2 = data + offset;
2770 read_dword(ptr, &offset);
2771 TRACE("Value offset: %#x\n", offset);
2773 read_dword(ptr, &param->flags);
2774 TRACE("Flags: %#x\n", param->flags);
2776 read_dword(ptr, &param->annotation_count);
2777 TRACE("Annotation count: %u\n", param->annotation_count);
2779 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL);
2780 if (hr != D3D_OK)
2782 WARN("Failed to parse type definition\n");
2783 return hr;
2786 hr = d3dx9_parse_init_value(param, data + offset);
2787 if (hr != D3D_OK)
2789 WARN("Failed to parse value\n");
2790 return hr;
2793 if (param->annotation_count)
2795 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
2796 if (!annotation_handles)
2798 ERR("Out of memory\n");
2799 hr = E_OUTOFMEMORY;
2800 goto err_out;
2803 for (i = 0; i < param->annotation_count; ++i)
2805 struct d3dx_parameter *annotation;
2807 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
2808 if (!annotation)
2810 ERR("Out of memory\n");
2811 hr = E_OUTOFMEMORY;
2812 goto err_out;
2815 annotation_handles[i] = get_parameter_handle(annotation);
2816 annotation->base = param->base;
2818 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
2819 if (hr != D3D_OK)
2821 WARN("Failed to parse annotation\n");
2822 goto err_out;
2827 param->annotation_handles = annotation_handles;
2829 return D3D_OK;
2831 err_out:
2833 if (annotation_handles)
2835 for (i = 0; i < param->annotation_count; ++i)
2837 free_parameter(annotation_handles[i], FALSE, FALSE);
2839 HeapFree(GetProcessHeap(), 0, annotation_handles);
2842 return hr;
2845 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
2847 const char *ptr = data + start;
2848 D3DXHANDLE *parameter_handles = NULL;
2849 HRESULT hr;
2850 unsigned int i;
2852 read_dword(&ptr, &base->parameter_count);
2853 TRACE("Parameter count: %u\n", base->parameter_count);
2855 read_dword(&ptr, &base->technique_count);
2856 TRACE("Technique count: %u\n", base->technique_count);
2858 skip_dword_unknown(&ptr, 2);
2860 if (base->parameter_count)
2862 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
2863 if (!parameter_handles)
2865 ERR("Out of memory\n");
2866 hr = E_OUTOFMEMORY;
2867 goto err_out;
2870 for (i = 0; i < base->parameter_count; ++i)
2872 struct d3dx_parameter *parameter;
2874 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
2875 if (!parameter)
2877 ERR("Out of memory\n");
2878 hr = E_OUTOFMEMORY;
2879 goto err_out;
2882 parameter_handles[i] = get_parameter_handle(parameter);
2883 parameter->base = base;
2885 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
2886 if (hr != D3D_OK)
2888 WARN("Failed to parse parameter\n");
2889 goto err_out;
2894 /* todo: Parse techniques */
2896 base->parameter_handles = parameter_handles;
2898 return D3D_OK;
2900 err_out:
2902 if (parameter_handles)
2904 for (i = 0; i < base->parameter_count; ++i)
2906 free_parameter(parameter_handles[i], FALSE, FALSE);
2908 HeapFree(GetProcessHeap(), 0, parameter_handles);
2911 return hr;
2914 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
2915 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
2917 DWORD tag, offset;
2918 const char *ptr = data;
2919 HRESULT hr;
2921 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
2923 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
2924 base->ref = 1;
2925 base->effect = effect;
2927 read_dword(&ptr, &tag);
2928 TRACE("Tag: %x\n", tag);
2930 if (tag != d3dx9_effect_version(9, 1))
2932 /* todo: compile hlsl ascii code */
2933 FIXME("HLSL ascii effects not supported, yet\n");
2935 /* Show the start of the shader for debugging info. */
2936 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
2938 else
2940 read_dword(&ptr, &offset);
2941 TRACE("Offset: %x\n", offset);
2943 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
2944 if (hr != D3D_OK)
2946 FIXME("Failed to parse effect.\n");
2947 return hr;
2951 return D3D_OK;
2954 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
2955 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
2957 HRESULT hr;
2958 struct ID3DXBaseEffectImpl *object = NULL;
2960 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
2962 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
2963 effect->ref = 1;
2965 if (pool) pool->lpVtbl->AddRef(pool);
2966 effect->pool = pool;
2968 IDirect3DDevice9_AddRef(device);
2969 effect->device = device;
2971 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
2972 if (!object)
2974 ERR("Out of memory\n");
2975 hr = E_OUTOFMEMORY;
2976 goto err_out;
2979 hr = d3dx9_base_effect_init(object, data, data_size, effect);
2980 if (hr != D3D_OK)
2982 FIXME("Failed to parse effect.\n");
2983 goto err_out;
2986 effect->base_effect = &object->ID3DXBaseEffect_iface;
2988 return D3D_OK;
2990 err_out:
2992 HeapFree(GetProcessHeap(), 0, object);
2993 free_effect(effect);
2995 return hr;
2998 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
2999 LPCVOID srcdata,
3000 UINT srcdatalen,
3001 CONST D3DXMACRO* defines,
3002 LPD3DXINCLUDE include,
3003 LPCSTR skip_constants,
3004 DWORD flags,
3005 LPD3DXEFFECTPOOL pool,
3006 LPD3DXEFFECT* effect,
3007 LPD3DXBUFFER* compilation_errors)
3009 struct ID3DXEffectImpl *object;
3010 HRESULT hr;
3012 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
3013 skip_constants, flags, pool, effect, compilation_errors);
3015 if (!device || !srcdata)
3016 return D3DERR_INVALIDCALL;
3018 if (!srcdatalen)
3019 return E_FAIL;
3021 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
3022 if (!effect)
3023 return D3D_OK;
3025 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3026 if (!object)
3028 ERR("Out of memory\n");
3029 return E_OUTOFMEMORY;
3032 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
3033 if (FAILED(hr))
3035 WARN("Failed to initialize shader reflection\n");
3036 HeapFree(GetProcessHeap(), 0, object);
3037 return hr;
3040 *effect = &object->ID3DXEffect_iface;
3042 TRACE("Created ID3DXEffect %p\n", object);
3044 return D3D_OK;
3047 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
3048 LPCVOID srcdata,
3049 UINT srcdatalen,
3050 CONST D3DXMACRO* defines,
3051 LPD3DXINCLUDE include,
3052 DWORD flags,
3053 LPD3DXEFFECTPOOL pool,
3054 LPD3DXEFFECT* effect,
3055 LPD3DXBUFFER* compilation_errors)
3057 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
3058 include, flags, pool, effect, compilation_errors);
3060 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
3063 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
3065 HRESULT hr;
3066 struct ID3DXBaseEffectImpl *object = NULL;
3068 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
3070 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
3071 compiler->ref = 1;
3073 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3074 if (!object)
3076 ERR("Out of memory\n");
3077 hr = E_OUTOFMEMORY;
3078 goto err_out;
3081 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
3082 if (hr != D3D_OK)
3084 FIXME("Failed to parse effect.\n");
3085 goto err_out;
3088 compiler->base_effect = &object->ID3DXBaseEffect_iface;
3090 return D3D_OK;
3092 err_out:
3094 HeapFree(GetProcessHeap(), 0, object);
3095 free_effect_compiler(compiler);
3097 return hr;
3100 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
3101 UINT srcdatalen,
3102 CONST D3DXMACRO *defines,
3103 LPD3DXINCLUDE include,
3104 DWORD flags,
3105 LPD3DXEFFECTCOMPILER *compiler,
3106 LPD3DXBUFFER *parse_errors)
3108 struct ID3DXEffectCompilerImpl *object;
3109 HRESULT hr;
3111 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
3112 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
3114 if (!srcdata || !compiler)
3116 WARN("Invalid arguments supplied\n");
3117 return D3DERR_INVALIDCALL;
3120 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3121 if (!object)
3123 ERR("Out of memory\n");
3124 return E_OUTOFMEMORY;
3127 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
3128 if (FAILED(hr))
3130 WARN("Failed to initialize effect compiler\n");
3131 HeapFree(GetProcessHeap(), 0, object);
3132 return hr;
3135 *compiler = &object->ID3DXEffectCompiler_iface;
3137 TRACE("Created ID3DXEffectCompiler %p\n", object);
3139 return D3D_OK;
3142 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
3144 struct ID3DXEffectPoolImpl
3146 ID3DXEffectPool ID3DXEffectPool_iface;
3147 LONG ref;
3150 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
3152 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
3155 /*** IUnknown methods ***/
3156 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
3158 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3160 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
3162 if (IsEqualGUID(riid, &IID_IUnknown) ||
3163 IsEqualGUID(riid, &IID_ID3DXEffectPool))
3165 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
3166 *object = This;
3167 return S_OK;
3170 WARN("Interface %s not found\n", debugstr_guid(riid));
3172 return E_NOINTERFACE;
3175 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
3177 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3179 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
3181 return InterlockedIncrement(&This->ref);
3184 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
3186 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3187 ULONG ref = InterlockedDecrement(&This->ref);
3189 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
3191 if (!ref)
3192 HeapFree(GetProcessHeap(), 0, This);
3194 return ref;
3197 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
3199 /*** IUnknown methods ***/
3200 ID3DXEffectPoolImpl_QueryInterface,
3201 ID3DXEffectPoolImpl_AddRef,
3202 ID3DXEffectPoolImpl_Release
3205 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
3207 struct ID3DXEffectPoolImpl *object;
3209 TRACE("(%p)\n", pool);
3211 if (!pool)
3212 return D3DERR_INVALIDCALL;
3214 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3215 if (!object)
3217 ERR("Out of memory\n");
3218 return E_OUTOFMEMORY;
3221 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
3222 object->ref = 1;
3224 *pool = &object->ID3DXEffectPool_iface;
3226 return S_OK;
3229 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
3230 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3231 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3233 LPVOID buffer;
3234 HRESULT ret;
3235 DWORD size;
3237 TRACE("(%s): relay\n", debugstr_w(srcfile));
3239 if (!device || !srcfile || !defines)
3240 return D3DERR_INVALIDCALL;
3242 ret = map_view_of_file(srcfile, &buffer, &size);
3244 if (FAILED(ret))
3245 return D3DXERR_INVALIDDATA;
3247 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3248 UnmapViewOfFile(buffer);
3250 return ret;
3253 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
3254 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3255 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3257 LPWSTR srcfileW;
3258 HRESULT ret;
3259 DWORD len;
3261 TRACE("(void): relay\n");
3263 if (!srcfile || !defines)
3264 return D3DERR_INVALIDCALL;
3266 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
3267 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
3268 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
3270 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3271 HeapFree(GetProcessHeap(), 0, srcfileW);
3273 return ret;
3276 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
3277 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3278 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3280 TRACE("(void): relay\n");
3281 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
3284 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
3285 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3286 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3288 TRACE("(void): relay\n");
3289 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
3292 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
3293 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3294 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3296 HRSRC resinfo;
3298 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
3300 if (!device || !defines)
3301 return D3DERR_INVALIDCALL;
3303 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
3305 if (resinfo)
3307 LPVOID buffer;
3308 HRESULT ret;
3309 DWORD size;
3311 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3313 if (FAILED(ret))
3314 return D3DXERR_INVALIDDATA;
3316 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3319 return D3DXERR_INVALIDDATA;
3322 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
3323 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3324 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3326 HRSRC resinfo;
3328 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
3330 if (!device || !defines)
3331 return D3DERR_INVALIDCALL;
3333 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
3335 if (resinfo)
3337 LPVOID buffer;
3338 HRESULT ret;
3339 DWORD size;
3341 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3343 if (FAILED(ret))
3344 return D3DXERR_INVALIDDATA;
3346 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3349 return D3DXERR_INVALIDDATA;
3352 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
3353 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3354 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3356 TRACE("(void): relay\n");
3357 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
3360 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
3361 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3362 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3364 TRACE("(void): relay\n");
3365 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
3368 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
3369 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3371 LPVOID buffer;
3372 HRESULT ret;
3373 DWORD size;
3375 TRACE("(%s): relay\n", debugstr_w(srcfile));
3377 if (!srcfile || !defines)
3378 return D3DERR_INVALIDCALL;
3380 ret = map_view_of_file(srcfile, &buffer, &size);
3382 if (FAILED(ret))
3383 return D3DXERR_INVALIDDATA;
3385 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
3386 UnmapViewOfFile(buffer);
3388 return ret;
3391 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
3392 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3394 LPWSTR srcfileW;
3395 HRESULT ret;
3396 DWORD len;
3398 TRACE("(void): relay\n");
3400 if (!srcfile || !defines)
3401 return D3DERR_INVALIDCALL;
3403 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
3404 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
3405 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
3407 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
3408 HeapFree(GetProcessHeap(), 0, srcfileW);
3410 return ret;
3413 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
3414 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3416 HRSRC resinfo;
3418 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
3420 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
3422 if (resinfo)
3424 LPVOID buffer;
3425 HRESULT ret;
3426 DWORD size;
3428 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3430 if (FAILED(ret))
3431 return D3DXERR_INVALIDDATA;
3433 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
3436 return D3DXERR_INVALIDDATA;
3439 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
3440 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3442 HRSRC resinfo;
3444 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
3446 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
3448 if (resinfo)
3450 LPVOID buffer;
3451 HRESULT ret;
3452 DWORD size;
3454 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3456 if (FAILED(ret))
3457 return D3DXERR_INVALIDDATA;
3459 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
3462 return D3DXERR_INVALIDDATA;