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
20 #include "wine/port.h"
21 #include "wine/debug.h"
22 #include "wine/unicode.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;
35 struct ID3DXBaseEffectImpl *base;
40 D3DXPARAMETER_CLASS class;
41 D3DXPARAMETER_TYPE type;
45 UINT annotation_count;
50 D3DXHANDLE *annotation_handles;
51 D3DXHANDLE *member_handles;
56 struct ID3DXBaseEffectImpl *base;
60 UINT annotation_count;
62 D3DXHANDLE *annotation_handles;
67 struct ID3DXBaseEffectImpl *base;
71 UINT annotation_count;
73 D3DXHANDLE *annotation_handles;
74 D3DXHANDLE *pass_handles;
77 struct ID3DXBaseEffectImpl
79 ID3DXBaseEffect ID3DXBaseEffect_iface;
82 struct ID3DXEffectImpl *effect;
88 D3DXHANDLE *parameter_handles;
89 D3DXHANDLE *technique_handles;
93 struct ID3DXEffectImpl
95 ID3DXEffect ID3DXEffect_iface;
98 LPD3DXEFFECTSTATEMANAGER manager;
99 LPDIRECT3DDEVICE9 device;
100 LPD3DXEFFECTPOOL pool;
102 ID3DXBaseEffect *base_effect;
105 struct ID3DXEffectCompilerImpl
107 ID3DXEffectCompiler ID3DXEffectCompiler_iface;
110 ID3DXBaseEffect *base_effect;
113 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
114 struct d3dx_parameter *parameter, LPCSTR name);
115 static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl *base,
116 struct d3dx_parameter *parameter, LPCSTR name);
118 static inline void read_dword(const char **ptr, DWORD *d)
120 memcpy(d, *ptr, sizeof(*d));
124 static void skip_dword_unknown(const char **ptr, unsigned int count)
129 FIXME("Skipping %u unknown DWORDs:\n", count);
130 for (i = 0; i < count; ++i)
133 FIXME("\t0x%08x\n", d);
137 static inline struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle)
139 return (struct d3dx_parameter *) handle;
142 static inline struct d3dx_pass *get_pass_struct(D3DXHANDLE handle)
144 return (struct d3dx_pass *) handle;
147 static inline struct d3dx_technique *get_technique_struct(D3DXHANDLE handle)
149 return (struct d3dx_technique *) handle;
152 static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
154 return (D3DXHANDLE) parameter;
157 static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique)
159 return (D3DXHANDLE) technique;
162 static inline D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
164 return (D3DXHANDLE) pass;
167 static struct d3dx_technique *is_valid_technique(struct ID3DXBaseEffectImpl *base, D3DXHANDLE technique)
171 for (i = 0; i < base->technique_count; ++i)
173 if (base->technique_handles[i] == technique)
175 return get_technique_struct(technique);
182 static struct d3dx_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
186 for (i = 0; i < base->technique_count; ++i)
188 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
190 for (k = 0; k < technique->pass_count; ++k)
192 if (technique->pass_handles[k] == pass)
194 return get_pass_struct(pass);
202 static struct d3dx_parameter *is_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter)
204 unsigned int i, count;
205 struct d3dx_parameter *p;
207 for (i = 0; i < param->annotation_count; ++i)
209 if (param->annotation_handles[i] == parameter)
211 return get_parameter_struct(parameter);
214 p = is_valid_sub_parameter(get_parameter_struct(param->annotation_handles[i]), parameter);
218 if (param->element_count) count = param->element_count;
219 else count = param->member_count;
221 for (i = 0; i < count; ++i)
223 if (param->member_handles[i] == parameter)
225 return get_parameter_struct(parameter);
228 p = is_valid_sub_parameter(get_parameter_struct(param->member_handles[i]), parameter);
235 static struct d3dx_parameter *is_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
237 unsigned int i, k, m;
238 struct d3dx_parameter *p;
240 for (i = 0; i < base->parameter_count; ++i)
242 if (base->parameter_handles[i] == parameter)
244 return get_parameter_struct(parameter);
247 p = is_valid_sub_parameter(get_parameter_struct(base->parameter_handles[i]), parameter);
251 for (i = 0; i < base->technique_count; ++i)
253 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
255 for (k = 0; k < technique->pass_count; ++k)
257 struct d3dx_pass *pass = get_pass_struct(technique->pass_handles[k]);
259 for (m = 0; m < pass->annotation_count; ++m)
261 if (pass->annotation_handles[i] == parameter)
263 return get_parameter_struct(parameter);
266 p = is_valid_sub_parameter(get_parameter_struct(pass->annotation_handles[m]), parameter);
271 for (k = 0; k < technique->annotation_count; ++k)
273 if (technique->annotation_handles[k] == parameter)
275 return get_parameter_struct(parameter);
278 p = is_valid_sub_parameter(get_parameter_struct(technique->annotation_handles[k]), parameter);
286 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
289 struct d3dx_parameter *param = get_parameter_struct(handle);
291 TRACE("Free parameter %p, child %s\n", param, child ? "yes" : "no");
298 if (param->annotation_handles)
300 for (i = 0; i < param->annotation_count; ++i)
302 free_parameter(param->annotation_handles[i], FALSE, FALSE);
304 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
307 if (param->member_handles)
311 if (param->element_count) count = param->element_count;
312 else count = param->member_count;
314 for (i = 0; i < count; ++i)
316 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
318 HeapFree(GetProcessHeap(), 0, param->member_handles);
321 if (param->class == D3DXPC_OBJECT && !param->element_count)
326 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
329 case D3DXPT_PIXELSHADER:
330 case D3DXPT_VERTEXSHADER:
331 if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data);
335 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
342 HeapFree(GetProcessHeap(), 0, param->data);
345 /* only the parent has to release name and semantic */
348 HeapFree(GetProcessHeap(), 0, param->name);
349 HeapFree(GetProcessHeap(), 0, param->semantic);
352 HeapFree(GetProcessHeap(), 0, param);
355 static void free_pass(D3DXHANDLE handle)
358 struct d3dx_pass *pass = get_pass_struct(handle);
360 TRACE("Free pass %p\n", pass);
367 if (pass->annotation_handles)
369 for (i = 0; i < pass->annotation_count; ++i)
371 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
373 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
376 HeapFree(GetProcessHeap(), 0, pass->name);
377 HeapFree(GetProcessHeap(), 0, pass);
380 static void free_technique(D3DXHANDLE handle)
383 struct d3dx_technique *technique = get_technique_struct(handle);
385 TRACE("Free technique %p\n", technique);
392 if (technique->annotation_handles)
394 for (i = 0; i < technique->annotation_count; ++i)
396 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
398 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
401 if (technique->pass_handles)
403 for (i = 0; i < technique->pass_count; ++i)
405 free_pass(technique->pass_handles[i]);
407 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
410 HeapFree(GetProcessHeap(), 0, technique->name);
411 HeapFree(GetProcessHeap(), 0, technique);
414 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
418 TRACE("Free base effect %p\n", base);
420 if (base->parameter_handles)
422 for (i = 0; i < base->parameter_count; ++i)
424 free_parameter(base->parameter_handles[i], FALSE, FALSE);
426 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
429 if (base->technique_handles)
431 for (i = 0; i < base->technique_count; ++i)
433 free_technique(base->technique_handles[i]);
435 HeapFree(GetProcessHeap(), 0, base->technique_handles);
439 static void free_effect(struct ID3DXEffectImpl *effect)
441 TRACE("Free effect %p\n", effect);
443 if (effect->base_effect)
445 effect->base_effect->lpVtbl->Release(effect->base_effect);
450 effect->pool->lpVtbl->Release(effect->pool);
455 IUnknown_Release(effect->manager);
458 IDirect3DDevice9_Release(effect->device);
461 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
463 TRACE("Free effect compiler %p\n", compiler);
465 if (compiler->base_effect)
467 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
471 static INT get_int(D3DXPARAMETER_TYPE type, void *data)
491 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type));
498 inline static FLOAT get_float(D3DXPARAMETER_TYPE type, void *data)
518 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type));
525 static inline BOOL get_bool(void *data)
527 return (*(DWORD *)data) ? TRUE : FALSE;
530 static struct d3dx_parameter *get_parameter_element_by_name(struct ID3DXBaseEffectImpl *base,
531 struct d3dx_parameter *parameter, LPCSTR name)
534 struct d3dx_parameter *temp_parameter;
537 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
539 if (!name || !*name) return parameter;
541 element = atoi(name);
542 part = strchr(name, ']') + 1;
544 if (parameter->element_count > element)
546 temp_parameter = get_parameter_struct(parameter->member_handles[element]);
551 return get_parameter_by_name(base, temp_parameter, part);
554 return get_parameter_annotation_by_name(base, temp_parameter, part);
557 TRACE("Returning parameter %p\n", temp_parameter);
558 return temp_parameter;
561 FIXME("Unhandled case \"%c\"\n", *--part);
566 TRACE("Parameter not found\n");
570 static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl *base,
571 struct d3dx_parameter *parameter, LPCSTR name)
574 struct d3dx_parameter *temp_parameter;
577 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
579 if (!name || !*name) return parameter;
581 length = strcspn( name, "[.@" );
582 part = name + length;
584 for (i = 0; i < parameter->annotation_count; ++i)
586 temp_parameter = get_parameter_struct(parameter->annotation_handles[i]);
588 if (!strcmp(temp_parameter->name, name))
590 TRACE("Returning parameter %p\n", temp_parameter);
591 return temp_parameter;
593 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
598 return get_parameter_by_name(base, temp_parameter, part);
601 return get_parameter_element_by_name(base, temp_parameter, part);
604 FIXME("Unhandled case \"%c\"\n", *--part);
610 TRACE("Parameter not found\n");
614 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
615 struct d3dx_parameter *parameter, LPCSTR name)
617 UINT i, count, length;
618 struct d3dx_parameter *temp_parameter;
622 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
624 if (!name || !*name) return parameter;
628 count = base->parameter_count;
629 handles = base->parameter_handles;
633 count = parameter->member_count;
634 handles = parameter->member_handles;
637 length = strcspn( name, "[.@" );
638 part = name + length;
640 for (i = 0; i < count; i++)
642 temp_parameter = get_parameter_struct(handles[i]);
644 if (!strcmp(temp_parameter->name, name))
646 TRACE("Returning parameter %p\n", temp_parameter);
647 return temp_parameter;
649 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
654 return get_parameter_by_name(base, temp_parameter, part);
657 return get_parameter_annotation_by_name(base, temp_parameter, part);
660 return get_parameter_element_by_name(base, temp_parameter, part);
663 FIXME("Unhandled case \"%c\"\n", *--part);
669 TRACE("Parameter not found\n");
673 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
675 return (0xfeff0000 | ((major) << 8) | (minor));
678 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
680 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
683 /*** IUnknown methods ***/
684 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
686 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
688 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
690 if (IsEqualGUID(riid, &IID_IUnknown) ||
691 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
693 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
698 ERR("Interface %s not found\n", debugstr_guid(riid));
700 return E_NOINTERFACE;
703 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
705 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
707 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
709 return InterlockedIncrement(&This->ref);
712 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
714 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
715 ULONG ref = InterlockedDecrement(&This->ref);
717 TRACE("iface %p: Release from %u\n", iface, ref + 1);
721 free_base_effect(This);
722 HeapFree(GetProcessHeap(), 0, This);
728 /*** ID3DXBaseEffect methods ***/
729 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
731 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
733 FIXME("iface %p, desc %p partial stub\n", This, desc);
737 WARN("Invalid argument specified.\n");
738 return D3DERR_INVALIDCALL;
741 /* Todo: add creator and function count */
742 desc->Creator = NULL;
744 desc->Parameters = This->parameter_count;
745 desc->Techniques = This->technique_count;
750 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
752 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
753 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
755 TRACE("iface %p, parameter %p, desc %p\n", This, parameter, desc);
757 if (!param) param = get_parameter_struct(iface->lpVtbl->GetParameterByName(iface, NULL, parameter));
761 WARN("Invalid argument specified.\n");
762 return D3DERR_INVALIDCALL;
765 desc->Name = param->name;
766 desc->Semantic = param->semantic;
767 desc->Class = param->class;
768 desc->Type = param->type;
769 desc->Rows = param->rows;
770 desc->Columns = param->columns;
771 desc->Elements = param->element_count;
772 desc->Annotations = param->annotation_count;
773 desc->StructMembers = param->member_count;
774 desc->Flags = param->flags;
775 desc->Bytes = param->bytes;
780 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
782 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
783 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
785 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
789 WARN("Invalid argument specified.\n");
790 return D3DERR_INVALIDCALL;
793 desc->Name = tech->name;
794 desc->Passes = tech->pass_count;
795 desc->Annotations = tech->annotation_count;
800 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
802 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
803 struct d3dx_pass *p = is_valid_pass(This, pass);
805 TRACE("iface %p, pass %p, desc %p\n", This, pass, desc);
809 WARN("Invalid argument specified.\n");
810 return D3DERR_INVALIDCALL;
813 desc->Name = p->name;
814 desc->Annotations = p->annotation_count;
816 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
817 desc->pVertexShaderFunction = NULL;
818 desc->pVertexShaderFunction = NULL;
823 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
825 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
827 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
832 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
834 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
835 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
837 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
839 if (!param) param = get_parameter_by_name(This, NULL, parameter);
843 if (index < This->parameter_count)
845 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
846 return This->parameter_handles[index];
851 if (param && !param->element_count && index < param->member_count)
853 TRACE("Returning parameter %p\n", param->member_handles[index]);
854 return param->member_handles[index];
858 WARN("Invalid argument specified.\n");
863 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
865 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
866 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
869 TRACE("iface %p, parameter %p, name %s\n", This, parameter, debugstr_a(name));
871 if (!param) param = get_parameter_by_name(This, NULL, parameter);
875 handle = get_parameter_handle(param);
876 TRACE("Returning parameter %p\n", handle);
880 handle = get_parameter_handle(get_parameter_by_name(This, param, name));
881 TRACE("Returning parameter %p\n", handle);
886 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
888 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
889 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
890 struct d3dx_parameter *temp_param;
893 TRACE("iface %p, parameter %p, semantic %s\n", This, parameter, debugstr_a(semantic));
895 if (!param) param = get_parameter_by_name(This, NULL, parameter);
899 for (i = 0; i < This->parameter_count; ++i)
901 temp_param = get_parameter_struct(This->parameter_handles[i]);
903 if (!temp_param->semantic)
907 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
908 return This->parameter_handles[i];
913 if (!strcasecmp(temp_param->semantic, semantic))
915 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
916 return This->parameter_handles[i];
922 for (i = 0; i < param->member_count; ++i)
924 temp_param = get_parameter_struct(param->member_handles[i]);
926 if (!temp_param->semantic)
930 TRACE("Returning parameter %p\n", param->member_handles[i]);
931 return param->member_handles[i];
936 if (!strcasecmp(temp_param->semantic, semantic))
938 TRACE("Returning parameter %p\n", param->member_handles[i]);
939 return param->member_handles[i];
944 WARN("Invalid argument specified\n");
949 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
951 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
952 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
954 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
956 if (!param) param = get_parameter_by_name(This, NULL, parameter);
960 if (index < This->parameter_count)
962 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
963 return This->parameter_handles[index];
968 if (index < param->element_count)
970 TRACE("Returning parameter %p\n", param->member_handles[index]);
971 return param->member_handles[index];
975 WARN("Invalid argument specified\n");
980 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
982 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
984 TRACE("iface %p, index %u\n", This, index);
986 if (index >= This->technique_count)
988 WARN("Invalid argument specified.\n");
992 TRACE("Returning technique %p\n", This->technique_handles[index]);
994 return This->technique_handles[index];
997 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
999 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1002 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
1006 WARN("Invalid argument specified.\n");
1010 for (i = 0; i < This->technique_count; ++i)
1012 struct d3dx_technique *tech = get_technique_struct(This->technique_handles[i]);
1014 if (!strcmp(tech->name, name))
1016 TRACE("Returning technique %p\n", This->technique_handles[i]);
1017 return This->technique_handles[i];
1021 WARN("Invalid argument specified.\n");
1026 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
1028 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1029 struct d3dx_technique *tech = is_valid_technique(This, technique);
1031 TRACE("iface %p, technique %p, index %u\n", This, technique, index);
1033 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
1035 if (tech && index < tech->pass_count)
1037 TRACE("Returning pass %p\n", tech->pass_handles[index]);
1038 return tech->pass_handles[index];
1041 WARN("Invalid argument specified.\n");
1046 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
1048 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1049 struct d3dx_technique *tech = is_valid_technique(This, technique);
1051 TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
1053 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
1059 for (i = 0; i < tech->pass_count; ++i)
1061 struct d3dx_pass *pass = get_pass_struct(tech->pass_handles[i]);
1063 if (!strcmp(pass->name, name))
1065 TRACE("Returning pass %p\n", tech->pass_handles[i]);
1066 return tech->pass_handles[i];
1071 WARN("Invalid argument specified.\n");
1076 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
1078 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1080 FIXME("iface %p, index %u stub\n", This, index);
1085 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
1087 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1089 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
1094 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
1096 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1097 struct d3dx_parameter *param = is_valid_parameter(This, object);
1098 struct d3dx_pass *pass = is_valid_pass(This, object);
1099 struct d3dx_technique *technique = is_valid_technique(This, object);
1100 UINT annotation_count = 0;
1101 D3DXHANDLE *annotation_handles = NULL;
1103 FIXME("iface %p, object %p, index %u partial stub\n", This, object, index);
1107 annotation_count = pass->annotation_count;
1108 annotation_handles = pass->annotation_handles;
1112 annotation_count = technique->annotation_count;
1113 annotation_handles = technique->annotation_handles;
1117 if (!param) param = get_parameter_by_name(This, NULL, object);
1121 annotation_count = param->annotation_count;
1122 annotation_handles = param->annotation_handles;
1125 /* Todo: add funcs */
1127 if (index < annotation_count)
1129 TRACE("Returning parameter %p\n", annotation_handles[index]);
1130 return annotation_handles[index];
1133 WARN("Invalid argument specified\n");
1138 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
1140 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1141 struct d3dx_parameter *param = is_valid_parameter(This, object);
1142 struct d3dx_pass *pass = is_valid_pass(This, object);
1143 struct d3dx_technique *technique = is_valid_technique(This, object);
1144 UINT annotation_count = 0, i;
1145 D3DXHANDLE *annotation_handles = NULL;
1147 FIXME("iface %p, object %p, name %s partial stub\n", This, object, debugstr_a(name));
1151 WARN("Invalid argument specified\n");
1157 annotation_count = pass->annotation_count;
1158 annotation_handles = pass->annotation_handles;
1162 annotation_count = technique->annotation_count;
1163 annotation_handles = technique->annotation_handles;
1167 if (!param) param = get_parameter_by_name(This, NULL, object);
1171 annotation_count = param->annotation_count;
1172 annotation_handles = param->annotation_handles;
1175 /* Todo: add funcs */
1177 for (i = 0; i < annotation_count; i++)
1179 struct d3dx_parameter *anno = get_parameter_struct(annotation_handles[i]);
1181 if (!strcmp(anno->name, name))
1183 TRACE("Returning parameter %p\n", anno);
1184 return get_parameter_handle(anno);
1188 WARN("Invalid argument specified\n");
1193 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1195 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1197 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
1202 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1204 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1205 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1207 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1209 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1211 if (data && param && param->data && param->bytes <= bytes)
1213 if (param->type == D3DXPT_VERTEXSHADER || param->type == D3DXPT_PIXELSHADER)
1217 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
1219 IUnknown *unk = ((IUnknown **)param->data)[i];
1220 if (unk) IUnknown_AddRef(unk);
1221 ((IUnknown **)data)[i] = unk;
1226 TRACE("Copy %u bytes\n", param->bytes);
1227 memcpy(data, param->data, param->bytes);
1232 WARN("Invalid argument specified\n");
1234 return D3DERR_INVALIDCALL;
1237 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
1239 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1241 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
1246 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
1248 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1249 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1251 TRACE("iface %p, parameter %p, b %p\n", This, parameter, b);
1253 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1255 if (b && param && !param->element_count && param->class == D3DXPC_SCALAR)
1257 *b = get_bool(param->data);
1258 TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
1262 WARN("Invalid argument specified\n");
1264 return D3DERR_INVALIDCALL;
1267 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1269 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1271 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1276 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1278 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1280 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1285 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
1287 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1289 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
1294 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1296 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1297 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1299 TRACE("iface %p, parameter %p, n %p\n", This, parameter, n);
1301 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1303 if (n && param && !param->element_count && param->class == D3DXPC_SCALAR)
1305 *n = get_int(param->type, param->data);
1306 TRACE("Returning %i\n", *n);
1310 WARN("Invalid argument specified\n");
1312 return D3DERR_INVALIDCALL;
1315 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1317 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1319 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1324 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1326 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1328 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1333 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1335 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1337 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
1342 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1344 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1345 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1347 TRACE("iface %p, parameter %p, f %p\n", This, parameter, f);
1349 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1351 if (f && param && !param->element_count && param->class == D3DXPC_SCALAR)
1354 TRACE("Returning %f\n", *f);
1358 WARN("Invalid argument specified\n");
1360 return D3DERR_INVALIDCALL;
1363 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1365 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1367 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1372 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1374 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1376 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1381 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
1383 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1385 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1390 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1392 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1394 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1399 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1401 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1403 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1408 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1410 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1412 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1417 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1419 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1421 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1426 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1428 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1430 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1435 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1437 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1439 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1444 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1446 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1448 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1453 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1455 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1457 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1462 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1464 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1466 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1471 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1473 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1475 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1480 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1482 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1484 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1489 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1491 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1493 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1498 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1500 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1502 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1507 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1509 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1511 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1516 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1518 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1520 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1525 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1527 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1529 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1534 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1536 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1537 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1539 TRACE("iface %p, parameter %p, string %p\n", This, parameter, string);
1541 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1543 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
1545 *string = *(LPCSTR *)param->data;
1546 TRACE("Returning %s\n", debugstr_a(*string));
1550 WARN("Invalid argument specified\n");
1552 return D3DERR_INVALIDCALL;
1555 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1557 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1559 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1564 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1566 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1568 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1573 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1575 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1576 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1578 TRACE("iface %p, parameter %p, pshader %p\n", This, parameter, pshader);
1580 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1582 if (pshader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
1584 *pshader = *(LPDIRECT3DPIXELSHADER9 *)param->data;
1585 if (*pshader) IDirect3DPixelShader9_AddRef(*pshader);
1586 TRACE("Returning %p\n", *pshader);
1590 WARN("Invalid argument specified\n");
1592 return D3DERR_INVALIDCALL;
1595 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1597 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1598 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1600 TRACE("iface %p, parameter %p, vshader %p\n", This, parameter, vshader);
1602 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1604 if (vshader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
1606 *vshader = *(LPDIRECT3DVERTEXSHADER9 *)param->data;
1607 if (*vshader) IDirect3DVertexShader9_AddRef(*vshader);
1608 TRACE("Returning %p\n", *vshader);
1612 WARN("Invalid argument specified\n");
1614 return D3DERR_INVALIDCALL;
1617 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1619 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1621 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
1626 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
1628 /*** IUnknown methods ***/
1629 ID3DXBaseEffectImpl_QueryInterface,
1630 ID3DXBaseEffectImpl_AddRef,
1631 ID3DXBaseEffectImpl_Release,
1632 /*** ID3DXBaseEffect methods ***/
1633 ID3DXBaseEffectImpl_GetDesc,
1634 ID3DXBaseEffectImpl_GetParameterDesc,
1635 ID3DXBaseEffectImpl_GetTechniqueDesc,
1636 ID3DXBaseEffectImpl_GetPassDesc,
1637 ID3DXBaseEffectImpl_GetFunctionDesc,
1638 ID3DXBaseEffectImpl_GetParameter,
1639 ID3DXBaseEffectImpl_GetParameterByName,
1640 ID3DXBaseEffectImpl_GetParameterBySemantic,
1641 ID3DXBaseEffectImpl_GetParameterElement,
1642 ID3DXBaseEffectImpl_GetTechnique,
1643 ID3DXBaseEffectImpl_GetTechniqueByName,
1644 ID3DXBaseEffectImpl_GetPass,
1645 ID3DXBaseEffectImpl_GetPassByName,
1646 ID3DXBaseEffectImpl_GetFunction,
1647 ID3DXBaseEffectImpl_GetFunctionByName,
1648 ID3DXBaseEffectImpl_GetAnnotation,
1649 ID3DXBaseEffectImpl_GetAnnotationByName,
1650 ID3DXBaseEffectImpl_SetValue,
1651 ID3DXBaseEffectImpl_GetValue,
1652 ID3DXBaseEffectImpl_SetBool,
1653 ID3DXBaseEffectImpl_GetBool,
1654 ID3DXBaseEffectImpl_SetBoolArray,
1655 ID3DXBaseEffectImpl_GetBoolArray,
1656 ID3DXBaseEffectImpl_SetInt,
1657 ID3DXBaseEffectImpl_GetInt,
1658 ID3DXBaseEffectImpl_SetIntArray,
1659 ID3DXBaseEffectImpl_GetIntArray,
1660 ID3DXBaseEffectImpl_SetFloat,
1661 ID3DXBaseEffectImpl_GetFloat,
1662 ID3DXBaseEffectImpl_SetFloatArray,
1663 ID3DXBaseEffectImpl_GetFloatArray,
1664 ID3DXBaseEffectImpl_SetVector,
1665 ID3DXBaseEffectImpl_GetVector,
1666 ID3DXBaseEffectImpl_SetVectorArray,
1667 ID3DXBaseEffectImpl_GetVectorArray,
1668 ID3DXBaseEffectImpl_SetMatrix,
1669 ID3DXBaseEffectImpl_GetMatrix,
1670 ID3DXBaseEffectImpl_SetMatrixArray,
1671 ID3DXBaseEffectImpl_GetMatrixArray,
1672 ID3DXBaseEffectImpl_SetMatrixPointerArray,
1673 ID3DXBaseEffectImpl_GetMatrixPointerArray,
1674 ID3DXBaseEffectImpl_SetMatrixTranspose,
1675 ID3DXBaseEffectImpl_GetMatrixTranspose,
1676 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
1677 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
1678 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
1679 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
1680 ID3DXBaseEffectImpl_SetString,
1681 ID3DXBaseEffectImpl_GetString,
1682 ID3DXBaseEffectImpl_SetTexture,
1683 ID3DXBaseEffectImpl_GetTexture,
1684 ID3DXBaseEffectImpl_GetPixelShader,
1685 ID3DXBaseEffectImpl_GetVertexShader,
1686 ID3DXBaseEffectImpl_SetArrayRange,
1689 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
1691 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
1694 /*** IUnknown methods ***/
1695 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
1697 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1699 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
1701 if (IsEqualGUID(riid, &IID_IUnknown) ||
1702 IsEqualGUID(riid, &IID_ID3DXEffect))
1704 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
1709 ERR("Interface %s not found\n", debugstr_guid(riid));
1711 return E_NOINTERFACE;
1714 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
1716 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1718 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1720 return InterlockedIncrement(&This->ref);
1723 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
1725 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1726 ULONG ref = InterlockedDecrement(&This->ref);
1728 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
1733 HeapFree(GetProcessHeap(), 0, This);
1739 /*** ID3DXBaseEffect methods ***/
1740 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
1742 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1743 ID3DXBaseEffect *base = This->base_effect;
1745 TRACE("Forward iface %p, base %p\n", This, base);
1747 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1750 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1752 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1753 ID3DXBaseEffect *base = This->base_effect;
1755 TRACE("Forward iface %p, base %p\n", This, base);
1757 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1760 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1762 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1763 ID3DXBaseEffect *base = This->base_effect;
1765 TRACE("Forward iface %p, base %p\n", This, base);
1767 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1770 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1772 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1773 ID3DXBaseEffect *base = This->base_effect;
1775 TRACE("Forward iface %p, base %p\n", This, base);
1777 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1780 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1782 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1783 ID3DXBaseEffect *base = This->base_effect;
1785 TRACE("Forward iface %p, base %p\n", This, base);
1787 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1790 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1792 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1793 ID3DXBaseEffect *base = This->base_effect;
1795 TRACE("Forward iface %p, base %p\n", This, base);
1797 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1800 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1802 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1803 ID3DXBaseEffect *base = This->base_effect;
1805 TRACE("Forward iface %p, base %p\n", This, base);
1807 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1810 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1812 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1813 ID3DXBaseEffect *base = This->base_effect;
1815 TRACE("Forward iface %p, base %p\n", This, base);
1817 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1820 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1822 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1823 ID3DXBaseEffect *base = This->base_effect;
1825 TRACE("Forward iface %p, base %p\n", This, base);
1827 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1830 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
1832 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1833 ID3DXBaseEffect *base = This->base_effect;
1835 TRACE("Forward iface %p, base %p\n", This, base);
1837 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1840 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
1842 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1843 ID3DXBaseEffect *base = This->base_effect;
1845 TRACE("Forward iface %p, base %p\n", This, base);
1847 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1850 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
1852 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1853 ID3DXBaseEffect *base = This->base_effect;
1855 TRACE("Forward iface %p, base %p\n", This, base);
1857 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1860 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
1862 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1863 ID3DXBaseEffect *base = This->base_effect;
1865 TRACE("Forward iface %p, base %p\n", This, base);
1867 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1870 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
1872 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1873 ID3DXBaseEffect *base = This->base_effect;
1875 TRACE("Forward iface %p, base %p\n", This, base);
1877 return ID3DXBaseEffectImpl_GetFunction(base, index);
1880 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1882 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1883 ID3DXBaseEffect *base = This->base_effect;
1885 TRACE("Forward iface %p, base %p\n", This, base);
1887 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1890 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1892 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1893 ID3DXBaseEffect *base = This->base_effect;
1895 TRACE("Forward iface %p, base %p\n", This, base);
1897 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1900 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1902 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1903 ID3DXBaseEffect *base = This->base_effect;
1905 TRACE("Forward iface %p, base %p\n", This, base);
1907 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1910 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1912 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1913 ID3DXBaseEffect *base = This->base_effect;
1915 TRACE("Forward iface %p, base %p\n", This, base);
1917 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1920 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1922 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1923 ID3DXBaseEffect *base = This->base_effect;
1925 TRACE("Forward iface %p, base %p\n", This, base);
1927 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1930 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1932 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1933 ID3DXBaseEffect *base = This->base_effect;
1935 TRACE("Forward iface %p, base %p\n", This, base);
1937 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1940 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1942 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1943 ID3DXBaseEffect *base = This->base_effect;
1945 TRACE("Forward iface %p, base %p\n", This, base);
1947 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1950 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1952 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1953 ID3DXBaseEffect *base = This->base_effect;
1955 TRACE("Forward iface %p, base %p\n", This, base);
1957 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1960 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1962 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1963 ID3DXBaseEffect *base = This->base_effect;
1965 TRACE("Forward iface %p, base %p\n", This, base);
1967 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1970 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
1972 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1973 ID3DXBaseEffect *base = This->base_effect;
1975 TRACE("Forward iface %p, base %p\n", This, base);
1977 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1980 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1982 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1983 ID3DXBaseEffect *base = This->base_effect;
1985 TRACE("Forward iface %p, base %p\n", This, base);
1987 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1990 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1992 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1993 ID3DXBaseEffect *base = This->base_effect;
1995 TRACE("Forward iface %p, base %p\n", This, base);
1997 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2000 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
2002 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2003 ID3DXBaseEffect *base = This->base_effect;
2005 TRACE("Forward iface %p, base %p\n", This, base);
2007 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2010 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
2012 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2013 ID3DXBaseEffect *base = This->base_effect;
2015 TRACE("Forward iface %p, base %p\n", This, base);
2017 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2020 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
2022 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2023 ID3DXBaseEffect *base = This->base_effect;
2025 TRACE("Forward iface %p, base %p\n", This, base);
2027 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2030 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2032 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2033 ID3DXBaseEffect *base = This->base_effect;
2035 TRACE("Forward iface %p, base %p\n", This, base);
2037 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2040 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2042 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2043 ID3DXBaseEffect *base = This->base_effect;
2045 TRACE("Forward iface %p, base %p\n", This, base);
2047 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2050 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2052 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2053 ID3DXBaseEffect *base = This->base_effect;
2055 TRACE("Forward iface %p, base %p\n", This, base);
2057 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2060 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2062 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2063 ID3DXBaseEffect *base = This->base_effect;
2065 TRACE("Forward iface %p, base %p\n", This, base);
2067 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2070 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2072 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2073 ID3DXBaseEffect *base = This->base_effect;
2075 TRACE("Forward iface %p, base %p\n", This, base);
2077 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2080 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2082 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2083 ID3DXBaseEffect *base = This->base_effect;
2085 TRACE("Forward iface %p, base %p\n", This, base);
2087 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2090 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2092 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2093 ID3DXBaseEffect *base = This->base_effect;
2095 TRACE("Forward iface %p, base %p\n", This, base);
2097 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2100 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2102 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2103 ID3DXBaseEffect *base = This->base_effect;
2105 TRACE("Forward iface %p, base %p\n", This, base);
2107 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2110 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2112 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2113 ID3DXBaseEffect *base = This->base_effect;
2115 TRACE("Forward iface %p, base %p\n", This, base);
2117 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2120 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2122 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2123 ID3DXBaseEffect *base = This->base_effect;
2125 TRACE("Forward iface %p, base %p\n", This, base);
2127 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2130 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2132 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2133 ID3DXBaseEffect *base = This->base_effect;
2135 TRACE("Forward iface %p, base %p\n", This, base);
2137 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2140 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2142 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2143 ID3DXBaseEffect *base = This->base_effect;
2145 TRACE("Forward iface %p, base %p\n", This, base);
2147 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2150 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2152 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2153 ID3DXBaseEffect *base = This->base_effect;
2155 TRACE("Forward iface %p, base %p\n", This, base);
2157 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2160 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2162 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2163 ID3DXBaseEffect *base = This->base_effect;
2165 TRACE("Forward iface %p, base %p\n", This, base);
2167 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2170 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2172 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2173 ID3DXBaseEffect *base = This->base_effect;
2175 TRACE("Forward iface %p, base %p\n", This, base);
2177 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2180 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2182 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2183 ID3DXBaseEffect *base = This->base_effect;
2185 TRACE("Forward iface %p, base %p\n", This, base);
2187 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2190 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2192 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2193 ID3DXBaseEffect *base = This->base_effect;
2195 TRACE("Forward iface %p, base %p\n", This, base);
2197 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2200 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2202 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2203 ID3DXBaseEffect *base = This->base_effect;
2205 TRACE("Forward iface %p, base %p\n", This, base);
2207 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2210 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
2212 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2213 ID3DXBaseEffect *base = This->base_effect;
2215 TRACE("Forward iface %p, base %p\n", This, base);
2217 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2220 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
2222 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2223 ID3DXBaseEffect *base = This->base_effect;
2225 TRACE("Forward iface %p, base %p\n", This, base);
2227 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2230 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2232 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2233 ID3DXBaseEffect *base = This->base_effect;
2235 TRACE("Forward iface %p, base %p\n", This, base);
2237 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2240 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2242 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2243 ID3DXBaseEffect *base = This->base_effect;
2245 TRACE("Forward iface %p, base %p\n", This, base);
2247 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2250 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2252 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2253 ID3DXBaseEffect *base = This->base_effect;
2255 TRACE("Forward iface %p, base %p\n", This, base);
2257 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2260 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2262 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2263 ID3DXBaseEffect *base = This->base_effect;
2265 TRACE("Forward iface %p, base %p\n", This, base);
2267 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2270 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2272 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2273 ID3DXBaseEffect *base = This->base_effect;
2275 TRACE("Forward iface %p, base %p\n", This, base);
2277 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2280 /*** ID3DXEffect methods ***/
2281 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
2283 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2285 TRACE("iface %p, pool %p\n", This, pool);
2289 WARN("Invalid argument supplied.\n");
2290 return D3DERR_INVALIDCALL;
2295 This->pool->lpVtbl->AddRef(This->pool);
2300 TRACE("Returning pool %p\n", *pool);
2305 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2307 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2309 FIXME("(%p)->(%p): stub\n", This, technique);
2314 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
2316 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2318 FIXME("(%p)->(): stub\n", This);
2323 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2325 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2327 FIXME("(%p)->(%p): stub\n", This, technique);
2332 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
2334 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2336 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
2341 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
2343 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2345 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
2350 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
2352 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2354 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
2359 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
2361 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2363 FIXME("(%p)->(%u): stub\n", This, pass);
2368 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
2370 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2372 FIXME("(%p)->(): stub\n", This);
2377 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
2379 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2381 FIXME("(%p)->(): stub\n", This);
2386 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
2388 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2390 FIXME("(%p)->(): stub\n", This);
2395 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
2397 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2399 TRACE("iface %p, device %p\n", This, device);
2403 WARN("Invalid argument supplied.\n");
2404 return D3DERR_INVALIDCALL;
2407 IDirect3DDevice9_AddRef(This->device);
2409 *device = This->device;
2411 TRACE("Returning device %p\n", *device);
2416 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
2418 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2420 FIXME("(%p)->(): stub\n", This);
2425 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
2427 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2429 FIXME("(%p)->(): stub\n", This);
2434 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect *iface, LPD3DXEFFECTSTATEMANAGER manager)
2436 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2438 TRACE("iface %p, manager %p\n", This, manager);
2440 if (This->manager) IUnknown_Release(This->manager);
2441 if (manager) IUnknown_AddRef(manager);
2443 This->manager = manager;
2448 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect *iface, LPD3DXEFFECTSTATEMANAGER *manager)
2450 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2452 TRACE("iface %p, manager %p\n", This, manager);
2456 WARN("Invalid argument supplied.\n");
2457 return D3DERR_INVALIDCALL;
2460 if (This->manager) IUnknown_AddRef(This->manager);
2461 *manager = This->manager;
2466 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
2468 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2470 FIXME("(%p)->(): stub\n", This);
2475 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
2477 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2479 FIXME("(%p)->(): stub\n", This);
2484 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2486 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2488 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2493 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2495 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2497 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2502 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
2504 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2506 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
2511 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
2513 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2515 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
2520 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
2522 /*** IUnknown methods ***/
2523 ID3DXEffectImpl_QueryInterface,
2524 ID3DXEffectImpl_AddRef,
2525 ID3DXEffectImpl_Release,
2526 /*** ID3DXBaseEffect methods ***/
2527 ID3DXEffectImpl_GetDesc,
2528 ID3DXEffectImpl_GetParameterDesc,
2529 ID3DXEffectImpl_GetTechniqueDesc,
2530 ID3DXEffectImpl_GetPassDesc,
2531 ID3DXEffectImpl_GetFunctionDesc,
2532 ID3DXEffectImpl_GetParameter,
2533 ID3DXEffectImpl_GetParameterByName,
2534 ID3DXEffectImpl_GetParameterBySemantic,
2535 ID3DXEffectImpl_GetParameterElement,
2536 ID3DXEffectImpl_GetTechnique,
2537 ID3DXEffectImpl_GetTechniqueByName,
2538 ID3DXEffectImpl_GetPass,
2539 ID3DXEffectImpl_GetPassByName,
2540 ID3DXEffectImpl_GetFunction,
2541 ID3DXEffectImpl_GetFunctionByName,
2542 ID3DXEffectImpl_GetAnnotation,
2543 ID3DXEffectImpl_GetAnnotationByName,
2544 ID3DXEffectImpl_SetValue,
2545 ID3DXEffectImpl_GetValue,
2546 ID3DXEffectImpl_SetBool,
2547 ID3DXEffectImpl_GetBool,
2548 ID3DXEffectImpl_SetBoolArray,
2549 ID3DXEffectImpl_GetBoolArray,
2550 ID3DXEffectImpl_SetInt,
2551 ID3DXEffectImpl_GetInt,
2552 ID3DXEffectImpl_SetIntArray,
2553 ID3DXEffectImpl_GetIntArray,
2554 ID3DXEffectImpl_SetFloat,
2555 ID3DXEffectImpl_GetFloat,
2556 ID3DXEffectImpl_SetFloatArray,
2557 ID3DXEffectImpl_GetFloatArray,
2558 ID3DXEffectImpl_SetVector,
2559 ID3DXEffectImpl_GetVector,
2560 ID3DXEffectImpl_SetVectorArray,
2561 ID3DXEffectImpl_GetVectorArray,
2562 ID3DXEffectImpl_SetMatrix,
2563 ID3DXEffectImpl_GetMatrix,
2564 ID3DXEffectImpl_SetMatrixArray,
2565 ID3DXEffectImpl_GetMatrixArray,
2566 ID3DXEffectImpl_SetMatrixPointerArray,
2567 ID3DXEffectImpl_GetMatrixPointerArray,
2568 ID3DXEffectImpl_SetMatrixTranspose,
2569 ID3DXEffectImpl_GetMatrixTranspose,
2570 ID3DXEffectImpl_SetMatrixTransposeArray,
2571 ID3DXEffectImpl_GetMatrixTransposeArray,
2572 ID3DXEffectImpl_SetMatrixTransposePointerArray,
2573 ID3DXEffectImpl_GetMatrixTransposePointerArray,
2574 ID3DXEffectImpl_SetString,
2575 ID3DXEffectImpl_GetString,
2576 ID3DXEffectImpl_SetTexture,
2577 ID3DXEffectImpl_GetTexture,
2578 ID3DXEffectImpl_GetPixelShader,
2579 ID3DXEffectImpl_GetVertexShader,
2580 ID3DXEffectImpl_SetArrayRange,
2581 /*** ID3DXEffect methods ***/
2582 ID3DXEffectImpl_GetPool,
2583 ID3DXEffectImpl_SetTechnique,
2584 ID3DXEffectImpl_GetCurrentTechnique,
2585 ID3DXEffectImpl_ValidateTechnique,
2586 ID3DXEffectImpl_FindNextValidTechnique,
2587 ID3DXEffectImpl_IsParameterUsed,
2588 ID3DXEffectImpl_Begin,
2589 ID3DXEffectImpl_BeginPass,
2590 ID3DXEffectImpl_CommitChanges,
2591 ID3DXEffectImpl_EndPass,
2592 ID3DXEffectImpl_End,
2593 ID3DXEffectImpl_GetDevice,
2594 ID3DXEffectImpl_OnLostDevice,
2595 ID3DXEffectImpl_OnResetDevice,
2596 ID3DXEffectImpl_SetStateManager,
2597 ID3DXEffectImpl_GetStateManager,
2598 ID3DXEffectImpl_BeginParameterBlock,
2599 ID3DXEffectImpl_EndParameterBlock,
2600 ID3DXEffectImpl_ApplyParameterBlock,
2601 ID3DXEffectImpl_DeleteParameterBlock,
2602 ID3DXEffectImpl_CloneEffect,
2603 ID3DXEffectImpl_SetRawValue
2606 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
2608 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
2611 /*** IUnknown methods ***/
2612 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
2614 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2616 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
2618 if (IsEqualGUID(riid, &IID_IUnknown) ||
2619 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
2621 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
2626 ERR("Interface %s not found\n", debugstr_guid(riid));
2628 return E_NOINTERFACE;
2631 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
2633 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2635 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
2637 return InterlockedIncrement(&This->ref);
2640 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
2642 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2643 ULONG ref = InterlockedDecrement(&This->ref);
2645 TRACE("iface %p: Release from %u\n", iface, ref + 1);
2649 free_effect_compiler(This);
2650 HeapFree(GetProcessHeap(), 0, This);
2656 /*** ID3DXBaseEffect methods ***/
2657 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
2659 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2660 ID3DXBaseEffect *base = This->base_effect;
2662 TRACE("Forward iface %p, base %p\n", This, base);
2664 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2667 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2669 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2670 ID3DXBaseEffect *base = This->base_effect;
2672 TRACE("Forward iface %p, base %p\n", This, base);
2674 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2677 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2679 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2680 ID3DXBaseEffect *base = This->base_effect;
2682 TRACE("Forward iface %p, base %p\n", This, base);
2684 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2687 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2689 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2690 ID3DXBaseEffect *base = This->base_effect;
2692 TRACE("Forward iface %p, base %p\n", This, base);
2694 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2697 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2699 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2700 ID3DXBaseEffect *base = This->base_effect;
2702 TRACE("Forward iface %p, base %p\n", This, base);
2704 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2707 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2709 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2710 ID3DXBaseEffect *base = This->base_effect;
2712 TRACE("Forward iface %p, base %p\n", This, base);
2714 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2717 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
2719 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2720 ID3DXBaseEffect *base = This->base_effect;
2722 TRACE("Forward iface %p, base %p\n", This, base);
2724 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2727 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
2729 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2730 ID3DXBaseEffect *base = This->base_effect;
2732 TRACE("Forward iface %p, base %p\n", This, base);
2734 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2737 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2739 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2740 ID3DXBaseEffect *base = This->base_effect;
2742 TRACE("Forward iface %p, base %p\n", This, base);
2744 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2747 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
2749 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2750 ID3DXBaseEffect *base = This->base_effect;
2752 TRACE("Forward iface %p, base %p\n", This, base);
2754 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2757 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
2759 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2760 ID3DXBaseEffect *base = This->base_effect;
2762 TRACE("Forward iface %p, base %p\n", This, base);
2764 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2767 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
2769 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2770 ID3DXBaseEffect *base = This->base_effect;
2772 TRACE("Forward iface %p, base %p\n", This, base);
2774 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2777 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
2779 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2780 ID3DXBaseEffect *base = This->base_effect;
2782 TRACE("Forward iface %p, base %p\n", This, base);
2784 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2787 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
2789 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2790 ID3DXBaseEffect *base = This->base_effect;
2792 TRACE("Forward iface %p, base %p\n", This, base);
2794 return ID3DXBaseEffectImpl_GetFunction(base, index);
2797 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
2799 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2800 ID3DXBaseEffect *base = This->base_effect;
2802 TRACE("Forward iface %p, base %p\n", This, base);
2804 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2807 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
2809 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2810 ID3DXBaseEffect *base = This->base_effect;
2812 TRACE("Forward iface %p, base %p\n", This, base);
2814 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2817 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
2819 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2820 ID3DXBaseEffect *base = This->base_effect;
2822 TRACE("Forward iface %p, base %p\n", This, base);
2824 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2827 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2829 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2830 ID3DXBaseEffect *base = This->base_effect;
2832 TRACE("Forward iface %p, base %p\n", This, base);
2834 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2837 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2839 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2840 ID3DXBaseEffect *base = This->base_effect;
2842 TRACE("Forward iface %p, base %p\n", This, base);
2844 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2847 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
2849 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2850 ID3DXBaseEffect *base = This->base_effect;
2852 TRACE("Forward iface %p, base %p\n", This, base);
2854 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2857 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
2859 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2860 ID3DXBaseEffect *base = This->base_effect;
2862 TRACE("Forward iface %p, base %p\n", This, base);
2864 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2867 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2869 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2870 ID3DXBaseEffect *base = This->base_effect;
2872 TRACE("Forward iface %p, base %p\n", This, base);
2874 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2877 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2879 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2880 ID3DXBaseEffect *base = This->base_effect;
2882 TRACE("Forward iface %p, base %p\n", This, base);
2884 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2887 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
2889 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2890 ID3DXBaseEffect *base = This->base_effect;
2892 TRACE("Forward iface %p, base %p\n", This, base);
2894 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2897 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2899 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2900 ID3DXBaseEffect *base = This->base_effect;
2902 TRACE("Forward iface %p, base %p\n", This, base);
2904 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2907 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2909 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2910 ID3DXBaseEffect *base = This->base_effect;
2912 TRACE("Forward iface %p, base %p\n", This, base);
2914 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2917 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2919 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2920 ID3DXBaseEffect *base = This->base_effect;
2922 TRACE("Forward iface %p, base %p\n", This, base);
2924 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2927 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2929 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2930 ID3DXBaseEffect *base = This->base_effect;
2932 TRACE("Forward iface %p, base %p\n", This, base);
2934 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2937 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2939 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2940 ID3DXBaseEffect *base = This->base_effect;
2942 TRACE("Forward iface %p, base %p\n", This, base);
2944 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2947 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2949 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2950 ID3DXBaseEffect *base = This->base_effect;
2952 TRACE("Forward iface %p, base %p\n", This, base);
2954 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2957 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2959 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2960 ID3DXBaseEffect *base = This->base_effect;
2962 TRACE("Forward iface %p, base %p\n", This, base);
2964 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2967 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2969 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2970 ID3DXBaseEffect *base = This->base_effect;
2972 TRACE("Forward iface %p, base %p\n", This, base);
2974 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2977 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2979 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2980 ID3DXBaseEffect *base = This->base_effect;
2982 TRACE("Forward iface %p, base %p\n", This, base);
2984 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2987 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2989 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2990 ID3DXBaseEffect *base = This->base_effect;
2992 TRACE("Forward iface %p, base %p\n", This, base);
2994 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2997 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2999 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3000 ID3DXBaseEffect *base = This->base_effect;
3002 TRACE("Forward iface %p, base %p\n", This, base);
3004 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
3007 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3009 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3010 ID3DXBaseEffect *base = This->base_effect;
3012 TRACE("Forward iface %p, base %p\n", This, base);
3014 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
3017 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3019 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3020 ID3DXBaseEffect *base = This->base_effect;
3022 TRACE("Forward iface %p, base %p\n", This, base);
3024 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
3027 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3029 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3030 ID3DXBaseEffect *base = This->base_effect;
3032 TRACE("Forward iface %p, base %p\n", This, base);
3034 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
3037 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3039 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3040 ID3DXBaseEffect *base = This->base_effect;
3042 TRACE("Forward iface %p, base %p\n", This, base);
3044 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
3047 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3049 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3050 ID3DXBaseEffect *base = This->base_effect;
3052 TRACE("Forward iface %p, base %p\n", This, base);
3054 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
3057 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3059 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3060 ID3DXBaseEffect *base = This->base_effect;
3062 TRACE("Forward iface %p, base %p\n", This, base);
3064 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
3067 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3069 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3070 ID3DXBaseEffect *base = This->base_effect;
3072 TRACE("Forward iface %p, base %p\n", This, base);
3074 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
3077 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3079 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3080 ID3DXBaseEffect *base = This->base_effect;
3082 TRACE("Forward iface %p, base %p\n", This, base);
3084 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
3087 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3089 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3090 ID3DXBaseEffect *base = This->base_effect;
3092 TRACE("Forward iface %p, base %p\n", This, base);
3094 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
3097 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3099 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3100 ID3DXBaseEffect *base = This->base_effect;
3102 TRACE("Forward iface %p, base %p\n", This, base);
3104 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
3107 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3109 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3110 ID3DXBaseEffect *base = This->base_effect;
3112 TRACE("Forward iface %p, base %p\n", This, base);
3114 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
3117 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3119 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3120 ID3DXBaseEffect *base = This->base_effect;
3122 TRACE("Forward iface %p, base %p\n", This, base);
3124 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
3127 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
3129 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3130 ID3DXBaseEffect *base = This->base_effect;
3132 TRACE("Forward iface %p, base %p\n", This, base);
3134 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
3137 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
3139 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3140 ID3DXBaseEffect *base = This->base_effect;
3142 TRACE("Forward iface %p, base %p\n", This, base);
3144 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
3147 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
3149 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3150 ID3DXBaseEffect *base = This->base_effect;
3152 TRACE("Forward iface %p, base %p\n", This, base);
3154 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
3157 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
3159 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3160 ID3DXBaseEffect *base = This->base_effect;
3162 TRACE("Forward iface %p, base %p\n", This, base);
3164 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
3167 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
3169 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3170 ID3DXBaseEffect *base = This->base_effect;
3172 TRACE("Forward iface %p, base %p\n", This, base);
3174 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
3177 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
3179 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3180 ID3DXBaseEffect *base = This->base_effect;
3182 TRACE("Forward iface %p, base %p\n", This, base);
3184 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
3187 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
3189 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3190 ID3DXBaseEffect *base = This->base_effect;
3192 TRACE("Forward iface %p, base %p\n", This, base);
3194 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
3197 /*** ID3DXEffectCompiler methods ***/
3198 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
3200 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3202 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
3207 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
3209 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3211 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
3216 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
3217 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
3219 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3221 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
3226 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
3227 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
3229 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3231 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3232 This, function, target, flags, shader, error_msgs, constant_table);
3237 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
3239 /*** IUnknown methods ***/
3240 ID3DXEffectCompilerImpl_QueryInterface,
3241 ID3DXEffectCompilerImpl_AddRef,
3242 ID3DXEffectCompilerImpl_Release,
3243 /*** ID3DXBaseEffect methods ***/
3244 ID3DXEffectCompilerImpl_GetDesc,
3245 ID3DXEffectCompilerImpl_GetParameterDesc,
3246 ID3DXEffectCompilerImpl_GetTechniqueDesc,
3247 ID3DXEffectCompilerImpl_GetPassDesc,
3248 ID3DXEffectCompilerImpl_GetFunctionDesc,
3249 ID3DXEffectCompilerImpl_GetParameter,
3250 ID3DXEffectCompilerImpl_GetParameterByName,
3251 ID3DXEffectCompilerImpl_GetParameterBySemantic,
3252 ID3DXEffectCompilerImpl_GetParameterElement,
3253 ID3DXEffectCompilerImpl_GetTechnique,
3254 ID3DXEffectCompilerImpl_GetTechniqueByName,
3255 ID3DXEffectCompilerImpl_GetPass,
3256 ID3DXEffectCompilerImpl_GetPassByName,
3257 ID3DXEffectCompilerImpl_GetFunction,
3258 ID3DXEffectCompilerImpl_GetFunctionByName,
3259 ID3DXEffectCompilerImpl_GetAnnotation,
3260 ID3DXEffectCompilerImpl_GetAnnotationByName,
3261 ID3DXEffectCompilerImpl_SetValue,
3262 ID3DXEffectCompilerImpl_GetValue,
3263 ID3DXEffectCompilerImpl_SetBool,
3264 ID3DXEffectCompilerImpl_GetBool,
3265 ID3DXEffectCompilerImpl_SetBoolArray,
3266 ID3DXEffectCompilerImpl_GetBoolArray,
3267 ID3DXEffectCompilerImpl_SetInt,
3268 ID3DXEffectCompilerImpl_GetInt,
3269 ID3DXEffectCompilerImpl_SetIntArray,
3270 ID3DXEffectCompilerImpl_GetIntArray,
3271 ID3DXEffectCompilerImpl_SetFloat,
3272 ID3DXEffectCompilerImpl_GetFloat,
3273 ID3DXEffectCompilerImpl_SetFloatArray,
3274 ID3DXEffectCompilerImpl_GetFloatArray,
3275 ID3DXEffectCompilerImpl_SetVector,
3276 ID3DXEffectCompilerImpl_GetVector,
3277 ID3DXEffectCompilerImpl_SetVectorArray,
3278 ID3DXEffectCompilerImpl_GetVectorArray,
3279 ID3DXEffectCompilerImpl_SetMatrix,
3280 ID3DXEffectCompilerImpl_GetMatrix,
3281 ID3DXEffectCompilerImpl_SetMatrixArray,
3282 ID3DXEffectCompilerImpl_GetMatrixArray,
3283 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
3284 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
3285 ID3DXEffectCompilerImpl_SetMatrixTranspose,
3286 ID3DXEffectCompilerImpl_GetMatrixTranspose,
3287 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
3288 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
3289 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
3290 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
3291 ID3DXEffectCompilerImpl_SetString,
3292 ID3DXEffectCompilerImpl_GetString,
3293 ID3DXEffectCompilerImpl_SetTexture,
3294 ID3DXEffectCompilerImpl_GetTexture,
3295 ID3DXEffectCompilerImpl_GetPixelShader,
3296 ID3DXEffectCompilerImpl_GetVertexShader,
3297 ID3DXEffectCompilerImpl_SetArrayRange,
3298 /*** ID3DXEffectCompiler methods ***/
3299 ID3DXEffectCompilerImpl_SetLiteral,
3300 ID3DXEffectCompilerImpl_GetLiteral,
3301 ID3DXEffectCompilerImpl_CompileEffect,
3302 ID3DXEffectCompilerImpl_CompileShader,
3305 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char **ptr)
3312 if (param->element_count)
3314 param->data = value;
3316 for (i = 0; i < param->element_count; ++i)
3318 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3320 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3323 WARN("Failed to parse value\n");
3327 old_size += member->bytes;
3333 switch(param->class)
3337 case D3DXPC_MATRIX_ROWS:
3338 case D3DXPC_MATRIX_COLUMNS:
3339 param->data = value;
3343 param->data = value;
3345 for (i = 0; i < param->member_count; ++i)
3347 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3349 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3352 WARN("Failed to parse value\n");
3356 old_size += member->bytes;
3361 switch (param->type)
3364 case D3DXPT_PIXELSHADER:
3365 case D3DXPT_VERTEXSHADER:
3366 read_dword(ptr, &id);
3367 TRACE("Id: %u\n", id);
3368 param->base->objects[id] = get_parameter_handle(param);
3369 param->data = value;
3373 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3379 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3386 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
3388 UINT size = param->bytes;
3392 TRACE("param size: %u\n", size);
3394 value = HeapAlloc(GetProcessHeap(), 0, size);
3397 ERR("Failed to allocate data memory.\n");
3398 return E_OUTOFMEMORY;
3401 TRACE("Data: %s.\n", debugstr_an(ptr, size));
3402 memcpy(value, ptr, size);
3404 hr = d3dx9_parse_value(param, value, &ptr);
3407 WARN("Failed to parse value\n");
3408 HeapFree(GetProcessHeap(), 0, value);
3412 param->data = value;
3417 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
3421 read_dword(&ptr, &size);
3422 TRACE("Name size: %#x\n", size);
3429 *name = HeapAlloc(GetProcessHeap(), 0, size);
3432 ERR("Failed to allocate name memory.\n");
3433 return E_OUTOFMEMORY;
3436 TRACE("Name: %s.\n", debugstr_an(ptr, size));
3437 memcpy(*name, ptr, size);
3442 static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr)
3447 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type));
3449 read_dword(ptr, &size);
3450 TRACE("Data size: %#x\n", size);
3454 TRACE("Size is 0\n");
3455 *(void **)param->data = NULL;
3459 switch (param->type)
3462 /* re-read with size (sizeof(DWORD) = 4) */
3463 hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
3466 WARN("Failed to parse string data\n");
3471 case D3DXPT_VERTEXSHADER:
3472 hr = IDirect3DDevice9_CreateVertexShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DVERTEXSHADER9 *)param->data);
3475 WARN("Failed to create vertex shader\n");
3480 case D3DXPT_PIXELSHADER:
3481 hr = IDirect3DDevice9_CreatePixelShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DPIXELSHADER9 *)param->data);
3484 WARN("Failed to create pixel shader\n");
3490 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3495 *ptr += ((size + 3) & ~3);
3500 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr,
3501 struct d3dx_parameter *parent, UINT flags)
3505 D3DXHANDLE *member_handles = NULL;
3508 param->flags = flags;
3512 read_dword(ptr, ¶m->type);
3513 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
3515 read_dword(ptr, ¶m->class);
3516 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
3518 read_dword(ptr, &offset);
3519 TRACE("Type name offset: %#x\n", offset);
3520 hr = d3dx9_parse_name(¶m->name, data + offset);
3523 WARN("Failed to parse name\n");
3527 read_dword(ptr, &offset);
3528 TRACE("Type semantic offset: %#x\n", offset);
3529 hr = d3dx9_parse_name(¶m->semantic, data + offset);
3532 WARN("Failed to parse semantic\n");
3536 read_dword(ptr, ¶m->element_count);
3537 TRACE("Elements: %u\n", param->element_count);
3539 switch (param->class)
3542 read_dword(ptr, ¶m->columns);
3543 TRACE("Columns: %u\n", param->columns);
3545 read_dword(ptr, ¶m->rows);
3546 TRACE("Rows: %u\n", param->rows);
3548 /* sizeof(DWORD) * rows * columns */
3549 param->bytes = 4 * param->rows * param->columns;
3553 case D3DXPC_MATRIX_ROWS:
3554 case D3DXPC_MATRIX_COLUMNS:
3555 read_dword(ptr, ¶m->rows);
3556 TRACE("Rows: %u\n", param->rows);
3558 read_dword(ptr, ¶m->columns);
3559 TRACE("Columns: %u\n", param->columns);
3561 /* sizeof(DWORD) * rows * columns */
3562 param->bytes = 4 * param->rows * param->columns;
3566 read_dword(ptr, ¶m->member_count);
3567 TRACE("Members: %u\n", param->member_count);
3571 switch (param->type)
3574 param->bytes = sizeof(LPCSTR);
3577 case D3DXPT_PIXELSHADER:
3578 param->bytes = sizeof(LPDIRECT3DPIXELSHADER9);
3581 case D3DXPT_VERTEXSHADER:
3582 param->bytes = sizeof(LPDIRECT3DVERTEXSHADER9);
3586 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3592 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3599 param->type = parent->type;
3600 param->class = parent->class;
3601 param->name = parent->name;
3602 param->semantic = parent->semantic;
3603 param->element_count = 0;
3604 param->annotation_count = 0;
3605 param->member_count = parent->member_count;
3606 param->bytes = parent->bytes;
3607 param->rows = parent->rows;
3608 param->columns = parent->columns;
3611 if (param->element_count)
3613 unsigned int param_bytes = 0;
3614 const char *save_ptr = *ptr;
3616 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
3617 if (!member_handles)
3619 ERR("Out of memory\n");
3624 for (i = 0; i < param->element_count; ++i)
3626 struct d3dx_parameter *member;
3629 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3632 ERR("Out of memory\n");
3637 member_handles[i] = get_parameter_handle(member);
3638 member->base = param->base;
3640 hr = d3dx9_parse_effect_typedef(member, data, ptr, param, flags);
3643 WARN("Failed to parse member\n");
3647 param_bytes += member->bytes;
3650 param->bytes = param_bytes;
3652 else if (param->member_count)
3654 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
3655 if (!member_handles)
3657 ERR("Out of memory\n");
3662 for (i = 0; i < param->member_count; ++i)
3664 struct d3dx_parameter *member;
3666 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3669 ERR("Out of memory\n");
3674 member_handles[i] = get_parameter_handle(member);
3675 member->base = param->base;
3677 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL, flags);
3680 WARN("Failed to parse member\n");
3684 param->bytes += member->bytes;
3688 param->member_handles = member_handles;
3698 if (param->element_count) count = param->element_count;
3699 else count = param->member_count;
3701 for (i = 0; i < count; ++i)
3703 free_parameter(member_handles[i], param->element_count != 0, TRUE);
3705 HeapFree(GetProcessHeap(), 0, member_handles);
3710 HeapFree(GetProcessHeap(), 0, param->name);
3711 HeapFree(GetProcessHeap(), 0, param->semantic);
3714 param->semantic = NULL;
3719 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
3725 anno->flags = D3DX_PARAMETER_ANNOTATION;
3727 read_dword(ptr, &offset);
3728 TRACE("Typedef offset: %#x\n", offset);
3729 ptr2 = data + offset;
3730 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION);
3733 WARN("Failed to parse type definition\n");
3737 read_dword(ptr, &offset);
3738 TRACE("Value offset: %#x\n", offset);
3739 hr = d3dx9_parse_init_value(anno, data + offset);
3742 WARN("Failed to parse value\n");
3749 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
3754 D3DXHANDLE *annotation_handles = NULL;
3757 read_dword(ptr, &offset);
3758 TRACE("Typedef offset: %#x\n", offset);
3759 ptr2 = data + offset;
3761 read_dword(ptr, &offset);
3762 TRACE("Value offset: %#x\n", offset);
3764 read_dword(ptr, ¶m->flags);
3765 TRACE("Flags: %#x\n", param->flags);
3767 read_dword(ptr, ¶m->annotation_count);
3768 TRACE("Annotation count: %u\n", param->annotation_count);
3770 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags);
3773 WARN("Failed to parse type definition\n");
3777 hr = d3dx9_parse_init_value(param, data + offset);
3780 WARN("Failed to parse value\n");
3784 if (param->annotation_count)
3786 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
3787 if (!annotation_handles)
3789 ERR("Out of memory\n");
3794 for (i = 0; i < param->annotation_count; ++i)
3796 struct d3dx_parameter *annotation;
3798 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3801 ERR("Out of memory\n");
3806 annotation_handles[i] = get_parameter_handle(annotation);
3807 annotation->base = param->base;
3809 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3812 WARN("Failed to parse annotation\n");
3818 param->annotation_handles = annotation_handles;
3824 if (annotation_handles)
3826 for (i = 0; i < param->annotation_count; ++i)
3828 free_parameter(annotation_handles[i], FALSE, FALSE);
3830 HeapFree(GetProcessHeap(), 0, annotation_handles);
3836 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr)
3841 D3DXHANDLE *annotation_handles = NULL;
3844 read_dword(ptr, &offset);
3845 TRACE("Pass name offset: %#x\n", offset);
3846 hr = d3dx9_parse_name(&name, data + offset);
3849 WARN("Failed to parse name\n");
3853 read_dword(ptr, &pass->annotation_count);
3854 TRACE("Annotation count: %u\n", pass->annotation_count);
3856 read_dword(ptr, &pass->state_count);
3857 TRACE("State count: %u\n", pass->state_count);
3859 if (pass->annotation_count)
3861 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
3862 if (!annotation_handles)
3864 ERR("Out of memory\n");
3869 for (i = 0; i < pass->annotation_count; ++i)
3871 struct d3dx_parameter *annotation;
3873 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3876 ERR("Out of memory\n");
3881 annotation_handles[i] = get_parameter_handle(annotation);
3882 annotation->base = pass->base;
3884 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3887 WARN("Failed to parse annotations\n");
3893 if (pass->state_count)
3895 for (i = 0; i < pass->state_count; ++i)
3897 skip_dword_unknown(ptr, 4);
3902 pass->annotation_handles = annotation_handles;
3908 if (annotation_handles)
3910 for (i = 0; i < pass->annotation_count; ++i)
3912 free_parameter(annotation_handles[i], FALSE, FALSE);
3914 HeapFree(GetProcessHeap(), 0, annotation_handles);
3917 HeapFree(GetProcessHeap(), 0, name);
3922 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr)
3927 D3DXHANDLE *annotation_handles = NULL;
3928 D3DXHANDLE *pass_handles = NULL;
3931 read_dword(ptr, &offset);
3932 TRACE("Technique name offset: %#x\n", offset);
3933 hr = d3dx9_parse_name(&name, data + offset);
3936 WARN("Failed to parse name\n");
3940 read_dword(ptr, &technique->annotation_count);
3941 TRACE("Annotation count: %u\n", technique->annotation_count);
3943 read_dword(ptr, &technique->pass_count);
3944 TRACE("Pass count: %u\n", technique->pass_count);
3946 if (technique->annotation_count)
3948 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
3949 if (!annotation_handles)
3951 ERR("Out of memory\n");
3956 for (i = 0; i < technique->annotation_count; ++i)
3958 struct d3dx_parameter *annotation;
3960 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3963 ERR("Out of memory\n");
3968 annotation_handles[i] = get_parameter_handle(annotation);
3969 annotation->base = technique->base;
3971 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3974 WARN("Failed to parse annotations\n");
3980 if (technique->pass_count)
3982 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
3985 ERR("Out of memory\n");
3990 for (i = 0; i < technique->pass_count; ++i)
3992 struct d3dx_pass *pass;
3994 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
3997 ERR("Out of memory\n");
4002 pass_handles[i] = get_pass_handle(pass);
4003 pass->base = technique->base;
4005 hr = d3dx9_parse_effect_pass(pass, data, ptr);
4008 WARN("Failed to parse passes\n");
4014 technique->name = name;
4015 technique->pass_handles = pass_handles;
4016 technique->annotation_handles = annotation_handles;
4024 for (i = 0; i < technique->pass_count; ++i)
4026 free_pass(pass_handles[i]);
4028 HeapFree(GetProcessHeap(), 0, pass_handles);
4031 if (annotation_handles)
4033 for (i = 0; i < technique->annotation_count; ++i)
4035 free_parameter(annotation_handles[i], FALSE, FALSE);
4037 HeapFree(GetProcessHeap(), 0, annotation_handles);
4040 HeapFree(GetProcessHeap(), 0, name);
4045 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
4047 const char *ptr = data + start;
4048 D3DXHANDLE *parameter_handles = NULL;
4049 D3DXHANDLE *technique_handles = NULL;
4050 D3DXHANDLE *objects = NULL;
4051 unsigned int stringcount;
4055 read_dword(&ptr, &base->parameter_count);
4056 TRACE("Parameter count: %u\n", base->parameter_count);
4058 read_dword(&ptr, &base->technique_count);
4059 TRACE("Technique count: %u\n", base->technique_count);
4061 skip_dword_unknown(&ptr, 1);
4063 read_dword(&ptr, &base->object_count);
4064 TRACE("Object count: %u\n", base->object_count);
4066 objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * base->object_count);
4069 ERR("Out of memory\n");
4074 base->objects = objects;
4076 if (base->parameter_count)
4078 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
4079 if (!parameter_handles)
4081 ERR("Out of memory\n");
4086 for (i = 0; i < base->parameter_count; ++i)
4088 struct d3dx_parameter *parameter;
4090 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
4093 ERR("Out of memory\n");
4098 parameter_handles[i] = get_parameter_handle(parameter);
4099 parameter->base = base;
4101 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
4104 WARN("Failed to parse parameter\n");
4110 if (base->technique_count)
4112 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
4113 if (!technique_handles)
4115 ERR("Out of memory\n");
4120 for (i = 0; i < base->technique_count; ++i)
4122 struct d3dx_technique *technique;
4124 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
4127 ERR("Out of memory\n");
4132 technique_handles[i] = get_technique_handle(technique);
4133 technique->base = base;
4135 hr = d3dx9_parse_effect_technique(technique, data, &ptr);
4138 WARN("Failed to parse technique\n");
4144 read_dword(&ptr, &stringcount);
4145 TRACE("String count: %u\n", stringcount);
4147 skip_dword_unknown(&ptr, 1);
4149 for (i = 0; i < stringcount; ++i)
4152 struct d3dx_parameter *param;
4154 read_dword(&ptr, &id);
4155 TRACE("Id: %u\n", id);
4157 param = get_parameter_struct(base->objects[id]);
4159 hr = d3dx9_parse_data(param, &ptr);
4162 WARN("Failed to parse data\n");
4167 HeapFree(GetProcessHeap(), 0, objects);
4168 base->objects = NULL;
4170 base->technique_handles = technique_handles;
4171 base->parameter_handles = parameter_handles;
4177 if (technique_handles)
4179 for (i = 0; i < base->technique_count; ++i)
4181 free_technique(technique_handles[i]);
4183 HeapFree(GetProcessHeap(), 0, technique_handles);
4186 if (parameter_handles)
4188 for (i = 0; i < base->parameter_count; ++i)
4190 free_parameter(parameter_handles[i], FALSE, FALSE);
4192 HeapFree(GetProcessHeap(), 0, parameter_handles);
4195 HeapFree(GetProcessHeap(), 0, objects);
4200 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
4201 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
4204 const char *ptr = data;
4207 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
4209 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
4211 base->effect = effect;
4213 read_dword(&ptr, &tag);
4214 TRACE("Tag: %x\n", tag);
4216 if (tag != d3dx9_effect_version(9, 1))
4218 /* todo: compile hlsl ascii code */
4219 FIXME("HLSL ascii effects not supported, yet\n");
4221 /* Show the start of the shader for debugging info. */
4222 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
4226 read_dword(&ptr, &offset);
4227 TRACE("Offset: %x\n", offset);
4229 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
4232 FIXME("Failed to parse effect.\n");
4240 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
4241 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
4244 struct ID3DXBaseEffectImpl *object = NULL;
4246 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
4248 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
4251 if (pool) pool->lpVtbl->AddRef(pool);
4252 effect->pool = pool;
4254 IDirect3DDevice9_AddRef(device);
4255 effect->device = device;
4257 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4260 ERR("Out of memory\n");
4265 hr = d3dx9_base_effect_init(object, data, data_size, effect);
4268 FIXME("Failed to parse effect.\n");
4272 effect->base_effect = &object->ID3DXBaseEffect_iface;
4278 HeapFree(GetProcessHeap(), 0, object);
4279 free_effect(effect);
4284 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
4287 CONST D3DXMACRO* defines,
4288 LPD3DXINCLUDE include,
4289 LPCSTR skip_constants,
4291 LPD3DXEFFECTPOOL pool,
4292 LPD3DXEFFECT* effect,
4293 LPD3DXBUFFER* compilation_errors)
4295 struct ID3DXEffectImpl *object;
4298 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
4299 skip_constants, flags, pool, effect, compilation_errors);
4301 if (!device || !srcdata)
4302 return D3DERR_INVALIDCALL;
4307 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
4311 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4314 ERR("Out of memory\n");
4315 return E_OUTOFMEMORY;
4318 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
4321 WARN("Failed to initialize shader reflection\n");
4322 HeapFree(GetProcessHeap(), 0, object);
4326 *effect = &object->ID3DXEffect_iface;
4328 TRACE("Created ID3DXEffect %p\n", object);
4333 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
4336 CONST D3DXMACRO* defines,
4337 LPD3DXINCLUDE include,
4339 LPD3DXEFFECTPOOL pool,
4340 LPD3DXEFFECT* effect,
4341 LPD3DXBUFFER* compilation_errors)
4343 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
4344 include, flags, pool, effect, compilation_errors);
4346 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
4349 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
4352 struct ID3DXBaseEffectImpl *object = NULL;
4354 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
4356 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
4359 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4362 ERR("Out of memory\n");
4367 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
4370 FIXME("Failed to parse effect.\n");
4374 compiler->base_effect = &object->ID3DXBaseEffect_iface;
4380 HeapFree(GetProcessHeap(), 0, object);
4381 free_effect_compiler(compiler);
4386 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
4388 CONST D3DXMACRO *defines,
4389 LPD3DXINCLUDE include,
4391 LPD3DXEFFECTCOMPILER *compiler,
4392 LPD3DXBUFFER *parse_errors)
4394 struct ID3DXEffectCompilerImpl *object;
4397 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
4398 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
4400 if (!srcdata || !compiler)
4402 WARN("Invalid arguments supplied\n");
4403 return D3DERR_INVALIDCALL;
4406 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4409 ERR("Out of memory\n");
4410 return E_OUTOFMEMORY;
4413 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
4416 WARN("Failed to initialize effect compiler\n");
4417 HeapFree(GetProcessHeap(), 0, object);
4421 *compiler = &object->ID3DXEffectCompiler_iface;
4423 TRACE("Created ID3DXEffectCompiler %p\n", object);
4428 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
4430 struct ID3DXEffectPoolImpl
4432 ID3DXEffectPool ID3DXEffectPool_iface;
4436 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
4438 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
4441 /*** IUnknown methods ***/
4442 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
4444 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4446 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
4448 if (IsEqualGUID(riid, &IID_IUnknown) ||
4449 IsEqualGUID(riid, &IID_ID3DXEffectPool))
4451 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
4456 WARN("Interface %s not found\n", debugstr_guid(riid));
4458 return E_NOINTERFACE;
4461 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
4463 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4465 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
4467 return InterlockedIncrement(&This->ref);
4470 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
4472 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4473 ULONG ref = InterlockedDecrement(&This->ref);
4475 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
4478 HeapFree(GetProcessHeap(), 0, This);
4483 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
4485 /*** IUnknown methods ***/
4486 ID3DXEffectPoolImpl_QueryInterface,
4487 ID3DXEffectPoolImpl_AddRef,
4488 ID3DXEffectPoolImpl_Release
4491 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
4493 struct ID3DXEffectPoolImpl *object;
4495 TRACE("(%p)\n", pool);
4498 return D3DERR_INVALIDCALL;
4500 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4503 ERR("Out of memory\n");
4504 return E_OUTOFMEMORY;
4507 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
4510 *pool = &object->ID3DXEffectPool_iface;
4515 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4516 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4517 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4523 TRACE("(%s): relay\n", debugstr_w(srcfile));
4525 if (!device || !srcfile || !defines)
4526 return D3DERR_INVALIDCALL;
4528 ret = map_view_of_file(srcfile, &buffer, &size);
4531 return D3DXERR_INVALIDDATA;
4533 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4534 UnmapViewOfFile(buffer);
4539 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4540 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4541 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4547 TRACE("(void): relay\n");
4549 if (!srcfile || !defines)
4550 return D3DERR_INVALIDCALL;
4552 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4553 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4554 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4556 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4557 HeapFree(GetProcessHeap(), 0, srcfileW);
4562 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4563 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4564 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4566 TRACE("(void): relay\n");
4567 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4570 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4571 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4572 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4574 TRACE("(void): relay\n");
4575 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4578 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4579 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4580 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4584 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4586 if (!device || !defines)
4587 return D3DERR_INVALIDCALL;
4589 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4597 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4600 return D3DXERR_INVALIDDATA;
4602 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4605 return D3DXERR_INVALIDDATA;
4608 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4609 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4610 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4614 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4616 if (!device || !defines)
4617 return D3DERR_INVALIDCALL;
4619 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4627 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4630 return D3DXERR_INVALIDDATA;
4632 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4635 return D3DXERR_INVALIDDATA;
4638 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4639 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4640 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4642 TRACE("(void): relay\n");
4643 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4646 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4647 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4648 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4650 TRACE("(void): relay\n");
4651 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4654 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4655 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4661 TRACE("(%s): relay\n", debugstr_w(srcfile));
4663 if (!srcfile || !defines)
4664 return D3DERR_INVALIDCALL;
4666 ret = map_view_of_file(srcfile, &buffer, &size);
4669 return D3DXERR_INVALIDDATA;
4671 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4672 UnmapViewOfFile(buffer);
4677 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4678 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4684 TRACE("(void): relay\n");
4686 if (!srcfile || !defines)
4687 return D3DERR_INVALIDCALL;
4689 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4690 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4691 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4693 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
4694 HeapFree(GetProcessHeap(), 0, srcfileW);
4699 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
4700 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4704 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4706 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4714 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4717 return D3DXERR_INVALIDDATA;
4719 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4722 return D3DXERR_INVALIDDATA;
4725 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
4726 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4730 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4732 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4740 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4743 return D3DXERR_INVALIDDATA;
4745 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4748 return D3DXERR_INVALIDDATA;