d3dx9: Fix ID3DXEffect*::GetVectorArray() forward.
[wine.git] / dlls / d3dx9_36 / effect.c
blobce2ed8212136b4ab4e288793d31738ae3a559188
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 d3dx_pass
56 struct ID3DXBaseEffectImpl *base;
58 char *name;
59 UINT state_count;
60 UINT annotation_count;
62 D3DXHANDLE *annotation_handles;
65 struct d3dx_technique
67 struct ID3DXBaseEffectImpl *base;
69 char *name;
70 UINT pass_count;
71 UINT annotation_count;
73 D3DXHANDLE *annotation_handles;
74 D3DXHANDLE *pass_handles;
77 struct ID3DXBaseEffectImpl
79 ID3DXBaseEffect ID3DXBaseEffect_iface;
80 LONG ref;
82 struct ID3DXEffectImpl *effect;
84 UINT parameter_count;
85 UINT technique_count;
87 D3DXHANDLE *parameter_handles;
88 D3DXHANDLE *technique_handles;
91 struct ID3DXEffectImpl
93 ID3DXEffect ID3DXEffect_iface;
94 LONG ref;
96 LPDIRECT3DDEVICE9 device;
97 LPD3DXEFFECTPOOL pool;
99 ID3DXBaseEffect *base_effect;
102 struct ID3DXEffectCompilerImpl
104 ID3DXEffectCompiler ID3DXEffectCompiler_iface;
105 LONG ref;
107 ID3DXBaseEffect *base_effect;
110 static inline void read_dword(const char **ptr, DWORD *d)
112 memcpy(d, *ptr, sizeof(*d));
113 *ptr += sizeof(*d);
116 static void skip_dword_unknown(const char **ptr, unsigned int count)
118 unsigned int i;
119 DWORD d;
121 FIXME("Skipping %u unknown DWORDs:\n", count);
122 for (i = 0; i < count; ++i)
124 read_dword(ptr, &d);
125 FIXME("\t0x%08x\n", d);
129 static inline struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle)
131 return (struct d3dx_parameter *) handle;
134 static inline struct d3dx_pass *get_pass_struct(D3DXHANDLE handle)
136 return (struct d3dx_pass *) handle;
139 static inline struct d3dx_technique *get_technique_struct(D3DXHANDLE handle)
141 return (struct d3dx_technique *) handle;
144 static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
146 return (D3DXHANDLE) parameter;
149 static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique)
151 return (D3DXHANDLE) technique;
154 static inline D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
156 return (D3DXHANDLE) pass;
159 struct d3dx_technique *is_valid_technique(struct ID3DXBaseEffectImpl *base, D3DXHANDLE technique)
161 unsigned int i;
163 for (i = 0; i < base->technique_count; ++i)
165 if (base->technique_handles[i] == technique)
167 return get_technique_struct(technique);
171 return NULL;
174 struct d3dx_parameter *is_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter)
176 unsigned int i, count;
177 struct d3dx_parameter *p;
179 for (i = 0; i < param->annotation_count; ++i)
181 if (param->annotation_handles[i] == parameter)
183 return get_parameter_struct(parameter);
186 p = is_valid_sub_parameter(get_parameter_struct(param->annotation_handles[i]), parameter);
187 if (p) return p;
190 if (param->element_count) count = param->element_count;
191 else count = param->member_count;
193 for (i = 0; i < count; ++i)
195 if (param->member_handles[i] == parameter)
197 return get_parameter_struct(parameter);
200 p = is_valid_sub_parameter(get_parameter_struct(param->member_handles[i]), parameter);
201 if (p) return p;
204 return NULL;
207 struct d3dx_parameter *is_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
209 unsigned int i, k, m;
210 struct d3dx_parameter *p;
212 for (i = 0; i < base->parameter_count; ++i)
214 if (base->parameter_handles[i] == parameter)
216 return get_parameter_struct(parameter);
219 p = is_valid_sub_parameter(get_parameter_struct(base->parameter_handles[i]), parameter);
220 if (p) return p;
223 for (i = 0; i < base->technique_count; ++i)
225 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
227 for (k = 0; k < technique->pass_count; ++k)
229 struct d3dx_pass *pass = get_pass_struct(technique->pass_handles[k]);
231 for (m = 0; m < pass->annotation_count; ++m)
233 if (pass->annotation_handles[i] == parameter)
235 return get_parameter_struct(parameter);
238 p = is_valid_sub_parameter(get_parameter_struct(pass->annotation_handles[m]), parameter);
239 if (p) return p;
243 for (k = 0; k < technique->annotation_count; ++k)
245 if (technique->annotation_handles[k] == parameter)
247 return get_parameter_struct(parameter);
250 p = is_valid_sub_parameter(get_parameter_struct(technique->annotation_handles[k]), parameter);
251 if (p) return p;
255 return NULL;
258 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
260 unsigned int i;
261 struct d3dx_parameter *param = get_parameter_struct(handle);
263 TRACE("Free parameter %p, child %s\n", param, child ? "yes" : "no");
265 if (!param)
267 return;
270 if (!child)
272 HeapFree(GetProcessHeap(), 0, param->data);
275 if (param->annotation_handles)
277 for (i = 0; i < param->annotation_count; ++i)
279 free_parameter(param->annotation_handles[i], FALSE, FALSE);
281 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
284 if (param->member_handles)
286 unsigned int count;
288 if (param->element_count) count = param->element_count;
289 else count = param->member_count;
291 for (i = 0; i < count; ++i)
293 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
295 HeapFree(GetProcessHeap(), 0, param->member_handles);
298 /* only the parent has to release name and semantic */
299 if (!element)
301 HeapFree(GetProcessHeap(), 0, param->name);
302 HeapFree(GetProcessHeap(), 0, param->semantic);
305 HeapFree(GetProcessHeap(), 0, param);
308 static void free_pass(D3DXHANDLE handle)
310 unsigned int i;
311 struct d3dx_pass *pass = get_pass_struct(handle);
313 TRACE("Free pass %p\n", pass);
315 if (!pass)
317 return;
320 if (pass->annotation_handles)
322 for (i = 0; i < pass->annotation_count; ++i)
324 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
326 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
329 HeapFree(GetProcessHeap(), 0, pass->name);
330 HeapFree(GetProcessHeap(), 0, pass);
333 static void free_technique(D3DXHANDLE handle)
335 unsigned int i;
336 struct d3dx_technique *technique = get_technique_struct(handle);
338 TRACE("Free technique %p\n", technique);
340 if (!technique)
342 return;
345 if (technique->annotation_handles)
347 for (i = 0; i < technique->annotation_count; ++i)
349 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
351 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
354 if (technique->pass_handles)
356 for (i = 0; i < technique->pass_count; ++i)
358 free_pass(technique->pass_handles[i]);
360 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
363 HeapFree(GetProcessHeap(), 0, technique->name);
364 HeapFree(GetProcessHeap(), 0, technique);
367 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
369 unsigned int i;
371 TRACE("Free base effect %p\n", base);
373 if (base->parameter_handles)
375 for (i = 0; i < base->parameter_count; ++i)
377 free_parameter(base->parameter_handles[i], FALSE, FALSE);
379 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
382 if (base->technique_handles)
384 for (i = 0; i < base->technique_count; ++i)
386 free_technique(base->technique_handles[i]);
388 HeapFree(GetProcessHeap(), 0, base->technique_handles);
392 static void free_effect(struct ID3DXEffectImpl *effect)
394 TRACE("Free effect %p\n", effect);
396 if (effect->base_effect)
398 effect->base_effect->lpVtbl->Release(effect->base_effect);
401 if (effect->pool)
403 effect->pool->lpVtbl->Release(effect->pool);
406 IDirect3DDevice9_Release(effect->device);
409 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
411 TRACE("Free effect compiler %p\n", compiler);
413 if (compiler->base_effect)
415 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
419 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
421 return (0xfeff0000 | ((major) << 8) | (minor));
424 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
426 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
429 /*** IUnknown methods ***/
430 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
432 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
434 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
436 if (IsEqualGUID(riid, &IID_IUnknown) ||
437 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
439 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
440 *object = This;
441 return S_OK;
444 ERR("Interface %s not found\n", debugstr_guid(riid));
446 return E_NOINTERFACE;
449 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
451 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
453 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
455 return InterlockedIncrement(&This->ref);
458 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
460 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
461 ULONG ref = InterlockedDecrement(&This->ref);
463 TRACE("iface %p: Release from %u\n", iface, ref + 1);
465 if (!ref)
467 free_base_effect(This);
468 HeapFree(GetProcessHeap(), 0, This);
471 return ref;
474 /*** ID3DXBaseEffect methods ***/
475 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
477 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
479 FIXME("iface %p, desc %p stub\n", This, desc);
481 return E_NOTIMPL;
484 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
486 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
488 FIXME("iface %p, parameter %p, desc %p stub\n", This, parameter, desc);
490 return E_NOTIMPL;
493 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
495 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
496 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
498 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
500 if (!desc || !tech)
502 WARN("Invalid argument specified.\n");
503 return D3DERR_INVALIDCALL;
506 desc->Name = tech->name;
507 desc->Passes = tech->pass_count;
508 desc->Annotations = tech->annotation_count;
510 return D3D_OK;
513 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
515 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
517 FIXME("iface %p, pass %p, desc %p stub\n", This, pass, desc);
519 return E_NOTIMPL;
522 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
524 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
526 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
528 return E_NOTIMPL;
531 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
533 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
535 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
537 if (!parameter)
539 if (index < This->parameter_count)
541 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
542 return This->parameter_handles[index];
545 else
547 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
549 if (param && !param->element_count && index < param->member_count)
551 TRACE("Returning parameter %p\n", param->member_handles[index]);
552 return param->member_handles[index];
556 WARN("Invalid argument specified.\n");
558 return NULL;
561 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
563 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
565 FIXME("iface %p, parameter %p, name %s stub\n", This, parameter, debugstr_a(name));
567 return NULL;
570 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
572 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
574 FIXME("iface %p, parameter %p, semantic %s stub\n", This, parameter, debugstr_a(semantic));
576 return NULL;
579 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
581 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
583 FIXME("iface %p, parameter %p, index %u stub\n", This, parameter, index);
585 return NULL;
588 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
590 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
592 TRACE("iface %p, index %u\n", This, index);
594 if (index >= This->technique_count)
596 WARN("Invalid argument specified.\n");
597 return NULL;
600 TRACE("Returning technique %p\n", This->technique_handles[index]);
602 return This->technique_handles[index];
605 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
607 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
608 unsigned int i;
610 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
612 if (!name)
614 WARN("Invalid argument specified.\n");
615 return NULL;
618 for (i = 0; i < This->technique_count; ++i)
620 struct d3dx_technique *tech = get_technique_struct(This->technique_handles[i]);
622 if (!strcmp(tech->name, name))
624 TRACE("Returning technique %p\n", This->technique_handles[i]);
625 return This->technique_handles[i];
629 WARN("Invalid argument specified.\n");
631 return NULL;
634 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
636 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
638 FIXME("iface %p, technique %p, index %u stub\n", This, technique, index);
640 return NULL;
643 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
645 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
647 FIXME("iface %p, technique %p, name %s stub\n", This, technique, debugstr_a(name));
649 return NULL;
652 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
654 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
656 FIXME("iface %p, index %u stub\n", This, index);
658 return NULL;
661 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
663 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
665 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
667 return NULL;
670 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
672 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
674 FIXME("iface %p, object %p, index %u stub\n", This, object, index);
676 return NULL;
679 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
681 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
683 FIXME("iface %p, object %p, name %s stub\n", This, object, debugstr_a(name));
685 return NULL;
688 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
690 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
692 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
694 return E_NOTIMPL;
697 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
699 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
701 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
703 return E_NOTIMPL;
706 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
708 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
710 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
712 return E_NOTIMPL;
715 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
717 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
719 FIXME("iface %p, parameter %p, b %p stub\n", This, parameter, b);
721 return E_NOTIMPL;
724 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
726 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
728 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
730 return E_NOTIMPL;
733 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
735 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
737 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
739 return E_NOTIMPL;
742 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
744 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
746 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
748 return E_NOTIMPL;
751 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
753 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
755 FIXME("iface %p, parameter %p, n %p stub\n", This, parameter, n);
757 return E_NOTIMPL;
760 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
762 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
764 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
766 return E_NOTIMPL;
769 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
771 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
773 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
775 return E_NOTIMPL;
778 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
780 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
782 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
784 return E_NOTIMPL;
787 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
789 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
791 FIXME("iface %p, parameter %p, f %p stub\n", This, parameter, f);
793 return E_NOTIMPL;
796 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
798 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
800 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
802 return E_NOTIMPL;
805 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
807 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
809 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
811 return E_NOTIMPL;
814 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
816 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
818 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
820 return E_NOTIMPL;
823 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
825 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
827 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
829 return E_NOTIMPL;
832 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
834 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
836 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
838 return E_NOTIMPL;
841 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
843 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
845 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
847 return E_NOTIMPL;
850 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
852 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
854 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
856 return E_NOTIMPL;
859 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
861 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
863 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
865 return E_NOTIMPL;
868 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
870 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
872 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
874 return E_NOTIMPL;
877 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
879 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
881 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
883 return E_NOTIMPL;
886 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
888 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
890 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
892 return E_NOTIMPL;
895 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
897 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
899 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
901 return E_NOTIMPL;
904 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
906 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
908 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
910 return E_NOTIMPL;
913 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
915 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
917 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
919 return E_NOTIMPL;
922 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
924 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
926 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
928 return E_NOTIMPL;
931 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
933 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
935 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
937 return E_NOTIMPL;
940 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
942 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
944 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
946 return E_NOTIMPL;
949 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
951 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
953 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
955 return E_NOTIMPL;
958 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
960 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
962 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
964 return E_NOTIMPL;
967 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
969 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
971 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
973 return E_NOTIMPL;
976 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
978 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
980 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
982 return E_NOTIMPL;
985 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
987 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
989 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
991 return E_NOTIMPL;
994 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
996 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
998 FIXME("iface %p, parameter %p, pshader %p stub\n", This, parameter, pshader);
1000 return E_NOTIMPL;
1003 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1005 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1007 FIXME("iface %p, parameter %p, vshader %p stub\n", This, parameter, vshader);
1009 return E_NOTIMPL;
1012 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1014 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1016 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
1018 return E_NOTIMPL;
1021 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
1023 /*** IUnknown methods ***/
1024 ID3DXBaseEffectImpl_QueryInterface,
1025 ID3DXBaseEffectImpl_AddRef,
1026 ID3DXBaseEffectImpl_Release,
1027 /*** ID3DXBaseEffect methods ***/
1028 ID3DXBaseEffectImpl_GetDesc,
1029 ID3DXBaseEffectImpl_GetParameterDesc,
1030 ID3DXBaseEffectImpl_GetTechniqueDesc,
1031 ID3DXBaseEffectImpl_GetPassDesc,
1032 ID3DXBaseEffectImpl_GetFunctionDesc,
1033 ID3DXBaseEffectImpl_GetParameter,
1034 ID3DXBaseEffectImpl_GetParameterByName,
1035 ID3DXBaseEffectImpl_GetParameterBySemantic,
1036 ID3DXBaseEffectImpl_GetParameterElement,
1037 ID3DXBaseEffectImpl_GetTechnique,
1038 ID3DXBaseEffectImpl_GetTechniqueByName,
1039 ID3DXBaseEffectImpl_GetPass,
1040 ID3DXBaseEffectImpl_GetPassByName,
1041 ID3DXBaseEffectImpl_GetFunction,
1042 ID3DXBaseEffectImpl_GetFunctionByName,
1043 ID3DXBaseEffectImpl_GetAnnotation,
1044 ID3DXBaseEffectImpl_GetAnnotationByName,
1045 ID3DXBaseEffectImpl_SetValue,
1046 ID3DXBaseEffectImpl_GetValue,
1047 ID3DXBaseEffectImpl_SetBool,
1048 ID3DXBaseEffectImpl_GetBool,
1049 ID3DXBaseEffectImpl_SetBoolArray,
1050 ID3DXBaseEffectImpl_GetBoolArray,
1051 ID3DXBaseEffectImpl_SetInt,
1052 ID3DXBaseEffectImpl_GetInt,
1053 ID3DXBaseEffectImpl_SetIntArray,
1054 ID3DXBaseEffectImpl_GetIntArray,
1055 ID3DXBaseEffectImpl_SetFloat,
1056 ID3DXBaseEffectImpl_GetFloat,
1057 ID3DXBaseEffectImpl_SetFloatArray,
1058 ID3DXBaseEffectImpl_GetFloatArray,
1059 ID3DXBaseEffectImpl_SetVector,
1060 ID3DXBaseEffectImpl_GetVector,
1061 ID3DXBaseEffectImpl_SetVectorArray,
1062 ID3DXBaseEffectImpl_GetVectorArray,
1063 ID3DXBaseEffectImpl_SetMatrix,
1064 ID3DXBaseEffectImpl_GetMatrix,
1065 ID3DXBaseEffectImpl_SetMatrixArray,
1066 ID3DXBaseEffectImpl_GetMatrixArray,
1067 ID3DXBaseEffectImpl_SetMatrixPointerArray,
1068 ID3DXBaseEffectImpl_GetMatrixPointerArray,
1069 ID3DXBaseEffectImpl_SetMatrixTranspose,
1070 ID3DXBaseEffectImpl_GetMatrixTranspose,
1071 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
1072 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
1073 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
1074 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
1075 ID3DXBaseEffectImpl_SetString,
1076 ID3DXBaseEffectImpl_GetString,
1077 ID3DXBaseEffectImpl_SetTexture,
1078 ID3DXBaseEffectImpl_GetTexture,
1079 ID3DXBaseEffectImpl_GetPixelShader,
1080 ID3DXBaseEffectImpl_GetVertexShader,
1081 ID3DXBaseEffectImpl_SetArrayRange,
1084 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
1086 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
1089 /*** IUnknown methods ***/
1090 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
1092 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1094 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
1096 if (IsEqualGUID(riid, &IID_IUnknown) ||
1097 IsEqualGUID(riid, &IID_ID3DXEffect))
1099 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
1100 *object = This;
1101 return S_OK;
1104 ERR("Interface %s not found\n", debugstr_guid(riid));
1106 return E_NOINTERFACE;
1109 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
1111 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1113 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1115 return InterlockedIncrement(&This->ref);
1118 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
1120 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1121 ULONG ref = InterlockedDecrement(&This->ref);
1123 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
1125 if (!ref)
1127 free_effect(This);
1128 HeapFree(GetProcessHeap(), 0, This);
1131 return ref;
1134 /*** ID3DXBaseEffect methods ***/
1135 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
1137 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1138 ID3DXBaseEffect *base = This->base_effect;
1140 TRACE("Forward iface %p, base %p\n", This, base);
1142 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1145 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1147 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1148 ID3DXBaseEffect *base = This->base_effect;
1150 TRACE("Forward iface %p, base %p\n", This, base);
1152 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1155 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1157 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1158 ID3DXBaseEffect *base = This->base_effect;
1160 TRACE("Forward iface %p, base %p\n", This, base);
1162 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1165 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1167 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1168 ID3DXBaseEffect *base = This->base_effect;
1170 TRACE("Forward iface %p, base %p\n", This, base);
1172 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1175 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1177 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1178 ID3DXBaseEffect *base = This->base_effect;
1180 TRACE("Forward iface %p, base %p\n", This, base);
1182 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1185 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1187 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1188 ID3DXBaseEffect *base = This->base_effect;
1190 TRACE("Forward iface %p, base %p\n", This, base);
1192 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1195 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1197 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1198 ID3DXBaseEffect *base = This->base_effect;
1200 TRACE("Forward iface %p, base %p\n", This, base);
1202 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1205 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1207 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1208 ID3DXBaseEffect *base = This->base_effect;
1210 TRACE("Forward iface %p, base %p\n", This, base);
1212 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1215 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1217 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1218 ID3DXBaseEffect *base = This->base_effect;
1220 TRACE("Forward iface %p, base %p\n", This, base);
1222 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1225 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
1227 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1228 ID3DXBaseEffect *base = This->base_effect;
1230 TRACE("Forward iface %p, base %p\n", This, base);
1232 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1235 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
1237 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1238 ID3DXBaseEffect *base = This->base_effect;
1240 TRACE("Forward iface %p, base %p\n", This, base);
1242 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1245 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
1247 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1248 ID3DXBaseEffect *base = This->base_effect;
1250 TRACE("Forward iface %p, base %p\n", This, base);
1252 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1255 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
1257 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1258 ID3DXBaseEffect *base = This->base_effect;
1260 TRACE("Forward iface %p, base %p\n", This, base);
1262 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1265 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
1267 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1268 ID3DXBaseEffect *base = This->base_effect;
1270 TRACE("Forward iface %p, base %p\n", This, base);
1272 return ID3DXBaseEffectImpl_GetFunction(base, index);
1275 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1277 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1278 ID3DXBaseEffect *base = This->base_effect;
1280 TRACE("Forward iface %p, base %p\n", This, base);
1282 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1285 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1287 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1288 ID3DXBaseEffect *base = This->base_effect;
1290 TRACE("Forward iface %p, base %p\n", This, base);
1292 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1295 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1297 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1298 ID3DXBaseEffect *base = This->base_effect;
1300 TRACE("Forward iface %p, base %p\n", This, base);
1302 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1305 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1307 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1308 ID3DXBaseEffect *base = This->base_effect;
1310 TRACE("Forward iface %p, base %p\n", This, base);
1312 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1315 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1317 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1318 ID3DXBaseEffect *base = This->base_effect;
1320 TRACE("Forward iface %p, base %p\n", This, base);
1322 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1325 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1327 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1328 ID3DXBaseEffect *base = This->base_effect;
1330 TRACE("Forward iface %p, base %p\n", This, base);
1332 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1335 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1337 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1338 ID3DXBaseEffect *base = This->base_effect;
1340 TRACE("Forward iface %p, base %p\n", This, base);
1342 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1345 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1347 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1348 ID3DXBaseEffect *base = This->base_effect;
1350 TRACE("Forward iface %p, base %p\n", This, base);
1352 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1355 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1357 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1358 ID3DXBaseEffect *base = This->base_effect;
1360 TRACE("Forward iface %p, base %p\n", This, base);
1362 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1365 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
1367 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1368 ID3DXBaseEffect *base = This->base_effect;
1370 TRACE("Forward iface %p, base %p\n", This, base);
1372 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1375 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1377 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1378 ID3DXBaseEffect *base = This->base_effect;
1380 TRACE("Forward iface %p, base %p\n", This, base);
1382 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1385 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1387 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1388 ID3DXBaseEffect *base = This->base_effect;
1390 TRACE("Forward iface %p, base %p\n", This, base);
1392 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1395 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1397 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1398 ID3DXBaseEffect *base = This->base_effect;
1400 TRACE("Forward iface %p, base %p\n", This, base);
1402 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1405 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
1407 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1408 ID3DXBaseEffect *base = This->base_effect;
1410 TRACE("Forward iface %p, base %p\n", This, base);
1412 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1415 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1417 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1418 ID3DXBaseEffect *base = This->base_effect;
1420 TRACE("Forward iface %p, base %p\n", This, base);
1422 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1425 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1427 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1428 ID3DXBaseEffect *base = This->base_effect;
1430 TRACE("Forward iface %p, base %p\n", This, base);
1432 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1435 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1437 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1438 ID3DXBaseEffect *base = This->base_effect;
1440 TRACE("Forward iface %p, base %p\n", This, base);
1442 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1445 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1447 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1448 ID3DXBaseEffect *base = This->base_effect;
1450 TRACE("Forward iface %p, base %p\n", This, base);
1452 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1455 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1457 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1458 ID3DXBaseEffect *base = This->base_effect;
1460 TRACE("Forward iface %p, base %p\n", This, base);
1462 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1465 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1467 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1468 ID3DXBaseEffect *base = This->base_effect;
1470 TRACE("Forward iface %p, base %p\n", This, base);
1472 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1475 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1477 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1478 ID3DXBaseEffect *base = This->base_effect;
1480 TRACE("Forward iface %p, base %p\n", This, base);
1482 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
1485 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1487 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1488 ID3DXBaseEffect *base = This->base_effect;
1490 TRACE("Forward iface %p, base %p\n", This, base);
1492 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
1495 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1497 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1498 ID3DXBaseEffect *base = This->base_effect;
1500 TRACE("Forward iface %p, base %p\n", This, base);
1502 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
1505 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1507 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1508 ID3DXBaseEffect *base = This->base_effect;
1510 TRACE("Forward iface %p, base %p\n", This, base);
1512 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
1515 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1517 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1518 ID3DXBaseEffect *base = This->base_effect;
1520 TRACE("Forward iface %p, base %p\n", This, base);
1522 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
1525 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1527 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1528 ID3DXBaseEffect *base = This->base_effect;
1530 TRACE("Forward iface %p, base %p\n", This, base);
1532 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
1535 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1537 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1538 ID3DXBaseEffect *base = This->base_effect;
1540 TRACE("Forward iface %p, base %p\n", This, base);
1542 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
1545 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1547 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1548 ID3DXBaseEffect *base = This->base_effect;
1550 TRACE("Forward iface %p, base %p\n", This, base);
1552 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
1555 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1557 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1558 ID3DXBaseEffect *base = This->base_effect;
1560 TRACE("Forward iface %p, base %p\n", This, base);
1562 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
1565 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1567 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1568 ID3DXBaseEffect *base = This->base_effect;
1570 TRACE("Forward iface %p, base %p\n", This, base);
1572 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
1575 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1577 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1578 ID3DXBaseEffect *base = This->base_effect;
1580 TRACE("Forward iface %p, base %p\n", This, base);
1582 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
1585 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1587 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1588 ID3DXBaseEffect *base = This->base_effect;
1590 TRACE("Forward iface %p, base %p\n", This, base);
1592 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
1595 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1597 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1598 ID3DXBaseEffect *base = This->base_effect;
1600 TRACE("Forward iface %p, base %p\n", This, base);
1602 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
1605 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1607 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1608 ID3DXBaseEffect *base = This->base_effect;
1610 TRACE("Forward iface %p, base %p\n", This, base);
1612 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
1615 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1617 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1618 ID3DXBaseEffect *base = This->base_effect;
1620 TRACE("Forward iface %p, base %p\n", This, base);
1622 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
1625 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1627 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1628 ID3DXBaseEffect *base = This->base_effect;
1630 TRACE("Forward iface %p, base %p\n", This, base);
1632 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
1635 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1637 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1638 ID3DXBaseEffect *base = This->base_effect;
1640 TRACE("Forward iface %p, base %p\n", This, base);
1642 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
1645 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1647 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1648 ID3DXBaseEffect *base = This->base_effect;
1650 TRACE("Forward iface %p, base %p\n", This, base);
1652 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
1655 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1657 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1658 ID3DXBaseEffect *base = This->base_effect;
1660 TRACE("Forward iface %p, base %p\n", This, base);
1662 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
1665 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1667 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1668 ID3DXBaseEffect *base = This->base_effect;
1670 TRACE("Forward iface %p, base %p\n", This, base);
1672 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
1675 /*** ID3DXEffect methods ***/
1676 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
1678 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1680 TRACE("iface %p, pool %p\n", This, pool);
1682 if (!pool)
1684 WARN("Invalid argument supplied.\n");
1685 return D3DERR_INVALIDCALL;
1688 if (This->pool)
1690 This->pool->lpVtbl->AddRef(This->pool);
1693 *pool = This->pool;
1695 TRACE("Returning pool %p\n", *pool);
1697 return S_OK;
1700 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1702 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1704 FIXME("(%p)->(%p): stub\n", This, technique);
1706 return E_NOTIMPL;
1709 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
1711 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1713 FIXME("(%p)->(): stub\n", This);
1715 return NULL;
1718 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1720 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1722 FIXME("(%p)->(%p): stub\n", This, technique);
1724 return D3D_OK;
1727 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
1729 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1731 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
1733 return E_NOTIMPL;
1736 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
1738 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1740 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
1742 return FALSE;
1745 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
1747 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1749 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
1751 return E_NOTIMPL;
1754 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
1756 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1758 FIXME("(%p)->(%u): stub\n", This, pass);
1760 return E_NOTIMPL;
1763 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
1765 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1767 FIXME("(%p)->(): stub\n", This);
1769 return E_NOTIMPL;
1772 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
1774 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1776 FIXME("(%p)->(): stub\n", This);
1778 return E_NOTIMPL;
1781 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
1783 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1785 FIXME("(%p)->(): stub\n", This);
1787 return E_NOTIMPL;
1790 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
1792 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1794 TRACE("iface %p, device %p\n", This, device);
1796 if (!device)
1798 WARN("Invalid argument supplied.\n");
1799 return D3DERR_INVALIDCALL;
1802 IDirect3DDevice9_AddRef(This->device);
1804 *device = This->device;
1806 TRACE("Returning device %p\n", *device);
1808 return S_OK;
1811 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
1813 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1815 FIXME("(%p)->(): stub\n", This);
1817 return E_NOTIMPL;
1820 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
1822 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1824 FIXME("(%p)->(): stub\n", This);
1826 return E_NOTIMPL;
1829 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER manager)
1831 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1833 FIXME("(%p)->(%p): stub\n", This, manager);
1835 return E_NOTIMPL;
1838 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER* manager)
1840 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1842 FIXME("(%p)->(%p): stub\n", This, manager);
1844 return E_NOTIMPL;
1847 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
1849 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1851 FIXME("(%p)->(): stub\n", This);
1853 return E_NOTIMPL;
1856 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
1858 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1860 FIXME("(%p)->(): stub\n", This);
1862 return NULL;
1865 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
1867 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1869 FIXME("(%p)->(%p): stub\n", This, parameter_block);
1871 return E_NOTIMPL;
1874 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
1876 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1878 FIXME("(%p)->(%p): stub\n", This, parameter_block);
1880 return E_NOTIMPL;
1883 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
1885 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1887 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
1889 return E_NOTIMPL;
1892 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
1894 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1896 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
1898 return E_NOTIMPL;
1901 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
1903 /*** IUnknown methods ***/
1904 ID3DXEffectImpl_QueryInterface,
1905 ID3DXEffectImpl_AddRef,
1906 ID3DXEffectImpl_Release,
1907 /*** ID3DXBaseEffect methods ***/
1908 ID3DXEffectImpl_GetDesc,
1909 ID3DXEffectImpl_GetParameterDesc,
1910 ID3DXEffectImpl_GetTechniqueDesc,
1911 ID3DXEffectImpl_GetPassDesc,
1912 ID3DXEffectImpl_GetFunctionDesc,
1913 ID3DXEffectImpl_GetParameter,
1914 ID3DXEffectImpl_GetParameterByName,
1915 ID3DXEffectImpl_GetParameterBySemantic,
1916 ID3DXEffectImpl_GetParameterElement,
1917 ID3DXEffectImpl_GetTechnique,
1918 ID3DXEffectImpl_GetTechniqueByName,
1919 ID3DXEffectImpl_GetPass,
1920 ID3DXEffectImpl_GetPassByName,
1921 ID3DXEffectImpl_GetFunction,
1922 ID3DXEffectImpl_GetFunctionByName,
1923 ID3DXEffectImpl_GetAnnotation,
1924 ID3DXEffectImpl_GetAnnotationByName,
1925 ID3DXEffectImpl_SetValue,
1926 ID3DXEffectImpl_GetValue,
1927 ID3DXEffectImpl_SetBool,
1928 ID3DXEffectImpl_GetBool,
1929 ID3DXEffectImpl_SetBoolArray,
1930 ID3DXEffectImpl_GetBoolArray,
1931 ID3DXEffectImpl_SetInt,
1932 ID3DXEffectImpl_GetInt,
1933 ID3DXEffectImpl_SetIntArray,
1934 ID3DXEffectImpl_GetIntArray,
1935 ID3DXEffectImpl_SetFloat,
1936 ID3DXEffectImpl_GetFloat,
1937 ID3DXEffectImpl_SetFloatArray,
1938 ID3DXEffectImpl_GetFloatArray,
1939 ID3DXEffectImpl_SetVector,
1940 ID3DXEffectImpl_GetVector,
1941 ID3DXEffectImpl_SetVectorArray,
1942 ID3DXEffectImpl_GetVectorArray,
1943 ID3DXEffectImpl_SetMatrix,
1944 ID3DXEffectImpl_GetMatrix,
1945 ID3DXEffectImpl_SetMatrixArray,
1946 ID3DXEffectImpl_GetMatrixArray,
1947 ID3DXEffectImpl_SetMatrixPointerArray,
1948 ID3DXEffectImpl_GetMatrixPointerArray,
1949 ID3DXEffectImpl_SetMatrixTranspose,
1950 ID3DXEffectImpl_GetMatrixTranspose,
1951 ID3DXEffectImpl_SetMatrixTransposeArray,
1952 ID3DXEffectImpl_GetMatrixTransposeArray,
1953 ID3DXEffectImpl_SetMatrixTransposePointerArray,
1954 ID3DXEffectImpl_GetMatrixTransposePointerArray,
1955 ID3DXEffectImpl_SetString,
1956 ID3DXEffectImpl_GetString,
1957 ID3DXEffectImpl_SetTexture,
1958 ID3DXEffectImpl_GetTexture,
1959 ID3DXEffectImpl_GetPixelShader,
1960 ID3DXEffectImpl_GetVertexShader,
1961 ID3DXEffectImpl_SetArrayRange,
1962 /*** ID3DXEffect methods ***/
1963 ID3DXEffectImpl_GetPool,
1964 ID3DXEffectImpl_SetTechnique,
1965 ID3DXEffectImpl_GetCurrentTechnique,
1966 ID3DXEffectImpl_ValidateTechnique,
1967 ID3DXEffectImpl_FindNextValidTechnique,
1968 ID3DXEffectImpl_IsParameterUsed,
1969 ID3DXEffectImpl_Begin,
1970 ID3DXEffectImpl_BeginPass,
1971 ID3DXEffectImpl_CommitChanges,
1972 ID3DXEffectImpl_EndPass,
1973 ID3DXEffectImpl_End,
1974 ID3DXEffectImpl_GetDevice,
1975 ID3DXEffectImpl_OnLostDevice,
1976 ID3DXEffectImpl_OnResetDevice,
1977 ID3DXEffectImpl_SetStateManager,
1978 ID3DXEffectImpl_GetStateManager,
1979 ID3DXEffectImpl_BeginParameterBlock,
1980 ID3DXEffectImpl_EndParameterBlock,
1981 ID3DXEffectImpl_ApplyParameterBlock,
1982 ID3DXEffectImpl_DeleteParameterBlock,
1983 ID3DXEffectImpl_CloneEffect,
1984 ID3DXEffectImpl_SetRawValue
1987 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
1989 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
1992 /*** IUnknown methods ***/
1993 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
1995 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
1997 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
1999 if (IsEqualGUID(riid, &IID_IUnknown) ||
2000 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
2002 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
2003 *object = This;
2004 return S_OK;
2007 ERR("Interface %s not found\n", debugstr_guid(riid));
2009 return E_NOINTERFACE;
2012 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
2014 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2016 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
2018 return InterlockedIncrement(&This->ref);
2021 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
2023 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2024 ULONG ref = InterlockedDecrement(&This->ref);
2026 TRACE("iface %p: Release from %u\n", iface, ref + 1);
2028 if (!ref)
2030 free_effect_compiler(This);
2031 HeapFree(GetProcessHeap(), 0, This);
2034 return ref;
2037 /*** ID3DXBaseEffect methods ***/
2038 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
2040 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2041 ID3DXBaseEffect *base = This->base_effect;
2043 TRACE("Forward iface %p, base %p\n", This, base);
2045 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2048 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2050 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2051 ID3DXBaseEffect *base = This->base_effect;
2053 TRACE("Forward iface %p, base %p\n", This, base);
2055 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2058 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2060 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2061 ID3DXBaseEffect *base = This->base_effect;
2063 TRACE("Forward iface %p, base %p\n", This, base);
2065 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2068 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2070 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2071 ID3DXBaseEffect *base = This->base_effect;
2073 TRACE("Forward iface %p, base %p\n", This, base);
2075 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2078 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2080 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2081 ID3DXBaseEffect *base = This->base_effect;
2083 TRACE("Forward iface %p, base %p\n", This, base);
2085 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2088 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2090 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2091 ID3DXBaseEffect *base = This->base_effect;
2093 TRACE("Forward iface %p, base %p\n", This, base);
2095 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2098 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
2100 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2101 ID3DXBaseEffect *base = This->base_effect;
2103 TRACE("Forward iface %p, base %p\n", This, base);
2105 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2108 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
2110 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2111 ID3DXBaseEffect *base = This->base_effect;
2113 TRACE("Forward iface %p, base %p\n", This, base);
2115 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2118 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2120 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2121 ID3DXBaseEffect *base = This->base_effect;
2123 TRACE("Forward iface %p, base %p\n", This, base);
2125 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2128 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
2130 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2131 ID3DXBaseEffect *base = This->base_effect;
2133 TRACE("Forward iface %p, base %p\n", This, base);
2135 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2138 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
2140 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2141 ID3DXBaseEffect *base = This->base_effect;
2143 TRACE("Forward iface %p, base %p\n", This, base);
2145 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2148 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
2150 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2151 ID3DXBaseEffect *base = This->base_effect;
2153 TRACE("Forward iface %p, base %p\n", This, base);
2155 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2158 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
2160 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2161 ID3DXBaseEffect *base = This->base_effect;
2163 TRACE("Forward iface %p, base %p\n", This, base);
2165 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2168 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
2170 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2171 ID3DXBaseEffect *base = This->base_effect;
2173 TRACE("Forward iface %p, base %p\n", This, base);
2175 return ID3DXBaseEffectImpl_GetFunction(base, index);
2178 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
2180 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2181 ID3DXBaseEffect *base = This->base_effect;
2183 TRACE("Forward iface %p, base %p\n", This, base);
2185 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2188 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
2190 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2191 ID3DXBaseEffect *base = This->base_effect;
2193 TRACE("Forward iface %p, base %p\n", This, base);
2195 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2198 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
2200 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2201 ID3DXBaseEffect *base = This->base_effect;
2203 TRACE("Forward iface %p, base %p\n", This, base);
2205 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2208 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2210 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2211 ID3DXBaseEffect *base = This->base_effect;
2213 TRACE("Forward iface %p, base %p\n", This, base);
2215 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2218 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2220 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2221 ID3DXBaseEffect *base = This->base_effect;
2223 TRACE("Forward iface %p, base %p\n", This, base);
2225 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2228 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
2230 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2231 ID3DXBaseEffect *base = This->base_effect;
2233 TRACE("Forward iface %p, base %p\n", This, base);
2235 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2238 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
2240 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2241 ID3DXBaseEffect *base = This->base_effect;
2243 TRACE("Forward iface %p, base %p\n", This, base);
2245 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2248 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2250 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2251 ID3DXBaseEffect *base = This->base_effect;
2253 TRACE("Forward iface %p, base %p\n", This, base);
2255 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2258 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2260 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2261 ID3DXBaseEffect *base = This->base_effect;
2263 TRACE("Forward iface %p, base %p\n", This, base);
2265 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2268 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
2270 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2271 ID3DXBaseEffect *base = This->base_effect;
2273 TRACE("Forward iface %p, base %p\n", This, base);
2275 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2278 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2280 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2281 ID3DXBaseEffect *base = This->base_effect;
2283 TRACE("Forward iface %p, base %p\n", This, base);
2285 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2288 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2290 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2291 ID3DXBaseEffect *base = This->base_effect;
2293 TRACE("Forward iface %p, base %p\n", This, base);
2295 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2298 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2300 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2301 ID3DXBaseEffect *base = This->base_effect;
2303 TRACE("Forward iface %p, base %p\n", This, base);
2305 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2308 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2310 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2311 ID3DXBaseEffect *base = This->base_effect;
2313 TRACE("Forward iface %p, base %p\n", This, base);
2315 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2318 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2320 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2321 ID3DXBaseEffect *base = This->base_effect;
2323 TRACE("Forward iface %p, base %p\n", This, base);
2325 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2328 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2330 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2331 ID3DXBaseEffect *base = This->base_effect;
2333 TRACE("Forward iface %p, base %p\n", This, base);
2335 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2338 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2340 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2341 ID3DXBaseEffect *base = This->base_effect;
2343 TRACE("Forward iface %p, base %p\n", This, base);
2345 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2348 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2350 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2351 ID3DXBaseEffect *base = This->base_effect;
2353 TRACE("Forward iface %p, base %p\n", This, base);
2355 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2358 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2360 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2361 ID3DXBaseEffect *base = This->base_effect;
2363 TRACE("Forward iface %p, base %p\n", This, base);
2365 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2368 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2370 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2371 ID3DXBaseEffect *base = This->base_effect;
2373 TRACE("Forward iface %p, base %p\n", This, base);
2375 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2378 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2380 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2381 ID3DXBaseEffect *base = This->base_effect;
2383 TRACE("Forward iface %p, base %p\n", This, base);
2385 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2388 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2390 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2391 ID3DXBaseEffect *base = This->base_effect;
2393 TRACE("Forward iface %p, base %p\n", This, base);
2395 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2398 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2400 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2401 ID3DXBaseEffect *base = This->base_effect;
2403 TRACE("Forward iface %p, base %p\n", This, base);
2405 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2408 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2410 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2411 ID3DXBaseEffect *base = This->base_effect;
2413 TRACE("Forward iface %p, base %p\n", This, base);
2415 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2418 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2420 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2421 ID3DXBaseEffect *base = This->base_effect;
2423 TRACE("Forward iface %p, base %p\n", This, base);
2425 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2428 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2430 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2431 ID3DXBaseEffect *base = This->base_effect;
2433 TRACE("Forward iface %p, base %p\n", This, base);
2435 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2438 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2440 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2441 ID3DXBaseEffect *base = This->base_effect;
2443 TRACE("Forward iface %p, base %p\n", This, base);
2445 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2448 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2450 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2451 ID3DXBaseEffect *base = This->base_effect;
2453 TRACE("Forward iface %p, base %p\n", This, base);
2455 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2458 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2460 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2461 ID3DXBaseEffect *base = This->base_effect;
2463 TRACE("Forward iface %p, base %p\n", This, base);
2465 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2468 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2470 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2471 ID3DXBaseEffect *base = This->base_effect;
2473 TRACE("Forward iface %p, base %p\n", This, base);
2475 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2478 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2480 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2481 ID3DXBaseEffect *base = This->base_effect;
2483 TRACE("Forward iface %p, base %p\n", This, base);
2485 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2488 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2490 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2491 ID3DXBaseEffect *base = This->base_effect;
2493 TRACE("Forward iface %p, base %p\n", This, base);
2495 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2498 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2500 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2501 ID3DXBaseEffect *base = This->base_effect;
2503 TRACE("Forward iface %p, base %p\n", This, base);
2505 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2508 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
2510 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2511 ID3DXBaseEffect *base = This->base_effect;
2513 TRACE("Forward iface %p, base %p\n", This, base);
2515 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2518 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
2520 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2521 ID3DXBaseEffect *base = This->base_effect;
2523 TRACE("Forward iface %p, base %p\n", This, base);
2525 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2528 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2530 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2531 ID3DXBaseEffect *base = This->base_effect;
2533 TRACE("Forward iface %p, base %p\n", This, base);
2535 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2538 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2540 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2541 ID3DXBaseEffect *base = This->base_effect;
2543 TRACE("Forward iface %p, base %p\n", This, base);
2545 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2548 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2550 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2551 ID3DXBaseEffect *base = This->base_effect;
2553 TRACE("Forward iface %p, base %p\n", This, base);
2555 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2558 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2560 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2561 ID3DXBaseEffect *base = This->base_effect;
2563 TRACE("Forward iface %p, base %p\n", This, base);
2565 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2568 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
2570 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2571 ID3DXBaseEffect *base = This->base_effect;
2573 TRACE("Forward iface %p, base %p\n", This, base);
2575 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2578 /*** ID3DXEffectCompiler methods ***/
2579 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
2581 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2583 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
2585 return E_NOTIMPL;
2588 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
2590 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2592 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
2594 return E_NOTIMPL;
2597 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
2598 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
2600 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2602 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
2604 return E_NOTIMPL;
2607 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
2608 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
2610 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2612 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
2613 This, function, target, flags, shader, error_msgs, constant_table);
2615 return E_NOTIMPL;
2618 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
2620 /*** IUnknown methods ***/
2621 ID3DXEffectCompilerImpl_QueryInterface,
2622 ID3DXEffectCompilerImpl_AddRef,
2623 ID3DXEffectCompilerImpl_Release,
2624 /*** ID3DXBaseEffect methods ***/
2625 ID3DXEffectCompilerImpl_GetDesc,
2626 ID3DXEffectCompilerImpl_GetParameterDesc,
2627 ID3DXEffectCompilerImpl_GetTechniqueDesc,
2628 ID3DXEffectCompilerImpl_GetPassDesc,
2629 ID3DXEffectCompilerImpl_GetFunctionDesc,
2630 ID3DXEffectCompilerImpl_GetParameter,
2631 ID3DXEffectCompilerImpl_GetParameterByName,
2632 ID3DXEffectCompilerImpl_GetParameterBySemantic,
2633 ID3DXEffectCompilerImpl_GetParameterElement,
2634 ID3DXEffectCompilerImpl_GetTechnique,
2635 ID3DXEffectCompilerImpl_GetTechniqueByName,
2636 ID3DXEffectCompilerImpl_GetPass,
2637 ID3DXEffectCompilerImpl_GetPassByName,
2638 ID3DXEffectCompilerImpl_GetFunction,
2639 ID3DXEffectCompilerImpl_GetFunctionByName,
2640 ID3DXEffectCompilerImpl_GetAnnotation,
2641 ID3DXEffectCompilerImpl_GetAnnotationByName,
2642 ID3DXEffectCompilerImpl_SetValue,
2643 ID3DXEffectCompilerImpl_GetValue,
2644 ID3DXEffectCompilerImpl_SetBool,
2645 ID3DXEffectCompilerImpl_GetBool,
2646 ID3DXEffectCompilerImpl_SetBoolArray,
2647 ID3DXEffectCompilerImpl_GetBoolArray,
2648 ID3DXEffectCompilerImpl_SetInt,
2649 ID3DXEffectCompilerImpl_GetInt,
2650 ID3DXEffectCompilerImpl_SetIntArray,
2651 ID3DXEffectCompilerImpl_GetIntArray,
2652 ID3DXEffectCompilerImpl_SetFloat,
2653 ID3DXEffectCompilerImpl_GetFloat,
2654 ID3DXEffectCompilerImpl_SetFloatArray,
2655 ID3DXEffectCompilerImpl_GetFloatArray,
2656 ID3DXEffectCompilerImpl_SetVector,
2657 ID3DXEffectCompilerImpl_GetVector,
2658 ID3DXEffectCompilerImpl_SetVectorArray,
2659 ID3DXEffectCompilerImpl_GetVectorArray,
2660 ID3DXEffectCompilerImpl_SetMatrix,
2661 ID3DXEffectCompilerImpl_GetMatrix,
2662 ID3DXEffectCompilerImpl_SetMatrixArray,
2663 ID3DXEffectCompilerImpl_GetMatrixArray,
2664 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
2665 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
2666 ID3DXEffectCompilerImpl_SetMatrixTranspose,
2667 ID3DXEffectCompilerImpl_GetMatrixTranspose,
2668 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
2669 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
2670 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
2671 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
2672 ID3DXEffectCompilerImpl_SetString,
2673 ID3DXEffectCompilerImpl_GetString,
2674 ID3DXEffectCompilerImpl_SetTexture,
2675 ID3DXEffectCompilerImpl_GetTexture,
2676 ID3DXEffectCompilerImpl_GetPixelShader,
2677 ID3DXEffectCompilerImpl_GetVertexShader,
2678 ID3DXEffectCompilerImpl_SetArrayRange,
2679 /*** ID3DXEffectCompiler methods ***/
2680 ID3DXEffectCompilerImpl_SetLiteral,
2681 ID3DXEffectCompilerImpl_GetLiteral,
2682 ID3DXEffectCompilerImpl_CompileEffect,
2683 ID3DXEffectCompilerImpl_CompileShader,
2686 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value)
2688 unsigned int i;
2689 HRESULT hr;
2690 UINT old_size = 0;
2692 if (param->element_count)
2694 param->data = value;
2696 for (i = 0; i < param->element_count; ++i)
2698 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
2700 hr = d3dx9_parse_value(member, (char *)value + old_size);
2701 if (hr != D3D_OK)
2703 WARN("Failed to parse value\n");
2704 return hr;
2707 old_size += member->bytes;
2710 return D3D_OK;
2713 switch(param->class)
2715 case D3DXPC_SCALAR:
2716 case D3DXPC_VECTOR:
2717 case D3DXPC_MATRIX_ROWS:
2718 case D3DXPC_MATRIX_COLUMNS:
2719 param->data = value;
2720 break;
2722 case D3DXPC_STRUCT:
2723 param->data = value;
2725 for (i = 0; i < param->member_count; ++i)
2727 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
2729 hr = d3dx9_parse_value(member, (char *)value + old_size);
2730 if (hr != D3D_OK)
2732 WARN("Failed to parse value\n");
2733 return hr;
2736 old_size += member->bytes;
2738 break;
2740 default:
2741 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2742 break;
2745 return D3D_OK;
2749 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
2751 UINT size = param->bytes;
2752 HRESULT hr;
2753 void *value;
2755 TRACE("param size: %u\n", size);
2757 value = HeapAlloc(GetProcessHeap(), 0, size);
2758 if (!value)
2760 ERR("Failed to allocate data memory.\n");
2761 return E_OUTOFMEMORY;
2764 TRACE("Data: %s.\n", debugstr_an(ptr, size));
2765 memcpy(value, ptr, size);
2767 hr = d3dx9_parse_value(param, value);
2768 if (hr != D3D_OK)
2770 WARN("Failed to parse value\n");
2771 HeapFree(GetProcessHeap(), 0, value);
2772 return hr;
2775 param->data = value;
2777 return D3D_OK;
2780 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
2782 DWORD size;
2784 read_dword(&ptr, &size);
2785 TRACE("Name size: %#x\n", size);
2787 if (!size)
2789 return D3D_OK;
2792 *name = HeapAlloc(GetProcessHeap(), 0, size);
2793 if (!*name)
2795 ERR("Failed to allocate name memory.\n");
2796 return E_OUTOFMEMORY;
2799 TRACE("Name: %s.\n", debugstr_an(ptr, size));
2800 memcpy(*name, ptr, size);
2802 return D3D_OK;
2805 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr, struct d3dx_parameter *parent)
2807 DWORD offset;
2808 HRESULT hr;
2809 D3DXHANDLE *member_handles = NULL;
2810 UINT i;
2812 if (!parent)
2814 read_dword(ptr, &param->type);
2815 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
2817 read_dword(ptr, &param->class);
2818 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
2820 read_dword(ptr, &offset);
2821 TRACE("Type name offset: %#x\n", offset);
2822 hr = d3dx9_parse_name(&param->name, data + offset);
2823 if (hr != D3D_OK)
2825 WARN("Failed to parse name\n");
2826 goto err_out;
2829 read_dword(ptr, &offset);
2830 TRACE("Type semantic offset: %#x\n", offset);
2831 hr = d3dx9_parse_name(&param->semantic, data + offset);
2832 if (hr != D3D_OK)
2834 WARN("Failed to parse semantic\n");
2835 goto err_out;
2838 read_dword(ptr, &param->element_count);
2839 TRACE("Elements: %u\n", param->element_count);
2841 switch (param->class)
2843 case D3DXPC_VECTOR:
2844 read_dword(ptr, &param->columns);
2845 TRACE("Columns: %u\n", param->columns);
2847 read_dword(ptr, &param->rows);
2848 TRACE("Rows: %u\n", param->rows);
2850 /* sizeof(DWORD) * rows * columns */
2851 param->bytes = 4 * param->rows * param->columns;
2852 break;
2854 case D3DXPC_SCALAR:
2855 case D3DXPC_MATRIX_ROWS:
2856 case D3DXPC_MATRIX_COLUMNS:
2857 read_dword(ptr, &param->rows);
2858 TRACE("Rows: %u\n", param->rows);
2860 read_dword(ptr, &param->columns);
2861 TRACE("Columns: %u\n", param->columns);
2863 /* sizeof(DWORD) * rows * columns */
2864 param->bytes = 4 * param->rows * param->columns;
2865 break;
2867 case D3DXPC_STRUCT:
2868 read_dword(ptr, &param->member_count);
2869 TRACE("Members: %u\n", param->member_count);
2870 break;
2872 default:
2873 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2874 break;
2877 else
2879 /* elements */
2880 param->type = parent->type;
2881 param->class = parent->class;
2882 param->name = parent->name;
2883 param->semantic = parent->semantic;
2884 param->element_count = 0;
2885 param->annotation_count = 0;
2886 param->member_count = parent->member_count;
2887 param->bytes = parent->bytes;
2888 param->flags = parent->flags;
2889 param->rows = parent->rows;
2890 param->columns = parent->columns;
2893 if (param->element_count)
2895 unsigned int param_bytes = 0;
2896 const char *save_ptr = *ptr;
2898 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
2899 if (!member_handles)
2901 ERR("Out of memory\n");
2902 hr = E_OUTOFMEMORY;
2903 goto err_out;
2906 for (i = 0; i < param->element_count; ++i)
2908 struct d3dx_parameter *member;
2909 *ptr = save_ptr;
2911 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
2912 if (!member)
2914 ERR("Out of memory\n");
2915 hr = E_OUTOFMEMORY;
2916 goto err_out;
2919 member_handles[i] = get_parameter_handle(member);
2920 member->base = param->base;
2922 hr = d3dx9_parse_effect_typedef(member, data, ptr, param);
2923 if (hr != D3D_OK)
2925 WARN("Failed to parse member\n");
2926 goto err_out;
2929 param_bytes += member->bytes;
2932 param->bytes = param_bytes;
2934 else if (param->member_count)
2936 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
2937 if (!member_handles)
2939 ERR("Out of memory\n");
2940 hr = E_OUTOFMEMORY;
2941 goto err_out;
2944 for (i = 0; i < param->member_count; ++i)
2946 struct d3dx_parameter *member;
2948 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
2949 if (!member)
2951 ERR("Out of memory\n");
2952 hr = E_OUTOFMEMORY;
2953 goto err_out;
2956 member_handles[i] = get_parameter_handle(member);
2957 member->base = param->base;
2959 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL);
2960 if (hr != D3D_OK)
2962 WARN("Failed to parse member\n");
2963 goto err_out;
2966 param->bytes += member->bytes;
2970 param->member_handles = member_handles;
2972 return D3D_OK;
2974 err_out:
2976 if (member_handles)
2978 unsigned int count;
2980 if (param->element_count) count = param->element_count;
2981 else count = param->member_count;
2983 for (i = 0; i < count; ++i)
2985 free_parameter(member_handles[i], param->element_count != 0, TRUE);
2987 HeapFree(GetProcessHeap(), 0, member_handles);
2990 if (!parent)
2992 HeapFree(GetProcessHeap(), 0, param->name);
2993 HeapFree(GetProcessHeap(), 0, param->semantic);
2995 param->name = NULL;
2996 param->semantic = NULL;
2998 return hr;
3001 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
3003 DWORD offset;
3004 const char *ptr2;
3005 HRESULT hr;
3007 anno->flags = D3DX_PARAMETER_ANNOTATION;
3009 read_dword(ptr, &offset);
3010 TRACE("Typedef offset: %#x\n", offset);
3011 ptr2 = data + offset;
3012 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL);
3013 if (hr != D3D_OK)
3015 WARN("Failed to parse type definition\n");
3016 return hr;
3019 read_dword(ptr, &offset);
3020 TRACE("Value offset: %#x\n", offset);
3021 hr = d3dx9_parse_init_value(anno, data + offset);
3022 if (hr != D3D_OK)
3024 WARN("Failed to parse value\n");
3025 return hr;
3028 return D3D_OK;
3031 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
3033 DWORD offset;
3034 HRESULT hr;
3035 unsigned int i;
3036 D3DXHANDLE *annotation_handles = NULL;
3037 const char *ptr2;
3039 read_dword(ptr, &offset);
3040 TRACE("Typedef offset: %#x\n", offset);
3041 ptr2 = data + offset;
3043 read_dword(ptr, &offset);
3044 TRACE("Value offset: %#x\n", offset);
3046 read_dword(ptr, &param->flags);
3047 TRACE("Flags: %#x\n", param->flags);
3049 read_dword(ptr, &param->annotation_count);
3050 TRACE("Annotation count: %u\n", param->annotation_count);
3052 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL);
3053 if (hr != D3D_OK)
3055 WARN("Failed to parse type definition\n");
3056 return hr;
3059 hr = d3dx9_parse_init_value(param, data + offset);
3060 if (hr != D3D_OK)
3062 WARN("Failed to parse value\n");
3063 return hr;
3066 if (param->annotation_count)
3068 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
3069 if (!annotation_handles)
3071 ERR("Out of memory\n");
3072 hr = E_OUTOFMEMORY;
3073 goto err_out;
3076 for (i = 0; i < param->annotation_count; ++i)
3078 struct d3dx_parameter *annotation;
3080 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3081 if (!annotation)
3083 ERR("Out of memory\n");
3084 hr = E_OUTOFMEMORY;
3085 goto err_out;
3088 annotation_handles[i] = get_parameter_handle(annotation);
3089 annotation->base = param->base;
3091 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3092 if (hr != D3D_OK)
3094 WARN("Failed to parse annotation\n");
3095 goto err_out;
3100 param->annotation_handles = annotation_handles;
3102 return D3D_OK;
3104 err_out:
3106 if (annotation_handles)
3108 for (i = 0; i < param->annotation_count; ++i)
3110 free_parameter(annotation_handles[i], FALSE, FALSE);
3112 HeapFree(GetProcessHeap(), 0, annotation_handles);
3115 return hr;
3118 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr)
3120 DWORD offset;
3121 HRESULT hr;
3122 unsigned int i;
3123 D3DXHANDLE *annotation_handles = NULL;
3124 char *name = NULL;
3126 read_dword(ptr, &offset);
3127 TRACE("Pass name offset: %#x\n", offset);
3128 hr = d3dx9_parse_name(&name, data + offset);
3129 if (hr != D3D_OK)
3131 WARN("Failed to parse name\n");
3132 goto err_out;
3135 read_dword(ptr, &pass->annotation_count);
3136 TRACE("Annotation count: %u\n", pass->annotation_count);
3138 read_dword(ptr, &pass->state_count);
3139 TRACE("State count: %u\n", pass->state_count);
3141 if (pass->annotation_count)
3143 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
3144 if (!annotation_handles)
3146 ERR("Out of memory\n");
3147 hr = E_OUTOFMEMORY;
3148 goto err_out;
3151 for (i = 0; i < pass->annotation_count; ++i)
3153 struct d3dx_parameter *annotation;
3155 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3156 if (!annotation)
3158 ERR("Out of memory\n");
3159 hr = E_OUTOFMEMORY;
3160 goto err_out;
3163 annotation_handles[i] = get_parameter_handle(annotation);
3164 annotation->base = pass->base;
3166 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3167 if (hr != D3D_OK)
3169 WARN("Failed to parse annotations\n");
3170 goto err_out;
3175 if (pass->state_count)
3177 for (i = 0; i < pass->state_count; ++i)
3179 skip_dword_unknown(ptr, 4);
3183 pass->name = name;
3184 pass->annotation_handles = annotation_handles;
3186 return D3D_OK;
3188 err_out:
3190 if (annotation_handles)
3192 for (i = 0; i < pass->annotation_count; ++i)
3194 free_parameter(annotation_handles[i], FALSE, FALSE);
3196 HeapFree(GetProcessHeap(), 0, annotation_handles);
3199 HeapFree(GetProcessHeap(), 0, name);
3201 return hr;
3204 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr)
3206 DWORD offset;
3207 HRESULT hr;
3208 unsigned int i;
3209 D3DXHANDLE *annotation_handles = NULL;
3210 D3DXHANDLE *pass_handles = NULL;
3211 char *name = NULL;
3213 read_dword(ptr, &offset);
3214 TRACE("Technique name offset: %#x\n", offset);
3215 hr = d3dx9_parse_name(&name, data + offset);
3216 if (hr != D3D_OK)
3218 WARN("Failed to parse name\n");
3219 goto err_out;
3222 read_dword(ptr, &technique->annotation_count);
3223 TRACE("Annotation count: %u\n", technique->annotation_count);
3225 read_dword(ptr, &technique->pass_count);
3226 TRACE("Pass count: %u\n", technique->pass_count);
3228 if (technique->annotation_count)
3230 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
3231 if (!annotation_handles)
3233 ERR("Out of memory\n");
3234 hr = E_OUTOFMEMORY;
3235 goto err_out;
3238 for (i = 0; i < technique->annotation_count; ++i)
3240 struct d3dx_parameter *annotation;
3242 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3243 if (!annotation)
3245 ERR("Out of memory\n");
3246 hr = E_OUTOFMEMORY;
3247 goto err_out;
3250 annotation_handles[i] = get_parameter_handle(annotation);
3251 annotation->base = technique->base;
3253 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3254 if (hr != D3D_OK)
3256 WARN("Failed to parse annotations\n");
3257 goto err_out;
3262 if (technique->pass_count)
3264 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
3265 if (!pass_handles)
3267 ERR("Out of memory\n");
3268 hr = E_OUTOFMEMORY;
3269 goto err_out;
3272 for (i = 0; i < technique->pass_count; ++i)
3274 struct d3dx_pass *pass;
3276 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
3277 if (!pass)
3279 ERR("Out of memory\n");
3280 hr = E_OUTOFMEMORY;
3281 goto err_out;
3284 pass_handles[i] = get_pass_handle(pass);
3285 pass->base = technique->base;
3287 hr = d3dx9_parse_effect_pass(pass, data, ptr);
3288 if (hr != D3D_OK)
3290 WARN("Failed to parse passes\n");
3291 goto err_out;
3296 technique->name = name;
3297 technique->pass_handles = pass_handles;
3298 technique->annotation_handles = annotation_handles;
3300 return D3D_OK;
3302 err_out:
3304 if (pass_handles)
3306 for (i = 0; i < technique->pass_count; ++i)
3308 free_pass(pass_handles[i]);
3310 HeapFree(GetProcessHeap(), 0, pass_handles);
3313 if (annotation_handles)
3315 for (i = 0; i < technique->annotation_count; ++i)
3317 free_parameter(annotation_handles[i], FALSE, FALSE);
3319 HeapFree(GetProcessHeap(), 0, annotation_handles);
3322 HeapFree(GetProcessHeap(), 0, name);
3324 return hr;
3327 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
3329 const char *ptr = data + start;
3330 D3DXHANDLE *parameter_handles = NULL;
3331 D3DXHANDLE *technique_handles = NULL;
3332 HRESULT hr;
3333 unsigned int i;
3335 read_dword(&ptr, &base->parameter_count);
3336 TRACE("Parameter count: %u\n", base->parameter_count);
3338 read_dword(&ptr, &base->technique_count);
3339 TRACE("Technique count: %u\n", base->technique_count);
3341 skip_dword_unknown(&ptr, 2);
3343 if (base->parameter_count)
3345 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
3346 if (!parameter_handles)
3348 ERR("Out of memory\n");
3349 hr = E_OUTOFMEMORY;
3350 goto err_out;
3353 for (i = 0; i < base->parameter_count; ++i)
3355 struct d3dx_parameter *parameter;
3357 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
3358 if (!parameter)
3360 ERR("Out of memory\n");
3361 hr = E_OUTOFMEMORY;
3362 goto err_out;
3365 parameter_handles[i] = get_parameter_handle(parameter);
3366 parameter->base = base;
3368 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
3369 if (hr != D3D_OK)
3371 WARN("Failed to parse parameter\n");
3372 goto err_out;
3377 if (base->technique_count)
3379 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
3380 if (!technique_handles)
3382 ERR("Out of memory\n");
3383 hr = E_OUTOFMEMORY;
3384 goto err_out;
3387 for (i = 0; i < base->technique_count; ++i)
3389 struct d3dx_technique *technique;
3391 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
3392 if (!technique)
3394 ERR("Out of memory\n");
3395 hr = E_OUTOFMEMORY;
3396 goto err_out;
3399 technique_handles[i] = get_technique_handle(technique);
3400 technique->base = base;
3402 hr = d3dx9_parse_effect_technique(technique, data, &ptr);
3403 if (hr != D3D_OK)
3405 WARN("Failed to parse technique\n");
3406 goto err_out;
3411 base->technique_handles = technique_handles;
3412 base->parameter_handles = parameter_handles;
3414 return D3D_OK;
3416 err_out:
3418 if (technique_handles)
3420 for (i = 0; i < base->technique_count; ++i)
3422 free_technique(technique_handles[i]);
3424 HeapFree(GetProcessHeap(), 0, technique_handles);
3427 if (parameter_handles)
3429 for (i = 0; i < base->parameter_count; ++i)
3431 free_parameter(parameter_handles[i], FALSE, FALSE);
3433 HeapFree(GetProcessHeap(), 0, parameter_handles);
3436 return hr;
3439 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
3440 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
3442 DWORD tag, offset;
3443 const char *ptr = data;
3444 HRESULT hr;
3446 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
3448 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
3449 base->ref = 1;
3450 base->effect = effect;
3452 read_dword(&ptr, &tag);
3453 TRACE("Tag: %x\n", tag);
3455 if (tag != d3dx9_effect_version(9, 1))
3457 /* todo: compile hlsl ascii code */
3458 FIXME("HLSL ascii effects not supported, yet\n");
3460 /* Show the start of the shader for debugging info. */
3461 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
3463 else
3465 read_dword(&ptr, &offset);
3466 TRACE("Offset: %x\n", offset);
3468 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
3469 if (hr != D3D_OK)
3471 FIXME("Failed to parse effect.\n");
3472 return hr;
3476 return D3D_OK;
3479 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
3480 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
3482 HRESULT hr;
3483 struct ID3DXBaseEffectImpl *object = NULL;
3485 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
3487 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
3488 effect->ref = 1;
3490 if (pool) pool->lpVtbl->AddRef(pool);
3491 effect->pool = pool;
3493 IDirect3DDevice9_AddRef(device);
3494 effect->device = device;
3496 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3497 if (!object)
3499 ERR("Out of memory\n");
3500 hr = E_OUTOFMEMORY;
3501 goto err_out;
3504 hr = d3dx9_base_effect_init(object, data, data_size, effect);
3505 if (hr != D3D_OK)
3507 FIXME("Failed to parse effect.\n");
3508 goto err_out;
3511 effect->base_effect = &object->ID3DXBaseEffect_iface;
3513 return D3D_OK;
3515 err_out:
3517 HeapFree(GetProcessHeap(), 0, object);
3518 free_effect(effect);
3520 return hr;
3523 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
3524 LPCVOID srcdata,
3525 UINT srcdatalen,
3526 CONST D3DXMACRO* defines,
3527 LPD3DXINCLUDE include,
3528 LPCSTR skip_constants,
3529 DWORD flags,
3530 LPD3DXEFFECTPOOL pool,
3531 LPD3DXEFFECT* effect,
3532 LPD3DXBUFFER* compilation_errors)
3534 struct ID3DXEffectImpl *object;
3535 HRESULT hr;
3537 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
3538 skip_constants, flags, pool, effect, compilation_errors);
3540 if (!device || !srcdata)
3541 return D3DERR_INVALIDCALL;
3543 if (!srcdatalen)
3544 return E_FAIL;
3546 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
3547 if (!effect)
3548 return D3D_OK;
3550 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3551 if (!object)
3553 ERR("Out of memory\n");
3554 return E_OUTOFMEMORY;
3557 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
3558 if (FAILED(hr))
3560 WARN("Failed to initialize shader reflection\n");
3561 HeapFree(GetProcessHeap(), 0, object);
3562 return hr;
3565 *effect = &object->ID3DXEffect_iface;
3567 TRACE("Created ID3DXEffect %p\n", object);
3569 return D3D_OK;
3572 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
3573 LPCVOID srcdata,
3574 UINT srcdatalen,
3575 CONST D3DXMACRO* defines,
3576 LPD3DXINCLUDE include,
3577 DWORD flags,
3578 LPD3DXEFFECTPOOL pool,
3579 LPD3DXEFFECT* effect,
3580 LPD3DXBUFFER* compilation_errors)
3582 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
3583 include, flags, pool, effect, compilation_errors);
3585 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
3588 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
3590 HRESULT hr;
3591 struct ID3DXBaseEffectImpl *object = NULL;
3593 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
3595 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
3596 compiler->ref = 1;
3598 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3599 if (!object)
3601 ERR("Out of memory\n");
3602 hr = E_OUTOFMEMORY;
3603 goto err_out;
3606 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
3607 if (hr != D3D_OK)
3609 FIXME("Failed to parse effect.\n");
3610 goto err_out;
3613 compiler->base_effect = &object->ID3DXBaseEffect_iface;
3615 return D3D_OK;
3617 err_out:
3619 HeapFree(GetProcessHeap(), 0, object);
3620 free_effect_compiler(compiler);
3622 return hr;
3625 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
3626 UINT srcdatalen,
3627 CONST D3DXMACRO *defines,
3628 LPD3DXINCLUDE include,
3629 DWORD flags,
3630 LPD3DXEFFECTCOMPILER *compiler,
3631 LPD3DXBUFFER *parse_errors)
3633 struct ID3DXEffectCompilerImpl *object;
3634 HRESULT hr;
3636 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
3637 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
3639 if (!srcdata || !compiler)
3641 WARN("Invalid arguments supplied\n");
3642 return D3DERR_INVALIDCALL;
3645 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3646 if (!object)
3648 ERR("Out of memory\n");
3649 return E_OUTOFMEMORY;
3652 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
3653 if (FAILED(hr))
3655 WARN("Failed to initialize effect compiler\n");
3656 HeapFree(GetProcessHeap(), 0, object);
3657 return hr;
3660 *compiler = &object->ID3DXEffectCompiler_iface;
3662 TRACE("Created ID3DXEffectCompiler %p\n", object);
3664 return D3D_OK;
3667 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
3669 struct ID3DXEffectPoolImpl
3671 ID3DXEffectPool ID3DXEffectPool_iface;
3672 LONG ref;
3675 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
3677 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
3680 /*** IUnknown methods ***/
3681 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
3683 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3685 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
3687 if (IsEqualGUID(riid, &IID_IUnknown) ||
3688 IsEqualGUID(riid, &IID_ID3DXEffectPool))
3690 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
3691 *object = This;
3692 return S_OK;
3695 WARN("Interface %s not found\n", debugstr_guid(riid));
3697 return E_NOINTERFACE;
3700 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
3702 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3704 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
3706 return InterlockedIncrement(&This->ref);
3709 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
3711 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3712 ULONG ref = InterlockedDecrement(&This->ref);
3714 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
3716 if (!ref)
3717 HeapFree(GetProcessHeap(), 0, This);
3719 return ref;
3722 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
3724 /*** IUnknown methods ***/
3725 ID3DXEffectPoolImpl_QueryInterface,
3726 ID3DXEffectPoolImpl_AddRef,
3727 ID3DXEffectPoolImpl_Release
3730 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
3732 struct ID3DXEffectPoolImpl *object;
3734 TRACE("(%p)\n", pool);
3736 if (!pool)
3737 return D3DERR_INVALIDCALL;
3739 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3740 if (!object)
3742 ERR("Out of memory\n");
3743 return E_OUTOFMEMORY;
3746 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
3747 object->ref = 1;
3749 *pool = &object->ID3DXEffectPool_iface;
3751 return S_OK;
3754 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
3755 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3756 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3758 LPVOID buffer;
3759 HRESULT ret;
3760 DWORD size;
3762 TRACE("(%s): relay\n", debugstr_w(srcfile));
3764 if (!device || !srcfile || !defines)
3765 return D3DERR_INVALIDCALL;
3767 ret = map_view_of_file(srcfile, &buffer, &size);
3769 if (FAILED(ret))
3770 return D3DXERR_INVALIDDATA;
3772 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3773 UnmapViewOfFile(buffer);
3775 return ret;
3778 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
3779 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3780 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3782 LPWSTR srcfileW;
3783 HRESULT ret;
3784 DWORD len;
3786 TRACE("(void): relay\n");
3788 if (!srcfile || !defines)
3789 return D3DERR_INVALIDCALL;
3791 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
3792 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
3793 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
3795 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3796 HeapFree(GetProcessHeap(), 0, srcfileW);
3798 return ret;
3801 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
3802 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3803 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3805 TRACE("(void): relay\n");
3806 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
3809 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
3810 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3811 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3813 TRACE("(void): relay\n");
3814 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
3817 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
3818 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3819 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3821 HRSRC resinfo;
3823 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
3825 if (!device || !defines)
3826 return D3DERR_INVALIDCALL;
3828 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
3830 if (resinfo)
3832 LPVOID buffer;
3833 HRESULT ret;
3834 DWORD size;
3836 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3838 if (FAILED(ret))
3839 return D3DXERR_INVALIDDATA;
3841 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3844 return D3DXERR_INVALIDDATA;
3847 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
3848 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
3849 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3851 HRSRC resinfo;
3853 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
3855 if (!device || !defines)
3856 return D3DERR_INVALIDCALL;
3858 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
3860 if (resinfo)
3862 LPVOID buffer;
3863 HRESULT ret;
3864 DWORD size;
3866 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3868 if (FAILED(ret))
3869 return D3DXERR_INVALIDDATA;
3871 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
3874 return D3DXERR_INVALIDDATA;
3877 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
3878 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3879 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3881 TRACE("(void): relay\n");
3882 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
3885 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
3886 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
3887 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
3889 TRACE("(void): relay\n");
3890 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
3893 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
3894 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3896 LPVOID buffer;
3897 HRESULT ret;
3898 DWORD size;
3900 TRACE("(%s): relay\n", debugstr_w(srcfile));
3902 if (!srcfile || !defines)
3903 return D3DERR_INVALIDCALL;
3905 ret = map_view_of_file(srcfile, &buffer, &size);
3907 if (FAILED(ret))
3908 return D3DXERR_INVALIDDATA;
3910 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
3911 UnmapViewOfFile(buffer);
3913 return ret;
3916 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
3917 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3919 LPWSTR srcfileW;
3920 HRESULT ret;
3921 DWORD len;
3923 TRACE("(void): relay\n");
3925 if (!srcfile || !defines)
3926 return D3DERR_INVALIDCALL;
3928 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
3929 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
3930 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
3932 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
3933 HeapFree(GetProcessHeap(), 0, srcfileW);
3935 return ret;
3938 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
3939 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3941 HRSRC resinfo;
3943 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
3945 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
3947 if (resinfo)
3949 LPVOID buffer;
3950 HRESULT ret;
3951 DWORD size;
3953 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3955 if (FAILED(ret))
3956 return D3DXERR_INVALIDDATA;
3958 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
3961 return D3DXERR_INVALIDDATA;
3964 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
3965 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
3967 HRSRC resinfo;
3969 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
3971 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
3973 if (resinfo)
3975 LPVOID buffer;
3976 HRESULT ret;
3977 DWORD size;
3979 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
3981 if (FAILED(ret))
3982 return D3DXERR_INVALIDDATA;
3984 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
3987 return D3DXERR_INVALIDDATA;