d3dx9: Implement ID3DXBaseEffect::GetParameterDesc().
[wine.git] / dlls / d3dx9_36 / effect.c
blob07ebd1f6e6f1e79caf5428d72c348a003e7352f0
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_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
176 unsigned int i, k;
178 for (i = 0; i < base->technique_count; ++i)
180 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
182 for (k = 0; k < technique->pass_count; ++k)
184 if (technique->pass_handles[k] == pass)
186 return get_pass_struct(pass);
191 return NULL;
194 struct d3dx_parameter *is_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter)
196 unsigned int i, count;
197 struct d3dx_parameter *p;
199 for (i = 0; i < param->annotation_count; ++i)
201 if (param->annotation_handles[i] == parameter)
203 return get_parameter_struct(parameter);
206 p = is_valid_sub_parameter(get_parameter_struct(param->annotation_handles[i]), parameter);
207 if (p) return p;
210 if (param->element_count) count = param->element_count;
211 else count = param->member_count;
213 for (i = 0; i < count; ++i)
215 if (param->member_handles[i] == parameter)
217 return get_parameter_struct(parameter);
220 p = is_valid_sub_parameter(get_parameter_struct(param->member_handles[i]), parameter);
221 if (p) return p;
224 return NULL;
227 struct d3dx_parameter *is_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
229 unsigned int i, k, m;
230 struct d3dx_parameter *p;
232 for (i = 0; i < base->parameter_count; ++i)
234 if (base->parameter_handles[i] == parameter)
236 return get_parameter_struct(parameter);
239 p = is_valid_sub_parameter(get_parameter_struct(base->parameter_handles[i]), parameter);
240 if (p) return p;
243 for (i = 0; i < base->technique_count; ++i)
245 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
247 for (k = 0; k < technique->pass_count; ++k)
249 struct d3dx_pass *pass = get_pass_struct(technique->pass_handles[k]);
251 for (m = 0; m < pass->annotation_count; ++m)
253 if (pass->annotation_handles[i] == parameter)
255 return get_parameter_struct(parameter);
258 p = is_valid_sub_parameter(get_parameter_struct(pass->annotation_handles[m]), parameter);
259 if (p) return p;
263 for (k = 0; k < technique->annotation_count; ++k)
265 if (technique->annotation_handles[k] == parameter)
267 return get_parameter_struct(parameter);
270 p = is_valid_sub_parameter(get_parameter_struct(technique->annotation_handles[k]), parameter);
271 if (p) return p;
275 return NULL;
278 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
280 unsigned int i;
281 struct d3dx_parameter *param = get_parameter_struct(handle);
283 TRACE("Free parameter %p, child %s\n", param, child ? "yes" : "no");
285 if (!param)
287 return;
290 if (!child)
292 HeapFree(GetProcessHeap(), 0, param->data);
295 if (param->annotation_handles)
297 for (i = 0; i < param->annotation_count; ++i)
299 free_parameter(param->annotation_handles[i], FALSE, FALSE);
301 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
304 if (param->member_handles)
306 unsigned int count;
308 if (param->element_count) count = param->element_count;
309 else count = param->member_count;
311 for (i = 0; i < count; ++i)
313 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
315 HeapFree(GetProcessHeap(), 0, param->member_handles);
318 /* only the parent has to release name and semantic */
319 if (!element)
321 HeapFree(GetProcessHeap(), 0, param->name);
322 HeapFree(GetProcessHeap(), 0, param->semantic);
325 HeapFree(GetProcessHeap(), 0, param);
328 static void free_pass(D3DXHANDLE handle)
330 unsigned int i;
331 struct d3dx_pass *pass = get_pass_struct(handle);
333 TRACE("Free pass %p\n", pass);
335 if (!pass)
337 return;
340 if (pass->annotation_handles)
342 for (i = 0; i < pass->annotation_count; ++i)
344 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
346 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
349 HeapFree(GetProcessHeap(), 0, pass->name);
350 HeapFree(GetProcessHeap(), 0, pass);
353 static void free_technique(D3DXHANDLE handle)
355 unsigned int i;
356 struct d3dx_technique *technique = get_technique_struct(handle);
358 TRACE("Free technique %p\n", technique);
360 if (!technique)
362 return;
365 if (technique->annotation_handles)
367 for (i = 0; i < technique->annotation_count; ++i)
369 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
371 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
374 if (technique->pass_handles)
376 for (i = 0; i < technique->pass_count; ++i)
378 free_pass(technique->pass_handles[i]);
380 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
383 HeapFree(GetProcessHeap(), 0, technique->name);
384 HeapFree(GetProcessHeap(), 0, technique);
387 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
389 unsigned int i;
391 TRACE("Free base effect %p\n", base);
393 if (base->parameter_handles)
395 for (i = 0; i < base->parameter_count; ++i)
397 free_parameter(base->parameter_handles[i], FALSE, FALSE);
399 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
402 if (base->technique_handles)
404 for (i = 0; i < base->technique_count; ++i)
406 free_technique(base->technique_handles[i]);
408 HeapFree(GetProcessHeap(), 0, base->technique_handles);
412 static void free_effect(struct ID3DXEffectImpl *effect)
414 TRACE("Free effect %p\n", effect);
416 if (effect->base_effect)
418 effect->base_effect->lpVtbl->Release(effect->base_effect);
421 if (effect->pool)
423 effect->pool->lpVtbl->Release(effect->pool);
426 IDirect3DDevice9_Release(effect->device);
429 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
431 TRACE("Free effect compiler %p\n", compiler);
433 if (compiler->base_effect)
435 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
439 static LPSTR get_partial_string(LPCSTR name, char initial, char final)
441 UINT length;
442 LPCSTR begin;
443 LPSTR part;
445 TRACE("name %s, initial %c, final %c\n", debugstr_a(name), initial, final);
447 begin = initial ? (strchr(name, initial) + 1) : name;
448 length = strchr(name, final) - begin;
449 if (length < 1)
451 WARN("Invalied argument specified.\n");
452 return NULL;
455 part = HeapAlloc(GetProcessHeap(), 0, length + 1);
456 if (!part)
458 ERR("Out of memory\n");
459 return NULL;
461 memcpy(part, begin, length);
462 part[length] = 0;
464 TRACE("part %s\n", debugstr_a(part));
465 return part;
468 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base, struct d3dx_parameter *parameter, LPCSTR name, BOOL is_annotation)
470 unsigned int i;
471 struct d3dx_parameter *temp_parameter;
472 LPSTR part;
474 TRACE("base %p, parameter %p, name %s, is_annotation %s\n", base, parameter, debugstr_a(name), is_annotation ? "YES" : "NO");
476 if (!name) return NULL;
478 /* members */
479 if (strchr(name, '.'))
481 part = get_partial_string(name, 0, '.');
482 temp_parameter = get_parameter_by_name(base, parameter, part, is_annotation);
483 HeapFree(GetProcessHeap(), 0, part);
485 if (temp_parameter)
487 temp_parameter = get_parameter_by_name(base, temp_parameter, strchr(name, '.') + 1, FALSE);
488 TRACE("Returning sub parameter %p\n", temp_parameter);
489 return temp_parameter;
492 TRACE("Sub parameter not found\n");
493 return NULL;
496 /* annotations */
497 if (strchr(name, '@'))
499 part = get_partial_string(name, 0, '@');
500 temp_parameter = get_parameter_by_name(base, parameter, part, is_annotation);
501 HeapFree(GetProcessHeap(), 0, part);
503 if (temp_parameter)
505 temp_parameter = get_parameter_by_name(base, temp_parameter, strchr(name, '@') + 1, TRUE);
506 TRACE("Returning sub parameter %p\n", temp_parameter);
507 return temp_parameter;
510 TRACE("Sub parameter not found\n");
511 return NULL;
514 /* elements */
515 if (strchr(name, '['))
517 part = get_partial_string(name, 0, '[');
518 temp_parameter = get_parameter_by_name(base, parameter, part, is_annotation);
519 HeapFree(GetProcessHeap(), 0, part);
521 if (temp_parameter)
523 unsigned int index;
525 part = get_partial_string(name, '[', ']');
526 index = atoi(part);
527 HeapFree(GetProcessHeap(), 0, part);
529 if (index < temp_parameter->element_count)
531 TRACE("Returning sub parameter %p\n", get_parameter_struct(temp_parameter->member_handles[index]));
532 return get_parameter_struct(temp_parameter->member_handles[index]);
536 TRACE("Sub parameter not found\n");
537 return NULL;
540 if (!parameter)
542 for (i=0; i < base->parameter_count; i++)
544 temp_parameter = get_parameter_struct(base->parameter_handles[i]);
546 if (!strcmp(temp_parameter->name, name))
548 TRACE("Returning parameter %p\n", temp_parameter);
549 return temp_parameter;
553 else
555 if (is_annotation)
557 for (i = 0; i < parameter->annotation_count; i++)
559 temp_parameter = get_parameter_struct(parameter->annotation_handles[i]);
561 if (!strcmp(temp_parameter->name, name))
563 TRACE("Returning parameter %p\n", temp_parameter);
564 return temp_parameter;
568 else
570 unsigned int count;
572 if (parameter->element_count) count = parameter->element_count;
573 else count = parameter->member_count;
575 for (i = 0; i < count; i++)
577 temp_parameter = get_parameter_struct(parameter->member_handles[i]);
579 if (!strcmp(temp_parameter->name, name))
581 TRACE("Returning parameter %p\n", temp_parameter);
582 return temp_parameter;
588 TRACE("Parameter not found\n");
589 return NULL;
592 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
594 return (0xfeff0000 | ((major) << 8) | (minor));
597 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
599 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
602 /*** IUnknown methods ***/
603 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
605 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
607 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
609 if (IsEqualGUID(riid, &IID_IUnknown) ||
610 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
612 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
613 *object = This;
614 return S_OK;
617 ERR("Interface %s not found\n", debugstr_guid(riid));
619 return E_NOINTERFACE;
622 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
624 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
626 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
628 return InterlockedIncrement(&This->ref);
631 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
633 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
634 ULONG ref = InterlockedDecrement(&This->ref);
636 TRACE("iface %p: Release from %u\n", iface, ref + 1);
638 if (!ref)
640 free_base_effect(This);
641 HeapFree(GetProcessHeap(), 0, This);
644 return ref;
647 /*** ID3DXBaseEffect methods ***/
648 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
650 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
652 FIXME("iface %p, desc %p stub\n", This, desc);
654 return E_NOTIMPL;
657 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
659 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
660 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
662 TRACE("iface %p, parameter %p, desc %p\n", This, parameter, desc);
664 if (!param) param = get_parameter_struct(iface->lpVtbl->GetParameterByName(iface, NULL, parameter));
666 if (!desc || !param)
668 WARN("Invalid argument specified.\n");
669 return D3DERR_INVALIDCALL;
672 desc->Name = param->name;
673 desc->Semantic = param->semantic;
674 desc->Class = param->class;
675 desc->Type = param->type;
676 desc->Rows = param->rows;
677 desc->Columns = param->columns;
678 desc->Elements = param->element_count;
679 desc->Annotations = param->annotation_count;
680 desc->StructMembers = param->member_count;
681 desc->Flags = param->flags;
682 desc->Bytes = param->bytes;
684 return D3D_OK;
687 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
689 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
690 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
692 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
694 if (!desc || !tech)
696 WARN("Invalid argument specified.\n");
697 return D3DERR_INVALIDCALL;
700 desc->Name = tech->name;
701 desc->Passes = tech->pass_count;
702 desc->Annotations = tech->annotation_count;
704 return D3D_OK;
707 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
709 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
710 struct d3dx_pass *p = is_valid_pass(This, pass);
712 TRACE("iface %p, pass %p, desc %p\n", This, pass, desc);
714 if (!desc || !p)
716 WARN("Invalid argument specified.\n");
717 return D3DERR_INVALIDCALL;
720 desc->Name = p->name;
721 desc->Annotations = p->annotation_count;
723 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
724 desc->pVertexShaderFunction = NULL;
725 desc->pVertexShaderFunction = NULL;
727 return D3D_OK;
730 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
732 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
734 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
736 return E_NOTIMPL;
739 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
741 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
743 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
745 if (!parameter)
747 if (index < This->parameter_count)
749 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
750 return This->parameter_handles[index];
753 else
755 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
757 if (param && !param->element_count && index < param->member_count)
759 TRACE("Returning parameter %p\n", param->member_handles[index]);
760 return param->member_handles[index];
764 WARN("Invalid argument specified.\n");
766 return NULL;
769 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
771 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
772 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
773 D3DXHANDLE handle;
775 TRACE("iface %p, parameter %p, name %s\n", This, parameter, debugstr_a(name));
777 if (!param) param = get_parameter_by_name(This, NULL, parameter, FALSE);
779 if (!name)
781 handle = get_parameter_handle(param);
782 TRACE("Returning parameter %p\n", handle);
783 return handle;
786 handle = get_parameter_handle(get_parameter_by_name(This, param, name, FALSE));
787 TRACE("Returning parameter %p\n", handle);
789 return handle;
792 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
794 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
796 FIXME("iface %p, parameter %p, semantic %s stub\n", This, parameter, debugstr_a(semantic));
798 return NULL;
801 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
803 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
805 FIXME("iface %p, parameter %p, index %u stub\n", This, parameter, index);
807 return NULL;
810 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
812 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
814 TRACE("iface %p, index %u\n", This, index);
816 if (index >= This->technique_count)
818 WARN("Invalid argument specified.\n");
819 return NULL;
822 TRACE("Returning technique %p\n", This->technique_handles[index]);
824 return This->technique_handles[index];
827 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
829 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
830 unsigned int i;
832 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
834 if (!name)
836 WARN("Invalid argument specified.\n");
837 return NULL;
840 for (i = 0; i < This->technique_count; ++i)
842 struct d3dx_technique *tech = get_technique_struct(This->technique_handles[i]);
844 if (!strcmp(tech->name, name))
846 TRACE("Returning technique %p\n", This->technique_handles[i]);
847 return This->technique_handles[i];
851 WARN("Invalid argument specified.\n");
853 return NULL;
856 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
858 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
859 struct d3dx_technique *tech = is_valid_technique(This, technique);
861 TRACE("iface %p, technique %p, index %u\n", This, technique, index);
863 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
865 if (tech && index < tech->pass_count)
867 TRACE("Returning pass %p\n", tech->pass_handles[index]);
868 return tech->pass_handles[index];
871 WARN("Invalid argument specified.\n");
873 return NULL;
876 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
878 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
879 struct d3dx_technique *tech = is_valid_technique(This, technique);
881 TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
883 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
885 if (tech && name)
887 unsigned int i;
889 for (i = 0; i < tech->pass_count; ++i)
891 struct d3dx_pass *pass = get_pass_struct(tech->pass_handles[i]);
893 if (!strcmp(pass->name, name))
895 TRACE("Returning pass %p\n", tech->pass_handles[i]);
896 return tech->pass_handles[i];
901 WARN("Invalid argument specified.\n");
903 return NULL;
906 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
908 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
910 FIXME("iface %p, index %u stub\n", This, index);
912 return NULL;
915 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
917 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
919 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
921 return NULL;
924 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
926 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
928 FIXME("iface %p, object %p, index %u stub\n", This, object, index);
930 return NULL;
933 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
935 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
937 FIXME("iface %p, object %p, name %s stub\n", This, object, debugstr_a(name));
939 return NULL;
942 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
944 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
946 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
948 return E_NOTIMPL;
951 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
953 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
955 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
957 return E_NOTIMPL;
960 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
962 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
964 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
966 return E_NOTIMPL;
969 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
971 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
973 FIXME("iface %p, parameter %p, b %p stub\n", This, parameter, b);
975 return E_NOTIMPL;
978 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
980 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
982 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
984 return E_NOTIMPL;
987 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
989 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
991 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
993 return E_NOTIMPL;
996 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
998 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1000 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
1002 return E_NOTIMPL;
1005 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1007 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1009 FIXME("iface %p, parameter %p, n %p stub\n", This, parameter, n);
1011 return E_NOTIMPL;
1014 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1016 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1018 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1020 return E_NOTIMPL;
1023 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1025 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1027 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1029 return E_NOTIMPL;
1032 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1034 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1036 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
1038 return E_NOTIMPL;
1041 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1043 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1045 FIXME("iface %p, parameter %p, f %p stub\n", This, parameter, f);
1047 return E_NOTIMPL;
1050 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1052 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1054 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1056 return E_NOTIMPL;
1059 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1061 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1063 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1065 return E_NOTIMPL;
1068 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
1070 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1072 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1074 return E_NOTIMPL;
1077 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1079 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1081 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1083 return E_NOTIMPL;
1086 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1088 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1090 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1092 return E_NOTIMPL;
1095 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1097 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1099 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1101 return E_NOTIMPL;
1104 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1106 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1108 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1110 return E_NOTIMPL;
1113 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1115 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1117 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1119 return E_NOTIMPL;
1122 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1124 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1126 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1128 return E_NOTIMPL;
1131 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1133 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1135 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1137 return E_NOTIMPL;
1140 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1142 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1144 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1146 return E_NOTIMPL;
1149 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1151 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1153 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1155 return E_NOTIMPL;
1158 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1160 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1162 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1164 return E_NOTIMPL;
1167 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1169 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1171 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1173 return E_NOTIMPL;
1176 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1178 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1180 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1182 return E_NOTIMPL;
1185 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1187 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1189 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1191 return E_NOTIMPL;
1194 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1196 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1198 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1200 return E_NOTIMPL;
1203 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1205 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1207 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1209 return E_NOTIMPL;
1212 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1214 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1216 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1218 return E_NOTIMPL;
1221 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1223 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1225 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1227 return E_NOTIMPL;
1230 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1232 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1234 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1236 return E_NOTIMPL;
1239 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1241 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1243 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1245 return E_NOTIMPL;
1248 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1250 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1252 FIXME("iface %p, parameter %p, pshader %p stub\n", This, parameter, pshader);
1254 return E_NOTIMPL;
1257 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1259 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1261 FIXME("iface %p, parameter %p, vshader %p stub\n", This, parameter, vshader);
1263 return E_NOTIMPL;
1266 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1268 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1270 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
1272 return E_NOTIMPL;
1275 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
1277 /*** IUnknown methods ***/
1278 ID3DXBaseEffectImpl_QueryInterface,
1279 ID3DXBaseEffectImpl_AddRef,
1280 ID3DXBaseEffectImpl_Release,
1281 /*** ID3DXBaseEffect methods ***/
1282 ID3DXBaseEffectImpl_GetDesc,
1283 ID3DXBaseEffectImpl_GetParameterDesc,
1284 ID3DXBaseEffectImpl_GetTechniqueDesc,
1285 ID3DXBaseEffectImpl_GetPassDesc,
1286 ID3DXBaseEffectImpl_GetFunctionDesc,
1287 ID3DXBaseEffectImpl_GetParameter,
1288 ID3DXBaseEffectImpl_GetParameterByName,
1289 ID3DXBaseEffectImpl_GetParameterBySemantic,
1290 ID3DXBaseEffectImpl_GetParameterElement,
1291 ID3DXBaseEffectImpl_GetTechnique,
1292 ID3DXBaseEffectImpl_GetTechniqueByName,
1293 ID3DXBaseEffectImpl_GetPass,
1294 ID3DXBaseEffectImpl_GetPassByName,
1295 ID3DXBaseEffectImpl_GetFunction,
1296 ID3DXBaseEffectImpl_GetFunctionByName,
1297 ID3DXBaseEffectImpl_GetAnnotation,
1298 ID3DXBaseEffectImpl_GetAnnotationByName,
1299 ID3DXBaseEffectImpl_SetValue,
1300 ID3DXBaseEffectImpl_GetValue,
1301 ID3DXBaseEffectImpl_SetBool,
1302 ID3DXBaseEffectImpl_GetBool,
1303 ID3DXBaseEffectImpl_SetBoolArray,
1304 ID3DXBaseEffectImpl_GetBoolArray,
1305 ID3DXBaseEffectImpl_SetInt,
1306 ID3DXBaseEffectImpl_GetInt,
1307 ID3DXBaseEffectImpl_SetIntArray,
1308 ID3DXBaseEffectImpl_GetIntArray,
1309 ID3DXBaseEffectImpl_SetFloat,
1310 ID3DXBaseEffectImpl_GetFloat,
1311 ID3DXBaseEffectImpl_SetFloatArray,
1312 ID3DXBaseEffectImpl_GetFloatArray,
1313 ID3DXBaseEffectImpl_SetVector,
1314 ID3DXBaseEffectImpl_GetVector,
1315 ID3DXBaseEffectImpl_SetVectorArray,
1316 ID3DXBaseEffectImpl_GetVectorArray,
1317 ID3DXBaseEffectImpl_SetMatrix,
1318 ID3DXBaseEffectImpl_GetMatrix,
1319 ID3DXBaseEffectImpl_SetMatrixArray,
1320 ID3DXBaseEffectImpl_GetMatrixArray,
1321 ID3DXBaseEffectImpl_SetMatrixPointerArray,
1322 ID3DXBaseEffectImpl_GetMatrixPointerArray,
1323 ID3DXBaseEffectImpl_SetMatrixTranspose,
1324 ID3DXBaseEffectImpl_GetMatrixTranspose,
1325 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
1326 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
1327 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
1328 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
1329 ID3DXBaseEffectImpl_SetString,
1330 ID3DXBaseEffectImpl_GetString,
1331 ID3DXBaseEffectImpl_SetTexture,
1332 ID3DXBaseEffectImpl_GetTexture,
1333 ID3DXBaseEffectImpl_GetPixelShader,
1334 ID3DXBaseEffectImpl_GetVertexShader,
1335 ID3DXBaseEffectImpl_SetArrayRange,
1338 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
1340 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
1343 /*** IUnknown methods ***/
1344 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
1346 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1348 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
1350 if (IsEqualGUID(riid, &IID_IUnknown) ||
1351 IsEqualGUID(riid, &IID_ID3DXEffect))
1353 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
1354 *object = This;
1355 return S_OK;
1358 ERR("Interface %s not found\n", debugstr_guid(riid));
1360 return E_NOINTERFACE;
1363 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
1365 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1367 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1369 return InterlockedIncrement(&This->ref);
1372 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
1374 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1375 ULONG ref = InterlockedDecrement(&This->ref);
1377 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
1379 if (!ref)
1381 free_effect(This);
1382 HeapFree(GetProcessHeap(), 0, This);
1385 return ref;
1388 /*** ID3DXBaseEffect methods ***/
1389 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
1391 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1392 ID3DXBaseEffect *base = This->base_effect;
1394 TRACE("Forward iface %p, base %p\n", This, base);
1396 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1399 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1401 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1402 ID3DXBaseEffect *base = This->base_effect;
1404 TRACE("Forward iface %p, base %p\n", This, base);
1406 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1409 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1411 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1412 ID3DXBaseEffect *base = This->base_effect;
1414 TRACE("Forward iface %p, base %p\n", This, base);
1416 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1419 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1421 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1422 ID3DXBaseEffect *base = This->base_effect;
1424 TRACE("Forward iface %p, base %p\n", This, base);
1426 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1429 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1431 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1432 ID3DXBaseEffect *base = This->base_effect;
1434 TRACE("Forward iface %p, base %p\n", This, base);
1436 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1439 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1441 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1442 ID3DXBaseEffect *base = This->base_effect;
1444 TRACE("Forward iface %p, base %p\n", This, base);
1446 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1449 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1451 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1452 ID3DXBaseEffect *base = This->base_effect;
1454 TRACE("Forward iface %p, base %p\n", This, base);
1456 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1459 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1461 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1462 ID3DXBaseEffect *base = This->base_effect;
1464 TRACE("Forward iface %p, base %p\n", This, base);
1466 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1469 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1471 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1472 ID3DXBaseEffect *base = This->base_effect;
1474 TRACE("Forward iface %p, base %p\n", This, base);
1476 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1479 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
1481 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1482 ID3DXBaseEffect *base = This->base_effect;
1484 TRACE("Forward iface %p, base %p\n", This, base);
1486 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1489 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
1491 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1492 ID3DXBaseEffect *base = This->base_effect;
1494 TRACE("Forward iface %p, base %p\n", This, base);
1496 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1499 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
1501 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1502 ID3DXBaseEffect *base = This->base_effect;
1504 TRACE("Forward iface %p, base %p\n", This, base);
1506 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1509 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
1511 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1512 ID3DXBaseEffect *base = This->base_effect;
1514 TRACE("Forward iface %p, base %p\n", This, base);
1516 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1519 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
1521 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1522 ID3DXBaseEffect *base = This->base_effect;
1524 TRACE("Forward iface %p, base %p\n", This, base);
1526 return ID3DXBaseEffectImpl_GetFunction(base, index);
1529 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1531 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1532 ID3DXBaseEffect *base = This->base_effect;
1534 TRACE("Forward iface %p, base %p\n", This, base);
1536 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1539 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1541 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1542 ID3DXBaseEffect *base = This->base_effect;
1544 TRACE("Forward iface %p, base %p\n", This, base);
1546 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1549 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1551 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1552 ID3DXBaseEffect *base = This->base_effect;
1554 TRACE("Forward iface %p, base %p\n", This, base);
1556 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1559 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1561 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1562 ID3DXBaseEffect *base = This->base_effect;
1564 TRACE("Forward iface %p, base %p\n", This, base);
1566 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1569 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1571 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1572 ID3DXBaseEffect *base = This->base_effect;
1574 TRACE("Forward iface %p, base %p\n", This, base);
1576 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1579 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1581 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1582 ID3DXBaseEffect *base = This->base_effect;
1584 TRACE("Forward iface %p, base %p\n", This, base);
1586 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1589 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1591 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1592 ID3DXBaseEffect *base = This->base_effect;
1594 TRACE("Forward iface %p, base %p\n", This, base);
1596 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1599 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1601 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1602 ID3DXBaseEffect *base = This->base_effect;
1604 TRACE("Forward iface %p, base %p\n", This, base);
1606 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1609 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1611 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1612 ID3DXBaseEffect *base = This->base_effect;
1614 TRACE("Forward iface %p, base %p\n", This, base);
1616 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1619 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
1621 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1622 ID3DXBaseEffect *base = This->base_effect;
1624 TRACE("Forward iface %p, base %p\n", This, base);
1626 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1629 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1631 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1632 ID3DXBaseEffect *base = This->base_effect;
1634 TRACE("Forward iface %p, base %p\n", This, base);
1636 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1639 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1641 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1642 ID3DXBaseEffect *base = This->base_effect;
1644 TRACE("Forward iface %p, base %p\n", This, base);
1646 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1649 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1651 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1652 ID3DXBaseEffect *base = This->base_effect;
1654 TRACE("Forward iface %p, base %p\n", This, base);
1656 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1659 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
1661 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1662 ID3DXBaseEffect *base = This->base_effect;
1664 TRACE("Forward iface %p, base %p\n", This, base);
1666 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1669 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1671 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1672 ID3DXBaseEffect *base = This->base_effect;
1674 TRACE("Forward iface %p, base %p\n", This, base);
1676 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1679 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1681 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1682 ID3DXBaseEffect *base = This->base_effect;
1684 TRACE("Forward iface %p, base %p\n", This, base);
1686 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1689 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1691 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1692 ID3DXBaseEffect *base = This->base_effect;
1694 TRACE("Forward iface %p, base %p\n", This, base);
1696 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1699 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1701 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1702 ID3DXBaseEffect *base = This->base_effect;
1704 TRACE("Forward iface %p, base %p\n", This, base);
1706 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1709 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1711 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1712 ID3DXBaseEffect *base = This->base_effect;
1714 TRACE("Forward iface %p, base %p\n", This, base);
1716 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1719 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1721 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1722 ID3DXBaseEffect *base = This->base_effect;
1724 TRACE("Forward iface %p, base %p\n", This, base);
1726 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1729 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1731 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1732 ID3DXBaseEffect *base = This->base_effect;
1734 TRACE("Forward iface %p, base %p\n", This, base);
1736 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
1739 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1741 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1742 ID3DXBaseEffect *base = This->base_effect;
1744 TRACE("Forward iface %p, base %p\n", This, base);
1746 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
1749 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1751 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1752 ID3DXBaseEffect *base = This->base_effect;
1754 TRACE("Forward iface %p, base %p\n", This, base);
1756 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
1759 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1761 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1762 ID3DXBaseEffect *base = This->base_effect;
1764 TRACE("Forward iface %p, base %p\n", This, base);
1766 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
1769 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1771 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1772 ID3DXBaseEffect *base = This->base_effect;
1774 TRACE("Forward iface %p, base %p\n", This, base);
1776 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
1779 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1781 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1782 ID3DXBaseEffect *base = This->base_effect;
1784 TRACE("Forward iface %p, base %p\n", This, base);
1786 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
1789 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1791 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1792 ID3DXBaseEffect *base = This->base_effect;
1794 TRACE("Forward iface %p, base %p\n", This, base);
1796 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
1799 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1801 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1802 ID3DXBaseEffect *base = This->base_effect;
1804 TRACE("Forward iface %p, base %p\n", This, base);
1806 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
1809 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1811 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1812 ID3DXBaseEffect *base = This->base_effect;
1814 TRACE("Forward iface %p, base %p\n", This, base);
1816 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
1819 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1821 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1822 ID3DXBaseEffect *base = This->base_effect;
1824 TRACE("Forward iface %p, base %p\n", This, base);
1826 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
1829 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1831 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1832 ID3DXBaseEffect *base = This->base_effect;
1834 TRACE("Forward iface %p, base %p\n", This, base);
1836 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
1839 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1841 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1842 ID3DXBaseEffect *base = This->base_effect;
1844 TRACE("Forward iface %p, base %p\n", This, base);
1846 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
1849 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1851 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1852 ID3DXBaseEffect *base = This->base_effect;
1854 TRACE("Forward iface %p, base %p\n", This, base);
1856 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
1859 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1861 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1862 ID3DXBaseEffect *base = This->base_effect;
1864 TRACE("Forward iface %p, base %p\n", This, base);
1866 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
1869 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1871 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1872 ID3DXBaseEffect *base = This->base_effect;
1874 TRACE("Forward iface %p, base %p\n", This, base);
1876 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
1879 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1881 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1882 ID3DXBaseEffect *base = This->base_effect;
1884 TRACE("Forward iface %p, base %p\n", This, base);
1886 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
1889 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1891 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1892 ID3DXBaseEffect *base = This->base_effect;
1894 TRACE("Forward iface %p, base %p\n", This, base);
1896 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
1899 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1901 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1902 ID3DXBaseEffect *base = This->base_effect;
1904 TRACE("Forward iface %p, base %p\n", This, base);
1906 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
1909 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1911 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1912 ID3DXBaseEffect *base = This->base_effect;
1914 TRACE("Forward iface %p, base %p\n", This, base);
1916 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
1919 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1921 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1922 ID3DXBaseEffect *base = This->base_effect;
1924 TRACE("Forward iface %p, base %p\n", This, base);
1926 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
1929 /*** ID3DXEffect methods ***/
1930 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
1932 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1934 TRACE("iface %p, pool %p\n", This, pool);
1936 if (!pool)
1938 WARN("Invalid argument supplied.\n");
1939 return D3DERR_INVALIDCALL;
1942 if (This->pool)
1944 This->pool->lpVtbl->AddRef(This->pool);
1947 *pool = This->pool;
1949 TRACE("Returning pool %p\n", *pool);
1951 return S_OK;
1954 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1956 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1958 FIXME("(%p)->(%p): stub\n", This, technique);
1960 return E_NOTIMPL;
1963 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
1965 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1967 FIXME("(%p)->(): stub\n", This);
1969 return NULL;
1972 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
1974 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1976 FIXME("(%p)->(%p): stub\n", This, technique);
1978 return D3D_OK;
1981 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
1983 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1985 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
1987 return E_NOTIMPL;
1990 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
1992 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1994 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
1996 return FALSE;
1999 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
2001 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2003 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
2005 return E_NOTIMPL;
2008 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
2010 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2012 FIXME("(%p)->(%u): stub\n", This, pass);
2014 return E_NOTIMPL;
2017 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
2019 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2021 FIXME("(%p)->(): stub\n", This);
2023 return E_NOTIMPL;
2026 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
2028 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2030 FIXME("(%p)->(): stub\n", This);
2032 return E_NOTIMPL;
2035 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
2037 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2039 FIXME("(%p)->(): stub\n", This);
2041 return E_NOTIMPL;
2044 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
2046 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2048 TRACE("iface %p, device %p\n", This, device);
2050 if (!device)
2052 WARN("Invalid argument supplied.\n");
2053 return D3DERR_INVALIDCALL;
2056 IDirect3DDevice9_AddRef(This->device);
2058 *device = This->device;
2060 TRACE("Returning device %p\n", *device);
2062 return S_OK;
2065 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
2067 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2069 FIXME("(%p)->(): stub\n", This);
2071 return E_NOTIMPL;
2074 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
2076 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2078 FIXME("(%p)->(): stub\n", This);
2080 return E_NOTIMPL;
2083 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER manager)
2085 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2087 FIXME("(%p)->(%p): stub\n", This, manager);
2089 return E_NOTIMPL;
2092 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER* manager)
2094 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2096 FIXME("(%p)->(%p): stub\n", This, manager);
2098 return E_NOTIMPL;
2101 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
2103 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2105 FIXME("(%p)->(): stub\n", This);
2107 return E_NOTIMPL;
2110 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
2112 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2114 FIXME("(%p)->(): stub\n", This);
2116 return NULL;
2119 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2121 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2123 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2125 return E_NOTIMPL;
2128 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2130 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2132 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2134 return E_NOTIMPL;
2137 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
2139 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2141 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
2143 return E_NOTIMPL;
2146 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
2148 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2150 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
2152 return E_NOTIMPL;
2155 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
2157 /*** IUnknown methods ***/
2158 ID3DXEffectImpl_QueryInterface,
2159 ID3DXEffectImpl_AddRef,
2160 ID3DXEffectImpl_Release,
2161 /*** ID3DXBaseEffect methods ***/
2162 ID3DXEffectImpl_GetDesc,
2163 ID3DXEffectImpl_GetParameterDesc,
2164 ID3DXEffectImpl_GetTechniqueDesc,
2165 ID3DXEffectImpl_GetPassDesc,
2166 ID3DXEffectImpl_GetFunctionDesc,
2167 ID3DXEffectImpl_GetParameter,
2168 ID3DXEffectImpl_GetParameterByName,
2169 ID3DXEffectImpl_GetParameterBySemantic,
2170 ID3DXEffectImpl_GetParameterElement,
2171 ID3DXEffectImpl_GetTechnique,
2172 ID3DXEffectImpl_GetTechniqueByName,
2173 ID3DXEffectImpl_GetPass,
2174 ID3DXEffectImpl_GetPassByName,
2175 ID3DXEffectImpl_GetFunction,
2176 ID3DXEffectImpl_GetFunctionByName,
2177 ID3DXEffectImpl_GetAnnotation,
2178 ID3DXEffectImpl_GetAnnotationByName,
2179 ID3DXEffectImpl_SetValue,
2180 ID3DXEffectImpl_GetValue,
2181 ID3DXEffectImpl_SetBool,
2182 ID3DXEffectImpl_GetBool,
2183 ID3DXEffectImpl_SetBoolArray,
2184 ID3DXEffectImpl_GetBoolArray,
2185 ID3DXEffectImpl_SetInt,
2186 ID3DXEffectImpl_GetInt,
2187 ID3DXEffectImpl_SetIntArray,
2188 ID3DXEffectImpl_GetIntArray,
2189 ID3DXEffectImpl_SetFloat,
2190 ID3DXEffectImpl_GetFloat,
2191 ID3DXEffectImpl_SetFloatArray,
2192 ID3DXEffectImpl_GetFloatArray,
2193 ID3DXEffectImpl_SetVector,
2194 ID3DXEffectImpl_GetVector,
2195 ID3DXEffectImpl_SetVectorArray,
2196 ID3DXEffectImpl_GetVectorArray,
2197 ID3DXEffectImpl_SetMatrix,
2198 ID3DXEffectImpl_GetMatrix,
2199 ID3DXEffectImpl_SetMatrixArray,
2200 ID3DXEffectImpl_GetMatrixArray,
2201 ID3DXEffectImpl_SetMatrixPointerArray,
2202 ID3DXEffectImpl_GetMatrixPointerArray,
2203 ID3DXEffectImpl_SetMatrixTranspose,
2204 ID3DXEffectImpl_GetMatrixTranspose,
2205 ID3DXEffectImpl_SetMatrixTransposeArray,
2206 ID3DXEffectImpl_GetMatrixTransposeArray,
2207 ID3DXEffectImpl_SetMatrixTransposePointerArray,
2208 ID3DXEffectImpl_GetMatrixTransposePointerArray,
2209 ID3DXEffectImpl_SetString,
2210 ID3DXEffectImpl_GetString,
2211 ID3DXEffectImpl_SetTexture,
2212 ID3DXEffectImpl_GetTexture,
2213 ID3DXEffectImpl_GetPixelShader,
2214 ID3DXEffectImpl_GetVertexShader,
2215 ID3DXEffectImpl_SetArrayRange,
2216 /*** ID3DXEffect methods ***/
2217 ID3DXEffectImpl_GetPool,
2218 ID3DXEffectImpl_SetTechnique,
2219 ID3DXEffectImpl_GetCurrentTechnique,
2220 ID3DXEffectImpl_ValidateTechnique,
2221 ID3DXEffectImpl_FindNextValidTechnique,
2222 ID3DXEffectImpl_IsParameterUsed,
2223 ID3DXEffectImpl_Begin,
2224 ID3DXEffectImpl_BeginPass,
2225 ID3DXEffectImpl_CommitChanges,
2226 ID3DXEffectImpl_EndPass,
2227 ID3DXEffectImpl_End,
2228 ID3DXEffectImpl_GetDevice,
2229 ID3DXEffectImpl_OnLostDevice,
2230 ID3DXEffectImpl_OnResetDevice,
2231 ID3DXEffectImpl_SetStateManager,
2232 ID3DXEffectImpl_GetStateManager,
2233 ID3DXEffectImpl_BeginParameterBlock,
2234 ID3DXEffectImpl_EndParameterBlock,
2235 ID3DXEffectImpl_ApplyParameterBlock,
2236 ID3DXEffectImpl_DeleteParameterBlock,
2237 ID3DXEffectImpl_CloneEffect,
2238 ID3DXEffectImpl_SetRawValue
2241 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
2243 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
2246 /*** IUnknown methods ***/
2247 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
2249 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2251 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
2253 if (IsEqualGUID(riid, &IID_IUnknown) ||
2254 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
2256 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
2257 *object = This;
2258 return S_OK;
2261 ERR("Interface %s not found\n", debugstr_guid(riid));
2263 return E_NOINTERFACE;
2266 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
2268 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2270 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
2272 return InterlockedIncrement(&This->ref);
2275 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
2277 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2278 ULONG ref = InterlockedDecrement(&This->ref);
2280 TRACE("iface %p: Release from %u\n", iface, ref + 1);
2282 if (!ref)
2284 free_effect_compiler(This);
2285 HeapFree(GetProcessHeap(), 0, This);
2288 return ref;
2291 /*** ID3DXBaseEffect methods ***/
2292 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
2294 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2295 ID3DXBaseEffect *base = This->base_effect;
2297 TRACE("Forward iface %p, base %p\n", This, base);
2299 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2302 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2304 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2305 ID3DXBaseEffect *base = This->base_effect;
2307 TRACE("Forward iface %p, base %p\n", This, base);
2309 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2312 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2314 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2315 ID3DXBaseEffect *base = This->base_effect;
2317 TRACE("Forward iface %p, base %p\n", This, base);
2319 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2322 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2324 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2325 ID3DXBaseEffect *base = This->base_effect;
2327 TRACE("Forward iface %p, base %p\n", This, base);
2329 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2332 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2334 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2335 ID3DXBaseEffect *base = This->base_effect;
2337 TRACE("Forward iface %p, base %p\n", This, base);
2339 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2342 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2344 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2345 ID3DXBaseEffect *base = This->base_effect;
2347 TRACE("Forward iface %p, base %p\n", This, base);
2349 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2352 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
2354 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2355 ID3DXBaseEffect *base = This->base_effect;
2357 TRACE("Forward iface %p, base %p\n", This, base);
2359 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2362 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
2364 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2365 ID3DXBaseEffect *base = This->base_effect;
2367 TRACE("Forward iface %p, base %p\n", This, base);
2369 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2372 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2374 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2375 ID3DXBaseEffect *base = This->base_effect;
2377 TRACE("Forward iface %p, base %p\n", This, base);
2379 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2382 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
2384 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2385 ID3DXBaseEffect *base = This->base_effect;
2387 TRACE("Forward iface %p, base %p\n", This, base);
2389 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2392 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
2394 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2395 ID3DXBaseEffect *base = This->base_effect;
2397 TRACE("Forward iface %p, base %p\n", This, base);
2399 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2402 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
2404 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2405 ID3DXBaseEffect *base = This->base_effect;
2407 TRACE("Forward iface %p, base %p\n", This, base);
2409 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2412 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
2414 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2415 ID3DXBaseEffect *base = This->base_effect;
2417 TRACE("Forward iface %p, base %p\n", This, base);
2419 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2422 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
2424 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2425 ID3DXBaseEffect *base = This->base_effect;
2427 TRACE("Forward iface %p, base %p\n", This, base);
2429 return ID3DXBaseEffectImpl_GetFunction(base, index);
2432 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
2434 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2435 ID3DXBaseEffect *base = This->base_effect;
2437 TRACE("Forward iface %p, base %p\n", This, base);
2439 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2442 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
2444 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2445 ID3DXBaseEffect *base = This->base_effect;
2447 TRACE("Forward iface %p, base %p\n", This, base);
2449 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2452 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
2454 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2455 ID3DXBaseEffect *base = This->base_effect;
2457 TRACE("Forward iface %p, base %p\n", This, base);
2459 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2462 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2464 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2465 ID3DXBaseEffect *base = This->base_effect;
2467 TRACE("Forward iface %p, base %p\n", This, base);
2469 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2472 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2474 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2475 ID3DXBaseEffect *base = This->base_effect;
2477 TRACE("Forward iface %p, base %p\n", This, base);
2479 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2482 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
2484 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2485 ID3DXBaseEffect *base = This->base_effect;
2487 TRACE("Forward iface %p, base %p\n", This, base);
2489 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2492 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
2494 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2495 ID3DXBaseEffect *base = This->base_effect;
2497 TRACE("Forward iface %p, base %p\n", This, base);
2499 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2502 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2504 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2505 ID3DXBaseEffect *base = This->base_effect;
2507 TRACE("Forward iface %p, base %p\n", This, base);
2509 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2512 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2514 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2515 ID3DXBaseEffect *base = This->base_effect;
2517 TRACE("Forward iface %p, base %p\n", This, base);
2519 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2522 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
2524 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2525 ID3DXBaseEffect *base = This->base_effect;
2527 TRACE("Forward iface %p, base %p\n", This, base);
2529 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2532 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2534 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2535 ID3DXBaseEffect *base = This->base_effect;
2537 TRACE("Forward iface %p, base %p\n", This, base);
2539 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2542 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2544 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2545 ID3DXBaseEffect *base = This->base_effect;
2547 TRACE("Forward iface %p, base %p\n", This, base);
2549 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2552 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2554 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2555 ID3DXBaseEffect *base = This->base_effect;
2557 TRACE("Forward iface %p, base %p\n", This, base);
2559 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2562 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2564 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2565 ID3DXBaseEffect *base = This->base_effect;
2567 TRACE("Forward iface %p, base %p\n", This, base);
2569 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2572 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2574 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2575 ID3DXBaseEffect *base = This->base_effect;
2577 TRACE("Forward iface %p, base %p\n", This, base);
2579 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2582 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2584 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2585 ID3DXBaseEffect *base = This->base_effect;
2587 TRACE("Forward iface %p, base %p\n", This, base);
2589 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2592 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2594 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2595 ID3DXBaseEffect *base = This->base_effect;
2597 TRACE("Forward iface %p, base %p\n", This, base);
2599 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2602 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2604 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2605 ID3DXBaseEffect *base = This->base_effect;
2607 TRACE("Forward iface %p, base %p\n", This, base);
2609 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2612 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2614 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2615 ID3DXBaseEffect *base = This->base_effect;
2617 TRACE("Forward iface %p, base %p\n", This, base);
2619 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2622 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2624 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2625 ID3DXBaseEffect *base = This->base_effect;
2627 TRACE("Forward iface %p, base %p\n", This, base);
2629 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2632 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2634 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2635 ID3DXBaseEffect *base = This->base_effect;
2637 TRACE("Forward iface %p, base %p\n", This, base);
2639 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2642 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2644 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2645 ID3DXBaseEffect *base = This->base_effect;
2647 TRACE("Forward iface %p, base %p\n", This, base);
2649 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2652 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2654 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2655 ID3DXBaseEffect *base = This->base_effect;
2657 TRACE("Forward iface %p, base %p\n", This, base);
2659 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2662 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2664 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2665 ID3DXBaseEffect *base = This->base_effect;
2667 TRACE("Forward iface %p, base %p\n", This, base);
2669 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2672 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2674 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2675 ID3DXBaseEffect *base = This->base_effect;
2677 TRACE("Forward iface %p, base %p\n", This, base);
2679 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2682 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2684 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2685 ID3DXBaseEffect *base = This->base_effect;
2687 TRACE("Forward iface %p, base %p\n", This, base);
2689 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2692 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2694 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2695 ID3DXBaseEffect *base = This->base_effect;
2697 TRACE("Forward iface %p, base %p\n", This, base);
2699 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2702 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2704 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2705 ID3DXBaseEffect *base = This->base_effect;
2707 TRACE("Forward iface %p, base %p\n", This, base);
2709 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2712 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2714 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2715 ID3DXBaseEffect *base = This->base_effect;
2717 TRACE("Forward iface %p, base %p\n", This, base);
2719 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2722 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2724 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2725 ID3DXBaseEffect *base = This->base_effect;
2727 TRACE("Forward iface %p, base %p\n", This, base);
2729 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2732 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2734 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2735 ID3DXBaseEffect *base = This->base_effect;
2737 TRACE("Forward iface %p, base %p\n", This, base);
2739 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2742 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2744 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2745 ID3DXBaseEffect *base = This->base_effect;
2747 TRACE("Forward iface %p, base %p\n", This, base);
2749 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2752 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2754 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2755 ID3DXBaseEffect *base = This->base_effect;
2757 TRACE("Forward iface %p, base %p\n", This, base);
2759 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2762 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
2764 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2765 ID3DXBaseEffect *base = This->base_effect;
2767 TRACE("Forward iface %p, base %p\n", This, base);
2769 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2772 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
2774 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2775 ID3DXBaseEffect *base = This->base_effect;
2777 TRACE("Forward iface %p, base %p\n", This, base);
2779 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2782 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2784 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2785 ID3DXBaseEffect *base = This->base_effect;
2787 TRACE("Forward iface %p, base %p\n", This, base);
2789 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2792 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2794 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2795 ID3DXBaseEffect *base = This->base_effect;
2797 TRACE("Forward iface %p, base %p\n", This, base);
2799 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2802 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2804 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2805 ID3DXBaseEffect *base = This->base_effect;
2807 TRACE("Forward iface %p, base %p\n", This, base);
2809 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2812 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2814 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2815 ID3DXBaseEffect *base = This->base_effect;
2817 TRACE("Forward iface %p, base %p\n", This, base);
2819 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2822 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
2824 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2825 ID3DXBaseEffect *base = This->base_effect;
2827 TRACE("Forward iface %p, base %p\n", This, base);
2829 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2832 /*** ID3DXEffectCompiler methods ***/
2833 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
2835 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2837 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
2839 return E_NOTIMPL;
2842 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
2844 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2846 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
2848 return E_NOTIMPL;
2851 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
2852 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
2854 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2856 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
2858 return E_NOTIMPL;
2861 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
2862 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
2864 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2866 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
2867 This, function, target, flags, shader, error_msgs, constant_table);
2869 return E_NOTIMPL;
2872 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
2874 /*** IUnknown methods ***/
2875 ID3DXEffectCompilerImpl_QueryInterface,
2876 ID3DXEffectCompilerImpl_AddRef,
2877 ID3DXEffectCompilerImpl_Release,
2878 /*** ID3DXBaseEffect methods ***/
2879 ID3DXEffectCompilerImpl_GetDesc,
2880 ID3DXEffectCompilerImpl_GetParameterDesc,
2881 ID3DXEffectCompilerImpl_GetTechniqueDesc,
2882 ID3DXEffectCompilerImpl_GetPassDesc,
2883 ID3DXEffectCompilerImpl_GetFunctionDesc,
2884 ID3DXEffectCompilerImpl_GetParameter,
2885 ID3DXEffectCompilerImpl_GetParameterByName,
2886 ID3DXEffectCompilerImpl_GetParameterBySemantic,
2887 ID3DXEffectCompilerImpl_GetParameterElement,
2888 ID3DXEffectCompilerImpl_GetTechnique,
2889 ID3DXEffectCompilerImpl_GetTechniqueByName,
2890 ID3DXEffectCompilerImpl_GetPass,
2891 ID3DXEffectCompilerImpl_GetPassByName,
2892 ID3DXEffectCompilerImpl_GetFunction,
2893 ID3DXEffectCompilerImpl_GetFunctionByName,
2894 ID3DXEffectCompilerImpl_GetAnnotation,
2895 ID3DXEffectCompilerImpl_GetAnnotationByName,
2896 ID3DXEffectCompilerImpl_SetValue,
2897 ID3DXEffectCompilerImpl_GetValue,
2898 ID3DXEffectCompilerImpl_SetBool,
2899 ID3DXEffectCompilerImpl_GetBool,
2900 ID3DXEffectCompilerImpl_SetBoolArray,
2901 ID3DXEffectCompilerImpl_GetBoolArray,
2902 ID3DXEffectCompilerImpl_SetInt,
2903 ID3DXEffectCompilerImpl_GetInt,
2904 ID3DXEffectCompilerImpl_SetIntArray,
2905 ID3DXEffectCompilerImpl_GetIntArray,
2906 ID3DXEffectCompilerImpl_SetFloat,
2907 ID3DXEffectCompilerImpl_GetFloat,
2908 ID3DXEffectCompilerImpl_SetFloatArray,
2909 ID3DXEffectCompilerImpl_GetFloatArray,
2910 ID3DXEffectCompilerImpl_SetVector,
2911 ID3DXEffectCompilerImpl_GetVector,
2912 ID3DXEffectCompilerImpl_SetVectorArray,
2913 ID3DXEffectCompilerImpl_GetVectorArray,
2914 ID3DXEffectCompilerImpl_SetMatrix,
2915 ID3DXEffectCompilerImpl_GetMatrix,
2916 ID3DXEffectCompilerImpl_SetMatrixArray,
2917 ID3DXEffectCompilerImpl_GetMatrixArray,
2918 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
2919 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
2920 ID3DXEffectCompilerImpl_SetMatrixTranspose,
2921 ID3DXEffectCompilerImpl_GetMatrixTranspose,
2922 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
2923 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
2924 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
2925 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
2926 ID3DXEffectCompilerImpl_SetString,
2927 ID3DXEffectCompilerImpl_GetString,
2928 ID3DXEffectCompilerImpl_SetTexture,
2929 ID3DXEffectCompilerImpl_GetTexture,
2930 ID3DXEffectCompilerImpl_GetPixelShader,
2931 ID3DXEffectCompilerImpl_GetVertexShader,
2932 ID3DXEffectCompilerImpl_SetArrayRange,
2933 /*** ID3DXEffectCompiler methods ***/
2934 ID3DXEffectCompilerImpl_SetLiteral,
2935 ID3DXEffectCompilerImpl_GetLiteral,
2936 ID3DXEffectCompilerImpl_CompileEffect,
2937 ID3DXEffectCompilerImpl_CompileShader,
2940 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value)
2942 unsigned int i;
2943 HRESULT hr;
2944 UINT old_size = 0;
2946 if (param->element_count)
2948 param->data = value;
2950 for (i = 0; i < param->element_count; ++i)
2952 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
2954 hr = d3dx9_parse_value(member, (char *)value + old_size);
2955 if (hr != D3D_OK)
2957 WARN("Failed to parse value\n");
2958 return hr;
2961 old_size += member->bytes;
2964 return D3D_OK;
2967 switch(param->class)
2969 case D3DXPC_SCALAR:
2970 case D3DXPC_VECTOR:
2971 case D3DXPC_MATRIX_ROWS:
2972 case D3DXPC_MATRIX_COLUMNS:
2973 param->data = value;
2974 break;
2976 case D3DXPC_STRUCT:
2977 param->data = value;
2979 for (i = 0; i < param->member_count; ++i)
2981 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
2983 hr = d3dx9_parse_value(member, (char *)value + old_size);
2984 if (hr != D3D_OK)
2986 WARN("Failed to parse value\n");
2987 return hr;
2990 old_size += member->bytes;
2992 break;
2994 default:
2995 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2996 break;
2999 return D3D_OK;
3003 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
3005 UINT size = param->bytes;
3006 HRESULT hr;
3007 void *value;
3009 TRACE("param size: %u\n", size);
3011 value = HeapAlloc(GetProcessHeap(), 0, size);
3012 if (!value)
3014 ERR("Failed to allocate data memory.\n");
3015 return E_OUTOFMEMORY;
3018 TRACE("Data: %s.\n", debugstr_an(ptr, size));
3019 memcpy(value, ptr, size);
3021 hr = d3dx9_parse_value(param, value);
3022 if (hr != D3D_OK)
3024 WARN("Failed to parse value\n");
3025 HeapFree(GetProcessHeap(), 0, value);
3026 return hr;
3029 param->data = value;
3031 return D3D_OK;
3034 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
3036 DWORD size;
3038 read_dword(&ptr, &size);
3039 TRACE("Name size: %#x\n", size);
3041 if (!size)
3043 return D3D_OK;
3046 *name = HeapAlloc(GetProcessHeap(), 0, size);
3047 if (!*name)
3049 ERR("Failed to allocate name memory.\n");
3050 return E_OUTOFMEMORY;
3053 TRACE("Name: %s.\n", debugstr_an(ptr, size));
3054 memcpy(*name, ptr, size);
3056 return D3D_OK;
3059 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr, struct d3dx_parameter *parent)
3061 DWORD offset;
3062 HRESULT hr;
3063 D3DXHANDLE *member_handles = NULL;
3064 UINT i;
3066 if (!parent)
3068 read_dword(ptr, &param->type);
3069 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
3071 read_dword(ptr, &param->class);
3072 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
3074 read_dword(ptr, &offset);
3075 TRACE("Type name offset: %#x\n", offset);
3076 hr = d3dx9_parse_name(&param->name, data + offset);
3077 if (hr != D3D_OK)
3079 WARN("Failed to parse name\n");
3080 goto err_out;
3083 read_dword(ptr, &offset);
3084 TRACE("Type semantic offset: %#x\n", offset);
3085 hr = d3dx9_parse_name(&param->semantic, data + offset);
3086 if (hr != D3D_OK)
3088 WARN("Failed to parse semantic\n");
3089 goto err_out;
3092 read_dword(ptr, &param->element_count);
3093 TRACE("Elements: %u\n", param->element_count);
3095 switch (param->class)
3097 case D3DXPC_VECTOR:
3098 read_dword(ptr, &param->columns);
3099 TRACE("Columns: %u\n", param->columns);
3101 read_dword(ptr, &param->rows);
3102 TRACE("Rows: %u\n", param->rows);
3104 /* sizeof(DWORD) * rows * columns */
3105 param->bytes = 4 * param->rows * param->columns;
3106 break;
3108 case D3DXPC_SCALAR:
3109 case D3DXPC_MATRIX_ROWS:
3110 case D3DXPC_MATRIX_COLUMNS:
3111 read_dword(ptr, &param->rows);
3112 TRACE("Rows: %u\n", param->rows);
3114 read_dword(ptr, &param->columns);
3115 TRACE("Columns: %u\n", param->columns);
3117 /* sizeof(DWORD) * rows * columns */
3118 param->bytes = 4 * param->rows * param->columns;
3119 break;
3121 case D3DXPC_STRUCT:
3122 read_dword(ptr, &param->member_count);
3123 TRACE("Members: %u\n", param->member_count);
3124 break;
3126 default:
3127 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3128 break;
3131 else
3133 /* elements */
3134 param->type = parent->type;
3135 param->class = parent->class;
3136 param->name = parent->name;
3137 param->semantic = parent->semantic;
3138 param->element_count = 0;
3139 param->annotation_count = 0;
3140 param->member_count = parent->member_count;
3141 param->bytes = parent->bytes;
3142 param->flags = parent->flags;
3143 param->rows = parent->rows;
3144 param->columns = parent->columns;
3147 if (param->element_count)
3149 unsigned int param_bytes = 0;
3150 const char *save_ptr = *ptr;
3152 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
3153 if (!member_handles)
3155 ERR("Out of memory\n");
3156 hr = E_OUTOFMEMORY;
3157 goto err_out;
3160 for (i = 0; i < param->element_count; ++i)
3162 struct d3dx_parameter *member;
3163 *ptr = save_ptr;
3165 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3166 if (!member)
3168 ERR("Out of memory\n");
3169 hr = E_OUTOFMEMORY;
3170 goto err_out;
3173 member_handles[i] = get_parameter_handle(member);
3174 member->base = param->base;
3176 hr = d3dx9_parse_effect_typedef(member, data, ptr, param);
3177 if (hr != D3D_OK)
3179 WARN("Failed to parse member\n");
3180 goto err_out;
3183 param_bytes += member->bytes;
3186 param->bytes = param_bytes;
3188 else if (param->member_count)
3190 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
3191 if (!member_handles)
3193 ERR("Out of memory\n");
3194 hr = E_OUTOFMEMORY;
3195 goto err_out;
3198 for (i = 0; i < param->member_count; ++i)
3200 struct d3dx_parameter *member;
3202 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3203 if (!member)
3205 ERR("Out of memory\n");
3206 hr = E_OUTOFMEMORY;
3207 goto err_out;
3210 member_handles[i] = get_parameter_handle(member);
3211 member->base = param->base;
3213 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL);
3214 if (hr != D3D_OK)
3216 WARN("Failed to parse member\n");
3217 goto err_out;
3220 param->bytes += member->bytes;
3224 param->member_handles = member_handles;
3226 return D3D_OK;
3228 err_out:
3230 if (member_handles)
3232 unsigned int count;
3234 if (param->element_count) count = param->element_count;
3235 else count = param->member_count;
3237 for (i = 0; i < count; ++i)
3239 free_parameter(member_handles[i], param->element_count != 0, TRUE);
3241 HeapFree(GetProcessHeap(), 0, member_handles);
3244 if (!parent)
3246 HeapFree(GetProcessHeap(), 0, param->name);
3247 HeapFree(GetProcessHeap(), 0, param->semantic);
3249 param->name = NULL;
3250 param->semantic = NULL;
3252 return hr;
3255 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
3257 DWORD offset;
3258 const char *ptr2;
3259 HRESULT hr;
3261 anno->flags = D3DX_PARAMETER_ANNOTATION;
3263 read_dword(ptr, &offset);
3264 TRACE("Typedef offset: %#x\n", offset);
3265 ptr2 = data + offset;
3266 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL);
3267 if (hr != D3D_OK)
3269 WARN("Failed to parse type definition\n");
3270 return hr;
3273 read_dword(ptr, &offset);
3274 TRACE("Value offset: %#x\n", offset);
3275 hr = d3dx9_parse_init_value(anno, data + offset);
3276 if (hr != D3D_OK)
3278 WARN("Failed to parse value\n");
3279 return hr;
3282 return D3D_OK;
3285 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
3287 DWORD offset;
3288 HRESULT hr;
3289 unsigned int i;
3290 D3DXHANDLE *annotation_handles = NULL;
3291 const char *ptr2;
3293 read_dword(ptr, &offset);
3294 TRACE("Typedef offset: %#x\n", offset);
3295 ptr2 = data + offset;
3297 read_dword(ptr, &offset);
3298 TRACE("Value offset: %#x\n", offset);
3300 read_dword(ptr, &param->flags);
3301 TRACE("Flags: %#x\n", param->flags);
3303 read_dword(ptr, &param->annotation_count);
3304 TRACE("Annotation count: %u\n", param->annotation_count);
3306 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL);
3307 if (hr != D3D_OK)
3309 WARN("Failed to parse type definition\n");
3310 return hr;
3313 hr = d3dx9_parse_init_value(param, data + offset);
3314 if (hr != D3D_OK)
3316 WARN("Failed to parse value\n");
3317 return hr;
3320 if (param->annotation_count)
3322 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
3323 if (!annotation_handles)
3325 ERR("Out of memory\n");
3326 hr = E_OUTOFMEMORY;
3327 goto err_out;
3330 for (i = 0; i < param->annotation_count; ++i)
3332 struct d3dx_parameter *annotation;
3334 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3335 if (!annotation)
3337 ERR("Out of memory\n");
3338 hr = E_OUTOFMEMORY;
3339 goto err_out;
3342 annotation_handles[i] = get_parameter_handle(annotation);
3343 annotation->base = param->base;
3345 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3346 if (hr != D3D_OK)
3348 WARN("Failed to parse annotation\n");
3349 goto err_out;
3354 param->annotation_handles = annotation_handles;
3356 return D3D_OK;
3358 err_out:
3360 if (annotation_handles)
3362 for (i = 0; i < param->annotation_count; ++i)
3364 free_parameter(annotation_handles[i], FALSE, FALSE);
3366 HeapFree(GetProcessHeap(), 0, annotation_handles);
3369 return hr;
3372 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr)
3374 DWORD offset;
3375 HRESULT hr;
3376 unsigned int i;
3377 D3DXHANDLE *annotation_handles = NULL;
3378 char *name = NULL;
3380 read_dword(ptr, &offset);
3381 TRACE("Pass name offset: %#x\n", offset);
3382 hr = d3dx9_parse_name(&name, data + offset);
3383 if (hr != D3D_OK)
3385 WARN("Failed to parse name\n");
3386 goto err_out;
3389 read_dword(ptr, &pass->annotation_count);
3390 TRACE("Annotation count: %u\n", pass->annotation_count);
3392 read_dword(ptr, &pass->state_count);
3393 TRACE("State count: %u\n", pass->state_count);
3395 if (pass->annotation_count)
3397 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
3398 if (!annotation_handles)
3400 ERR("Out of memory\n");
3401 hr = E_OUTOFMEMORY;
3402 goto err_out;
3405 for (i = 0; i < pass->annotation_count; ++i)
3407 struct d3dx_parameter *annotation;
3409 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3410 if (!annotation)
3412 ERR("Out of memory\n");
3413 hr = E_OUTOFMEMORY;
3414 goto err_out;
3417 annotation_handles[i] = get_parameter_handle(annotation);
3418 annotation->base = pass->base;
3420 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3421 if (hr != D3D_OK)
3423 WARN("Failed to parse annotations\n");
3424 goto err_out;
3429 if (pass->state_count)
3431 for (i = 0; i < pass->state_count; ++i)
3433 skip_dword_unknown(ptr, 4);
3437 pass->name = name;
3438 pass->annotation_handles = annotation_handles;
3440 return D3D_OK;
3442 err_out:
3444 if (annotation_handles)
3446 for (i = 0; i < pass->annotation_count; ++i)
3448 free_parameter(annotation_handles[i], FALSE, FALSE);
3450 HeapFree(GetProcessHeap(), 0, annotation_handles);
3453 HeapFree(GetProcessHeap(), 0, name);
3455 return hr;
3458 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr)
3460 DWORD offset;
3461 HRESULT hr;
3462 unsigned int i;
3463 D3DXHANDLE *annotation_handles = NULL;
3464 D3DXHANDLE *pass_handles = NULL;
3465 char *name = NULL;
3467 read_dword(ptr, &offset);
3468 TRACE("Technique name offset: %#x\n", offset);
3469 hr = d3dx9_parse_name(&name, data + offset);
3470 if (hr != D3D_OK)
3472 WARN("Failed to parse name\n");
3473 goto err_out;
3476 read_dword(ptr, &technique->annotation_count);
3477 TRACE("Annotation count: %u\n", technique->annotation_count);
3479 read_dword(ptr, &technique->pass_count);
3480 TRACE("Pass count: %u\n", technique->pass_count);
3482 if (technique->annotation_count)
3484 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
3485 if (!annotation_handles)
3487 ERR("Out of memory\n");
3488 hr = E_OUTOFMEMORY;
3489 goto err_out;
3492 for (i = 0; i < technique->annotation_count; ++i)
3494 struct d3dx_parameter *annotation;
3496 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3497 if (!annotation)
3499 ERR("Out of memory\n");
3500 hr = E_OUTOFMEMORY;
3501 goto err_out;
3504 annotation_handles[i] = get_parameter_handle(annotation);
3505 annotation->base = technique->base;
3507 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3508 if (hr != D3D_OK)
3510 WARN("Failed to parse annotations\n");
3511 goto err_out;
3516 if (technique->pass_count)
3518 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
3519 if (!pass_handles)
3521 ERR("Out of memory\n");
3522 hr = E_OUTOFMEMORY;
3523 goto err_out;
3526 for (i = 0; i < technique->pass_count; ++i)
3528 struct d3dx_pass *pass;
3530 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
3531 if (!pass)
3533 ERR("Out of memory\n");
3534 hr = E_OUTOFMEMORY;
3535 goto err_out;
3538 pass_handles[i] = get_pass_handle(pass);
3539 pass->base = technique->base;
3541 hr = d3dx9_parse_effect_pass(pass, data, ptr);
3542 if (hr != D3D_OK)
3544 WARN("Failed to parse passes\n");
3545 goto err_out;
3550 technique->name = name;
3551 technique->pass_handles = pass_handles;
3552 technique->annotation_handles = annotation_handles;
3554 return D3D_OK;
3556 err_out:
3558 if (pass_handles)
3560 for (i = 0; i < technique->pass_count; ++i)
3562 free_pass(pass_handles[i]);
3564 HeapFree(GetProcessHeap(), 0, pass_handles);
3567 if (annotation_handles)
3569 for (i = 0; i < technique->annotation_count; ++i)
3571 free_parameter(annotation_handles[i], FALSE, FALSE);
3573 HeapFree(GetProcessHeap(), 0, annotation_handles);
3576 HeapFree(GetProcessHeap(), 0, name);
3578 return hr;
3581 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
3583 const char *ptr = data + start;
3584 D3DXHANDLE *parameter_handles = NULL;
3585 D3DXHANDLE *technique_handles = NULL;
3586 HRESULT hr;
3587 unsigned int i;
3589 read_dword(&ptr, &base->parameter_count);
3590 TRACE("Parameter count: %u\n", base->parameter_count);
3592 read_dword(&ptr, &base->technique_count);
3593 TRACE("Technique count: %u\n", base->technique_count);
3595 skip_dword_unknown(&ptr, 2);
3597 if (base->parameter_count)
3599 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
3600 if (!parameter_handles)
3602 ERR("Out of memory\n");
3603 hr = E_OUTOFMEMORY;
3604 goto err_out;
3607 for (i = 0; i < base->parameter_count; ++i)
3609 struct d3dx_parameter *parameter;
3611 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
3612 if (!parameter)
3614 ERR("Out of memory\n");
3615 hr = E_OUTOFMEMORY;
3616 goto err_out;
3619 parameter_handles[i] = get_parameter_handle(parameter);
3620 parameter->base = base;
3622 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
3623 if (hr != D3D_OK)
3625 WARN("Failed to parse parameter\n");
3626 goto err_out;
3631 if (base->technique_count)
3633 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
3634 if (!technique_handles)
3636 ERR("Out of memory\n");
3637 hr = E_OUTOFMEMORY;
3638 goto err_out;
3641 for (i = 0; i < base->technique_count; ++i)
3643 struct d3dx_technique *technique;
3645 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
3646 if (!technique)
3648 ERR("Out of memory\n");
3649 hr = E_OUTOFMEMORY;
3650 goto err_out;
3653 technique_handles[i] = get_technique_handle(technique);
3654 technique->base = base;
3656 hr = d3dx9_parse_effect_technique(technique, data, &ptr);
3657 if (hr != D3D_OK)
3659 WARN("Failed to parse technique\n");
3660 goto err_out;
3665 base->technique_handles = technique_handles;
3666 base->parameter_handles = parameter_handles;
3668 return D3D_OK;
3670 err_out:
3672 if (technique_handles)
3674 for (i = 0; i < base->technique_count; ++i)
3676 free_technique(technique_handles[i]);
3678 HeapFree(GetProcessHeap(), 0, technique_handles);
3681 if (parameter_handles)
3683 for (i = 0; i < base->parameter_count; ++i)
3685 free_parameter(parameter_handles[i], FALSE, FALSE);
3687 HeapFree(GetProcessHeap(), 0, parameter_handles);
3690 return hr;
3693 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
3694 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
3696 DWORD tag, offset;
3697 const char *ptr = data;
3698 HRESULT hr;
3700 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
3702 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
3703 base->ref = 1;
3704 base->effect = effect;
3706 read_dword(&ptr, &tag);
3707 TRACE("Tag: %x\n", tag);
3709 if (tag != d3dx9_effect_version(9, 1))
3711 /* todo: compile hlsl ascii code */
3712 FIXME("HLSL ascii effects not supported, yet\n");
3714 /* Show the start of the shader for debugging info. */
3715 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
3717 else
3719 read_dword(&ptr, &offset);
3720 TRACE("Offset: %x\n", offset);
3722 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
3723 if (hr != D3D_OK)
3725 FIXME("Failed to parse effect.\n");
3726 return hr;
3730 return D3D_OK;
3733 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
3734 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
3736 HRESULT hr;
3737 struct ID3DXBaseEffectImpl *object = NULL;
3739 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
3741 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
3742 effect->ref = 1;
3744 if (pool) pool->lpVtbl->AddRef(pool);
3745 effect->pool = pool;
3747 IDirect3DDevice9_AddRef(device);
3748 effect->device = device;
3750 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3751 if (!object)
3753 ERR("Out of memory\n");
3754 hr = E_OUTOFMEMORY;
3755 goto err_out;
3758 hr = d3dx9_base_effect_init(object, data, data_size, effect);
3759 if (hr != D3D_OK)
3761 FIXME("Failed to parse effect.\n");
3762 goto err_out;
3765 effect->base_effect = &object->ID3DXBaseEffect_iface;
3767 return D3D_OK;
3769 err_out:
3771 HeapFree(GetProcessHeap(), 0, object);
3772 free_effect(effect);
3774 return hr;
3777 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
3778 LPCVOID srcdata,
3779 UINT srcdatalen,
3780 CONST D3DXMACRO* defines,
3781 LPD3DXINCLUDE include,
3782 LPCSTR skip_constants,
3783 DWORD flags,
3784 LPD3DXEFFECTPOOL pool,
3785 LPD3DXEFFECT* effect,
3786 LPD3DXBUFFER* compilation_errors)
3788 struct ID3DXEffectImpl *object;
3789 HRESULT hr;
3791 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
3792 skip_constants, flags, pool, effect, compilation_errors);
3794 if (!device || !srcdata)
3795 return D3DERR_INVALIDCALL;
3797 if (!srcdatalen)
3798 return E_FAIL;
3800 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
3801 if (!effect)
3802 return D3D_OK;
3804 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3805 if (!object)
3807 ERR("Out of memory\n");
3808 return E_OUTOFMEMORY;
3811 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
3812 if (FAILED(hr))
3814 WARN("Failed to initialize shader reflection\n");
3815 HeapFree(GetProcessHeap(), 0, object);
3816 return hr;
3819 *effect = &object->ID3DXEffect_iface;
3821 TRACE("Created ID3DXEffect %p\n", object);
3823 return D3D_OK;
3826 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
3827 LPCVOID srcdata,
3828 UINT srcdatalen,
3829 CONST D3DXMACRO* defines,
3830 LPD3DXINCLUDE include,
3831 DWORD flags,
3832 LPD3DXEFFECTPOOL pool,
3833 LPD3DXEFFECT* effect,
3834 LPD3DXBUFFER* compilation_errors)
3836 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
3837 include, flags, pool, effect, compilation_errors);
3839 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
3842 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
3844 HRESULT hr;
3845 struct ID3DXBaseEffectImpl *object = NULL;
3847 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
3849 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
3850 compiler->ref = 1;
3852 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3853 if (!object)
3855 ERR("Out of memory\n");
3856 hr = E_OUTOFMEMORY;
3857 goto err_out;
3860 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
3861 if (hr != D3D_OK)
3863 FIXME("Failed to parse effect.\n");
3864 goto err_out;
3867 compiler->base_effect = &object->ID3DXBaseEffect_iface;
3869 return D3D_OK;
3871 err_out:
3873 HeapFree(GetProcessHeap(), 0, object);
3874 free_effect_compiler(compiler);
3876 return hr;
3879 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
3880 UINT srcdatalen,
3881 CONST D3DXMACRO *defines,
3882 LPD3DXINCLUDE include,
3883 DWORD flags,
3884 LPD3DXEFFECTCOMPILER *compiler,
3885 LPD3DXBUFFER *parse_errors)
3887 struct ID3DXEffectCompilerImpl *object;
3888 HRESULT hr;
3890 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
3891 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
3893 if (!srcdata || !compiler)
3895 WARN("Invalid arguments supplied\n");
3896 return D3DERR_INVALIDCALL;
3899 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3900 if (!object)
3902 ERR("Out of memory\n");
3903 return E_OUTOFMEMORY;
3906 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
3907 if (FAILED(hr))
3909 WARN("Failed to initialize effect compiler\n");
3910 HeapFree(GetProcessHeap(), 0, object);
3911 return hr;
3914 *compiler = &object->ID3DXEffectCompiler_iface;
3916 TRACE("Created ID3DXEffectCompiler %p\n", object);
3918 return D3D_OK;
3921 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
3923 struct ID3DXEffectPoolImpl
3925 ID3DXEffectPool ID3DXEffectPool_iface;
3926 LONG ref;
3929 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
3931 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
3934 /*** IUnknown methods ***/
3935 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
3937 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3939 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
3941 if (IsEqualGUID(riid, &IID_IUnknown) ||
3942 IsEqualGUID(riid, &IID_ID3DXEffectPool))
3944 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
3945 *object = This;
3946 return S_OK;
3949 WARN("Interface %s not found\n", debugstr_guid(riid));
3951 return E_NOINTERFACE;
3954 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
3956 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3958 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
3960 return InterlockedIncrement(&This->ref);
3963 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
3965 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
3966 ULONG ref = InterlockedDecrement(&This->ref);
3968 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
3970 if (!ref)
3971 HeapFree(GetProcessHeap(), 0, This);
3973 return ref;
3976 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
3978 /*** IUnknown methods ***/
3979 ID3DXEffectPoolImpl_QueryInterface,
3980 ID3DXEffectPoolImpl_AddRef,
3981 ID3DXEffectPoolImpl_Release
3984 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
3986 struct ID3DXEffectPoolImpl *object;
3988 TRACE("(%p)\n", pool);
3990 if (!pool)
3991 return D3DERR_INVALIDCALL;
3993 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
3994 if (!object)
3996 ERR("Out of memory\n");
3997 return E_OUTOFMEMORY;
4000 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
4001 object->ref = 1;
4003 *pool = &object->ID3DXEffectPool_iface;
4005 return S_OK;
4008 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4009 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4010 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4012 LPVOID buffer;
4013 HRESULT ret;
4014 DWORD size;
4016 TRACE("(%s): relay\n", debugstr_w(srcfile));
4018 if (!device || !srcfile || !defines)
4019 return D3DERR_INVALIDCALL;
4021 ret = map_view_of_file(srcfile, &buffer, &size);
4023 if (FAILED(ret))
4024 return D3DXERR_INVALIDDATA;
4026 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4027 UnmapViewOfFile(buffer);
4029 return ret;
4032 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4033 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4034 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4036 LPWSTR srcfileW;
4037 HRESULT ret;
4038 DWORD len;
4040 TRACE("(void): relay\n");
4042 if (!srcfile || !defines)
4043 return D3DERR_INVALIDCALL;
4045 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4046 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4047 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4049 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4050 HeapFree(GetProcessHeap(), 0, srcfileW);
4052 return ret;
4055 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4056 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4057 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4059 TRACE("(void): relay\n");
4060 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4063 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4064 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4065 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4067 TRACE("(void): relay\n");
4068 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4071 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4072 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4073 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4075 HRSRC resinfo;
4077 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4079 if (!device || !defines)
4080 return D3DERR_INVALIDCALL;
4082 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4084 if (resinfo)
4086 LPVOID buffer;
4087 HRESULT ret;
4088 DWORD size;
4090 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4092 if (FAILED(ret))
4093 return D3DXERR_INVALIDDATA;
4095 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4098 return D3DXERR_INVALIDDATA;
4101 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4102 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4103 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4105 HRSRC resinfo;
4107 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4109 if (!device || !defines)
4110 return D3DERR_INVALIDCALL;
4112 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4114 if (resinfo)
4116 LPVOID buffer;
4117 HRESULT ret;
4118 DWORD size;
4120 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4122 if (FAILED(ret))
4123 return D3DXERR_INVALIDDATA;
4125 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4128 return D3DXERR_INVALIDDATA;
4131 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4132 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4133 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4135 TRACE("(void): relay\n");
4136 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4139 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4140 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4141 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4143 TRACE("(void): relay\n");
4144 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4147 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4148 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4150 LPVOID buffer;
4151 HRESULT ret;
4152 DWORD size;
4154 TRACE("(%s): relay\n", debugstr_w(srcfile));
4156 if (!srcfile || !defines)
4157 return D3DERR_INVALIDCALL;
4159 ret = map_view_of_file(srcfile, &buffer, &size);
4161 if (FAILED(ret))
4162 return D3DXERR_INVALIDDATA;
4164 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4165 UnmapViewOfFile(buffer);
4167 return ret;
4170 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4171 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4173 LPWSTR srcfileW;
4174 HRESULT ret;
4175 DWORD len;
4177 TRACE("(void): relay\n");
4179 if (!srcfile || !defines)
4180 return D3DERR_INVALIDCALL;
4182 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4183 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4184 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4186 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
4187 HeapFree(GetProcessHeap(), 0, srcfileW);
4189 return ret;
4192 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
4193 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4195 HRSRC resinfo;
4197 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4199 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4201 if (resinfo)
4203 LPVOID buffer;
4204 HRESULT ret;
4205 DWORD size;
4207 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4209 if (FAILED(ret))
4210 return D3DXERR_INVALIDDATA;
4212 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4215 return D3DXERR_INVALIDDATA;
4218 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
4219 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4221 HRSRC resinfo;
4223 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4225 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4227 if (resinfo)
4229 LPVOID buffer;
4230 HRESULT ret;
4231 DWORD size;
4233 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4235 if (FAILED(ret))
4236 return D3DXERR_INVALIDDATA;
4238 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4241 return D3DXERR_INVALIDDATA;