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 d3dx_parameter *parameter, LPCSTR name);
117 static inline void read_dword(const char **ptr, DWORD *d)
119 memcpy(d, *ptr, sizeof(*d));
123 static void skip_dword_unknown(const char **ptr, unsigned int count)
128 FIXME("Skipping %u unknown DWORDs:\n", count);
129 for (i = 0; i < count; ++i)
132 FIXME("\t0x%08x\n", d);
136 static inline struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle)
138 return (struct d3dx_parameter *) handle;
141 static inline struct d3dx_pass *get_pass_struct(D3DXHANDLE handle)
143 return (struct d3dx_pass *) handle;
146 static inline struct d3dx_technique *get_technique_struct(D3DXHANDLE handle)
148 return (struct d3dx_technique *) handle;
151 static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
153 return (D3DXHANDLE) parameter;
156 static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique)
158 return (D3DXHANDLE) technique;
161 static inline D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
163 return (D3DXHANDLE) pass;
166 static struct d3dx_technique *is_valid_technique(struct ID3DXBaseEffectImpl *base, D3DXHANDLE technique)
170 for (i = 0; i < base->technique_count; ++i)
172 if (base->technique_handles[i] == technique)
174 return get_technique_struct(technique);
181 static struct d3dx_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
185 for (i = 0; i < base->technique_count; ++i)
187 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
189 for (k = 0; k < technique->pass_count; ++k)
191 if (technique->pass_handles[k] == pass)
193 return get_pass_struct(pass);
201 static struct d3dx_parameter *is_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter)
203 unsigned int i, count;
204 struct d3dx_parameter *p;
206 for (i = 0; i < param->annotation_count; ++i)
208 if (param->annotation_handles[i] == parameter)
210 return get_parameter_struct(parameter);
213 p = is_valid_sub_parameter(get_parameter_struct(param->annotation_handles[i]), parameter);
217 if (param->element_count) count = param->element_count;
218 else count = param->member_count;
220 for (i = 0; i < count; ++i)
222 if (param->member_handles[i] == parameter)
224 return get_parameter_struct(parameter);
227 p = is_valid_sub_parameter(get_parameter_struct(param->member_handles[i]), parameter);
234 static struct d3dx_parameter *is_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
236 unsigned int i, k, m;
237 struct d3dx_parameter *p;
239 for (i = 0; i < base->parameter_count; ++i)
241 if (base->parameter_handles[i] == parameter)
243 return get_parameter_struct(parameter);
246 p = is_valid_sub_parameter(get_parameter_struct(base->parameter_handles[i]), parameter);
250 for (i = 0; i < base->technique_count; ++i)
252 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
254 for (k = 0; k < technique->pass_count; ++k)
256 struct d3dx_pass *pass = get_pass_struct(technique->pass_handles[k]);
258 for (m = 0; m < pass->annotation_count; ++m)
260 if (pass->annotation_handles[i] == parameter)
262 return get_parameter_struct(parameter);
265 p = is_valid_sub_parameter(get_parameter_struct(pass->annotation_handles[m]), parameter);
270 for (k = 0; k < technique->annotation_count; ++k)
272 if (technique->annotation_handles[k] == parameter)
274 return get_parameter_struct(parameter);
277 p = is_valid_sub_parameter(get_parameter_struct(technique->annotation_handles[k]), parameter);
285 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
288 struct d3dx_parameter *param = get_parameter_struct(handle);
290 TRACE("Free parameter %p, child %s\n", param, child ? "yes" : "no");
297 if (param->annotation_handles)
299 for (i = 0; i < param->annotation_count; ++i)
301 free_parameter(param->annotation_handles[i], FALSE, FALSE);
303 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
306 if (param->member_handles)
310 if (param->element_count) count = param->element_count;
311 else count = param->member_count;
313 for (i = 0; i < count; ++i)
315 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
317 HeapFree(GetProcessHeap(), 0, param->member_handles);
320 if (param->class == D3DXPC_OBJECT && !param->element_count)
325 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
329 case D3DXPT_TEXTURE1D:
330 case D3DXPT_TEXTURE2D:
331 case D3DXPT_TEXTURE3D:
332 case D3DXPT_TEXTURECUBE:
333 case D3DXPT_PIXELSHADER:
334 case D3DXPT_VERTEXSHADER:
335 if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data);
339 case D3DXPT_SAMPLER1D:
340 case D3DXPT_SAMPLER2D:
341 case D3DXPT_SAMPLER3D:
342 case D3DXPT_SAMPLERCUBE:
343 /* Todo: free sampler */
347 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
354 HeapFree(GetProcessHeap(), 0, param->data);
357 /* only the parent has to release name and semantic */
360 HeapFree(GetProcessHeap(), 0, param->name);
361 HeapFree(GetProcessHeap(), 0, param->semantic);
364 HeapFree(GetProcessHeap(), 0, param);
367 static void free_pass(D3DXHANDLE handle)
370 struct d3dx_pass *pass = get_pass_struct(handle);
372 TRACE("Free pass %p\n", pass);
379 if (pass->annotation_handles)
381 for (i = 0; i < pass->annotation_count; ++i)
383 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
385 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
388 HeapFree(GetProcessHeap(), 0, pass->name);
389 HeapFree(GetProcessHeap(), 0, pass);
392 static void free_technique(D3DXHANDLE handle)
395 struct d3dx_technique *technique = get_technique_struct(handle);
397 TRACE("Free technique %p\n", technique);
404 if (technique->annotation_handles)
406 for (i = 0; i < technique->annotation_count; ++i)
408 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
410 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
413 if (technique->pass_handles)
415 for (i = 0; i < technique->pass_count; ++i)
417 free_pass(technique->pass_handles[i]);
419 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
422 HeapFree(GetProcessHeap(), 0, technique->name);
423 HeapFree(GetProcessHeap(), 0, technique);
426 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
430 TRACE("Free base effect %p\n", base);
432 if (base->parameter_handles)
434 for (i = 0; i < base->parameter_count; ++i)
436 free_parameter(base->parameter_handles[i], FALSE, FALSE);
438 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
441 if (base->technique_handles)
443 for (i = 0; i < base->technique_count; ++i)
445 free_technique(base->technique_handles[i]);
447 HeapFree(GetProcessHeap(), 0, base->technique_handles);
451 static void free_effect(struct ID3DXEffectImpl *effect)
453 TRACE("Free effect %p\n", effect);
455 if (effect->base_effect)
457 effect->base_effect->lpVtbl->Release(effect->base_effect);
462 effect->pool->lpVtbl->Release(effect->pool);
467 IUnknown_Release(effect->manager);
470 IDirect3DDevice9_Release(effect->device);
473 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
475 TRACE("Free effect compiler %p\n", compiler);
477 if (compiler->base_effect)
479 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
483 static INT get_int(D3DXPARAMETER_TYPE type, void *data)
503 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type));
510 inline static FLOAT get_float(D3DXPARAMETER_TYPE type, void *data)
530 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type));
537 static inline BOOL get_bool(void *data)
539 return (*(DWORD *)data) ? TRUE : FALSE;
542 static struct d3dx_parameter *get_parameter_element_by_name(struct d3dx_parameter *parameter, LPCSTR name)
545 struct d3dx_parameter *temp_parameter;
548 TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
550 if (!name || !*name) return parameter;
552 element = atoi(name);
553 part = strchr(name, ']') + 1;
555 if (parameter->element_count > element)
557 temp_parameter = get_parameter_struct(parameter->member_handles[element]);
562 return get_parameter_by_name(NULL, temp_parameter, part);
565 return get_parameter_annotation_by_name(temp_parameter, part);
568 TRACE("Returning parameter %p\n", temp_parameter);
569 return temp_parameter;
572 FIXME("Unhandled case \"%c\"\n", *--part);
577 TRACE("Parameter not found\n");
581 static struct d3dx_parameter *get_parameter_annotation_by_name(struct d3dx_parameter *parameter, LPCSTR name)
584 struct d3dx_parameter *temp_parameter;
587 TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
589 if (!name || !*name) return parameter;
591 length = strcspn( name, "[.@" );
592 part = name + length;
594 for (i = 0; i < parameter->annotation_count; ++i)
596 temp_parameter = get_parameter_struct(parameter->annotation_handles[i]);
598 if (!strcmp(temp_parameter->name, name))
600 TRACE("Returning parameter %p\n", temp_parameter);
601 return temp_parameter;
603 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
608 return get_parameter_by_name(NULL, temp_parameter, part);
611 return get_parameter_element_by_name(temp_parameter, part);
614 FIXME("Unhandled case \"%c\"\n", *--part);
620 TRACE("Parameter not found\n");
624 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
625 struct d3dx_parameter *parameter, LPCSTR name)
627 UINT i, count, length;
628 struct d3dx_parameter *temp_parameter;
632 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
634 if (!name || !*name) return parameter;
638 count = base->parameter_count;
639 handles = base->parameter_handles;
643 count = parameter->member_count;
644 handles = parameter->member_handles;
647 length = strcspn( name, "[.@" );
648 part = name + length;
650 for (i = 0; i < count; i++)
652 temp_parameter = get_parameter_struct(handles[i]);
654 if (!strcmp(temp_parameter->name, name))
656 TRACE("Returning parameter %p\n", temp_parameter);
657 return temp_parameter;
659 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
664 return get_parameter_by_name(NULL, temp_parameter, part);
667 return get_parameter_annotation_by_name(temp_parameter, part);
670 return get_parameter_element_by_name(temp_parameter, part);
673 FIXME("Unhandled case \"%c\"\n", *--part);
679 TRACE("Parameter not found\n");
683 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
685 return (0xfeff0000 | ((major) << 8) | (minor));
688 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
690 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
693 /*** IUnknown methods ***/
694 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
696 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
698 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
700 if (IsEqualGUID(riid, &IID_IUnknown) ||
701 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
703 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
708 ERR("Interface %s not found\n", debugstr_guid(riid));
710 return E_NOINTERFACE;
713 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
715 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
717 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
719 return InterlockedIncrement(&This->ref);
722 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
724 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
725 ULONG ref = InterlockedDecrement(&This->ref);
727 TRACE("iface %p: Release from %u\n", iface, ref + 1);
731 free_base_effect(This);
732 HeapFree(GetProcessHeap(), 0, This);
738 /*** ID3DXBaseEffect methods ***/
739 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
741 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
743 FIXME("iface %p, desc %p partial stub\n", This, desc);
747 WARN("Invalid argument specified.\n");
748 return D3DERR_INVALIDCALL;
751 /* Todo: add creator and function count */
752 desc->Creator = NULL;
754 desc->Parameters = This->parameter_count;
755 desc->Techniques = This->technique_count;
760 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
762 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
763 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
765 TRACE("iface %p, parameter %p, desc %p\n", This, parameter, desc);
767 if (!param) param = get_parameter_struct(iface->lpVtbl->GetParameterByName(iface, NULL, parameter));
771 WARN("Invalid argument specified.\n");
772 return D3DERR_INVALIDCALL;
775 desc->Name = param->name;
776 desc->Semantic = param->semantic;
777 desc->Class = param->class;
778 desc->Type = param->type;
779 desc->Rows = param->rows;
780 desc->Columns = param->columns;
781 desc->Elements = param->element_count;
782 desc->Annotations = param->annotation_count;
783 desc->StructMembers = param->member_count;
784 desc->Flags = param->flags;
785 desc->Bytes = param->bytes;
790 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
792 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
793 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
795 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
799 WARN("Invalid argument specified.\n");
800 return D3DERR_INVALIDCALL;
803 desc->Name = tech->name;
804 desc->Passes = tech->pass_count;
805 desc->Annotations = tech->annotation_count;
810 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
812 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
813 struct d3dx_pass *p = is_valid_pass(This, pass);
815 TRACE("iface %p, pass %p, desc %p\n", This, pass, desc);
819 WARN("Invalid argument specified.\n");
820 return D3DERR_INVALIDCALL;
823 desc->Name = p->name;
824 desc->Annotations = p->annotation_count;
826 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
827 desc->pVertexShaderFunction = NULL;
828 desc->pPixelShaderFunction = NULL;
833 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
835 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
837 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
842 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
844 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
845 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
847 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
849 if (!param) param = get_parameter_by_name(This, NULL, parameter);
853 if (index < This->parameter_count)
855 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
856 return This->parameter_handles[index];
861 if (param && !param->element_count && index < param->member_count)
863 TRACE("Returning parameter %p\n", param->member_handles[index]);
864 return param->member_handles[index];
868 WARN("Invalid argument specified.\n");
873 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
875 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
876 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
879 TRACE("iface %p, parameter %p, name %s\n", This, parameter, debugstr_a(name));
881 if (!param) param = get_parameter_by_name(This, NULL, parameter);
885 handle = get_parameter_handle(param);
886 TRACE("Returning parameter %p\n", handle);
890 handle = get_parameter_handle(get_parameter_by_name(This, param, name));
891 TRACE("Returning parameter %p\n", handle);
896 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
898 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
899 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
900 struct d3dx_parameter *temp_param;
903 TRACE("iface %p, parameter %p, semantic %s\n", This, parameter, debugstr_a(semantic));
905 if (!param) param = get_parameter_by_name(This, NULL, parameter);
909 for (i = 0; i < This->parameter_count; ++i)
911 temp_param = get_parameter_struct(This->parameter_handles[i]);
913 if (!temp_param->semantic)
917 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
918 return This->parameter_handles[i];
923 if (!strcasecmp(temp_param->semantic, semantic))
925 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
926 return This->parameter_handles[i];
932 for (i = 0; i < param->member_count; ++i)
934 temp_param = get_parameter_struct(param->member_handles[i]);
936 if (!temp_param->semantic)
940 TRACE("Returning parameter %p\n", param->member_handles[i]);
941 return param->member_handles[i];
946 if (!strcasecmp(temp_param->semantic, semantic))
948 TRACE("Returning parameter %p\n", param->member_handles[i]);
949 return param->member_handles[i];
954 WARN("Invalid argument specified\n");
959 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
961 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
962 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
964 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
966 if (!param) param = get_parameter_by_name(This, NULL, parameter);
970 if (index < This->parameter_count)
972 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
973 return This->parameter_handles[index];
978 if (index < param->element_count)
980 TRACE("Returning parameter %p\n", param->member_handles[index]);
981 return param->member_handles[index];
985 WARN("Invalid argument specified\n");
990 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
992 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
994 TRACE("iface %p, index %u\n", This, index);
996 if (index >= This->technique_count)
998 WARN("Invalid argument specified.\n");
1002 TRACE("Returning technique %p\n", This->technique_handles[index]);
1004 return This->technique_handles[index];
1007 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
1009 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1012 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
1016 WARN("Invalid argument specified.\n");
1020 for (i = 0; i < This->technique_count; ++i)
1022 struct d3dx_technique *tech = get_technique_struct(This->technique_handles[i]);
1024 if (!strcmp(tech->name, name))
1026 TRACE("Returning technique %p\n", This->technique_handles[i]);
1027 return This->technique_handles[i];
1031 WARN("Invalid argument specified.\n");
1036 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
1038 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1039 struct d3dx_technique *tech = is_valid_technique(This, technique);
1041 TRACE("iface %p, technique %p, index %u\n", This, technique, index);
1043 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
1045 if (tech && index < tech->pass_count)
1047 TRACE("Returning pass %p\n", tech->pass_handles[index]);
1048 return tech->pass_handles[index];
1051 WARN("Invalid argument specified.\n");
1056 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
1058 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1059 struct d3dx_technique *tech = is_valid_technique(This, technique);
1061 TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
1063 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
1069 for (i = 0; i < tech->pass_count; ++i)
1071 struct d3dx_pass *pass = get_pass_struct(tech->pass_handles[i]);
1073 if (!strcmp(pass->name, name))
1075 TRACE("Returning pass %p\n", tech->pass_handles[i]);
1076 return tech->pass_handles[i];
1081 WARN("Invalid argument specified.\n");
1086 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
1088 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1090 FIXME("iface %p, index %u stub\n", This, index);
1095 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
1097 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1099 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
1104 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
1106 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1107 struct d3dx_parameter *param = is_valid_parameter(This, object);
1108 struct d3dx_pass *pass = is_valid_pass(This, object);
1109 struct d3dx_technique *technique = is_valid_technique(This, object);
1110 UINT annotation_count = 0;
1111 D3DXHANDLE *annotation_handles = NULL;
1113 FIXME("iface %p, object %p, index %u partial stub\n", This, object, index);
1117 annotation_count = pass->annotation_count;
1118 annotation_handles = pass->annotation_handles;
1122 annotation_count = technique->annotation_count;
1123 annotation_handles = technique->annotation_handles;
1127 if (!param) param = get_parameter_by_name(This, NULL, object);
1131 annotation_count = param->annotation_count;
1132 annotation_handles = param->annotation_handles;
1135 /* Todo: add funcs */
1137 if (index < annotation_count)
1139 TRACE("Returning parameter %p\n", annotation_handles[index]);
1140 return annotation_handles[index];
1143 WARN("Invalid argument specified\n");
1148 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
1150 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1151 struct d3dx_parameter *param = is_valid_parameter(This, object);
1152 struct d3dx_pass *pass = is_valid_pass(This, object);
1153 struct d3dx_technique *technique = is_valid_technique(This, object);
1154 UINT annotation_count = 0, i;
1155 D3DXHANDLE *annotation_handles = NULL;
1157 FIXME("iface %p, object %p, name %s partial stub\n", This, object, debugstr_a(name));
1161 WARN("Invalid argument specified\n");
1167 annotation_count = pass->annotation_count;
1168 annotation_handles = pass->annotation_handles;
1172 annotation_count = technique->annotation_count;
1173 annotation_handles = technique->annotation_handles;
1177 if (!param) param = get_parameter_by_name(This, NULL, object);
1181 annotation_count = param->annotation_count;
1182 annotation_handles = param->annotation_handles;
1185 /* Todo: add funcs */
1187 for (i = 0; i < annotation_count; i++)
1189 struct d3dx_parameter *anno = get_parameter_struct(annotation_handles[i]);
1191 if (!strcmp(anno->name, name))
1193 TRACE("Returning parameter %p\n", anno);
1194 return get_parameter_handle(anno);
1198 WARN("Invalid argument specified\n");
1203 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1205 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1207 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
1212 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1214 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1215 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1217 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1219 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1221 /* samplers don't touch data */
1222 if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
1223 || param->type == D3DXPT_SAMPLER1D || param->type == D3DXPT_SAMPLER2D
1224 || param->type == D3DXPT_SAMPLER3D || param->type == D3DXPT_SAMPLERCUBE))
1226 TRACE("Sampler: returning E_FAIL\n");
1230 if (data && param && param->bytes <= bytes)
1232 TRACE("Type %s\n", debug_d3dxparameter_type(param->type));
1234 switch (param->type)
1243 case D3DXPT_VERTEXSHADER:
1244 case D3DXPT_PIXELSHADER:
1245 case D3DXPT_TEXTURE:
1246 case D3DXPT_TEXTURE1D:
1247 case D3DXPT_TEXTURE2D:
1248 case D3DXPT_TEXTURE3D:
1249 case D3DXPT_TEXTURECUBE:
1253 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
1255 IUnknown *unk = ((IUnknown **)param->data)[i];
1256 if (unk) IUnknown_AddRef(unk);
1262 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
1266 TRACE("Copy %u bytes\n", param->bytes);
1267 memcpy(data, param->data, param->bytes);
1271 WARN("Invalid argument specified\n");
1273 return D3DERR_INVALIDCALL;
1276 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
1278 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1280 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
1285 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
1287 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1288 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1290 TRACE("iface %p, parameter %p, b %p\n", This, parameter, b);
1292 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1294 if (b && param && !param->element_count && param->class == D3DXPC_SCALAR)
1296 *b = get_bool(param->data);
1297 TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
1301 WARN("Invalid argument specified\n");
1303 return D3DERR_INVALIDCALL;
1306 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1308 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1310 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1315 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1317 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1319 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1324 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
1326 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1328 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
1333 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1335 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1336 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1338 TRACE("iface %p, parameter %p, n %p\n", This, parameter, n);
1340 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1342 if (n && param && !param->element_count && param->class == D3DXPC_SCALAR)
1344 *n = get_int(param->type, param->data);
1345 TRACE("Returning %i\n", *n);
1349 WARN("Invalid argument specified\n");
1351 return D3DERR_INVALIDCALL;
1354 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1356 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1358 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1363 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1365 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1367 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1372 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1374 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1376 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
1381 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1383 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1384 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1386 TRACE("iface %p, parameter %p, f %p\n", This, parameter, f);
1388 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1390 if (f && param && !param->element_count && param->class == D3DXPC_SCALAR)
1393 TRACE("Returning %f\n", *f);
1397 WARN("Invalid argument specified\n");
1399 return D3DERR_INVALIDCALL;
1402 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1404 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1406 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1411 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1413 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1415 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1420 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
1422 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1424 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1429 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1431 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1433 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1438 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1440 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1442 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1447 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1449 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1451 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1456 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1458 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1460 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1465 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1467 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1469 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1474 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1476 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1478 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1483 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1485 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1487 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1492 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1494 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1496 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1501 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1503 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1505 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1510 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1512 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1514 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1519 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1521 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1523 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1528 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1530 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1532 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1537 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1539 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1541 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1546 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1548 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1550 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1555 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1557 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1559 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1564 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1566 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1568 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1573 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1575 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1576 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1578 TRACE("iface %p, parameter %p, string %p\n", This, parameter, string);
1580 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1582 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
1584 *string = *(LPCSTR *)param->data;
1585 TRACE("Returning %s\n", debugstr_a(*string));
1589 WARN("Invalid argument specified\n");
1591 return D3DERR_INVALIDCALL;
1594 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1596 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1598 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1603 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1605 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1606 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1608 TRACE("iface %p, parameter %p, texture %p\n", This, parameter, texture);
1610 if (texture && param && !param->element_count &&
1611 (param->type == D3DXPT_TEXTURE || param->type == D3DXPT_TEXTURE1D
1612 || param->type == D3DXPT_TEXTURE2D || param->type == D3DXPT_TEXTURE3D
1613 || param->type == D3DXPT_TEXTURECUBE))
1615 *texture = *(LPDIRECT3DBASETEXTURE9 *)param->data;
1616 if (*texture) IDirect3DBaseTexture9_AddRef(*texture);
1617 TRACE("Returning %p\n", *texture);
1621 WARN("Invalid argument specified\n");
1623 return D3DERR_INVALIDCALL;
1626 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1628 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1629 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1631 TRACE("iface %p, parameter %p, pshader %p\n", This, parameter, pshader);
1633 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1635 if (pshader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
1637 *pshader = *(LPDIRECT3DPIXELSHADER9 *)param->data;
1638 if (*pshader) IDirect3DPixelShader9_AddRef(*pshader);
1639 TRACE("Returning %p\n", *pshader);
1643 WARN("Invalid argument specified\n");
1645 return D3DERR_INVALIDCALL;
1648 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1650 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1651 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1653 TRACE("iface %p, parameter %p, vshader %p\n", This, parameter, vshader);
1655 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1657 if (vshader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
1659 *vshader = *(LPDIRECT3DVERTEXSHADER9 *)param->data;
1660 if (*vshader) IDirect3DVertexShader9_AddRef(*vshader);
1661 TRACE("Returning %p\n", *vshader);
1665 WARN("Invalid argument specified\n");
1667 return D3DERR_INVALIDCALL;
1670 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1672 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1674 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
1679 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
1681 /*** IUnknown methods ***/
1682 ID3DXBaseEffectImpl_QueryInterface,
1683 ID3DXBaseEffectImpl_AddRef,
1684 ID3DXBaseEffectImpl_Release,
1685 /*** ID3DXBaseEffect methods ***/
1686 ID3DXBaseEffectImpl_GetDesc,
1687 ID3DXBaseEffectImpl_GetParameterDesc,
1688 ID3DXBaseEffectImpl_GetTechniqueDesc,
1689 ID3DXBaseEffectImpl_GetPassDesc,
1690 ID3DXBaseEffectImpl_GetFunctionDesc,
1691 ID3DXBaseEffectImpl_GetParameter,
1692 ID3DXBaseEffectImpl_GetParameterByName,
1693 ID3DXBaseEffectImpl_GetParameterBySemantic,
1694 ID3DXBaseEffectImpl_GetParameterElement,
1695 ID3DXBaseEffectImpl_GetTechnique,
1696 ID3DXBaseEffectImpl_GetTechniqueByName,
1697 ID3DXBaseEffectImpl_GetPass,
1698 ID3DXBaseEffectImpl_GetPassByName,
1699 ID3DXBaseEffectImpl_GetFunction,
1700 ID3DXBaseEffectImpl_GetFunctionByName,
1701 ID3DXBaseEffectImpl_GetAnnotation,
1702 ID3DXBaseEffectImpl_GetAnnotationByName,
1703 ID3DXBaseEffectImpl_SetValue,
1704 ID3DXBaseEffectImpl_GetValue,
1705 ID3DXBaseEffectImpl_SetBool,
1706 ID3DXBaseEffectImpl_GetBool,
1707 ID3DXBaseEffectImpl_SetBoolArray,
1708 ID3DXBaseEffectImpl_GetBoolArray,
1709 ID3DXBaseEffectImpl_SetInt,
1710 ID3DXBaseEffectImpl_GetInt,
1711 ID3DXBaseEffectImpl_SetIntArray,
1712 ID3DXBaseEffectImpl_GetIntArray,
1713 ID3DXBaseEffectImpl_SetFloat,
1714 ID3DXBaseEffectImpl_GetFloat,
1715 ID3DXBaseEffectImpl_SetFloatArray,
1716 ID3DXBaseEffectImpl_GetFloatArray,
1717 ID3DXBaseEffectImpl_SetVector,
1718 ID3DXBaseEffectImpl_GetVector,
1719 ID3DXBaseEffectImpl_SetVectorArray,
1720 ID3DXBaseEffectImpl_GetVectorArray,
1721 ID3DXBaseEffectImpl_SetMatrix,
1722 ID3DXBaseEffectImpl_GetMatrix,
1723 ID3DXBaseEffectImpl_SetMatrixArray,
1724 ID3DXBaseEffectImpl_GetMatrixArray,
1725 ID3DXBaseEffectImpl_SetMatrixPointerArray,
1726 ID3DXBaseEffectImpl_GetMatrixPointerArray,
1727 ID3DXBaseEffectImpl_SetMatrixTranspose,
1728 ID3DXBaseEffectImpl_GetMatrixTranspose,
1729 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
1730 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
1731 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
1732 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
1733 ID3DXBaseEffectImpl_SetString,
1734 ID3DXBaseEffectImpl_GetString,
1735 ID3DXBaseEffectImpl_SetTexture,
1736 ID3DXBaseEffectImpl_GetTexture,
1737 ID3DXBaseEffectImpl_GetPixelShader,
1738 ID3DXBaseEffectImpl_GetVertexShader,
1739 ID3DXBaseEffectImpl_SetArrayRange,
1742 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
1744 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
1747 /*** IUnknown methods ***/
1748 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
1750 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1752 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
1754 if (IsEqualGUID(riid, &IID_IUnknown) ||
1755 IsEqualGUID(riid, &IID_ID3DXEffect))
1757 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
1762 ERR("Interface %s not found\n", debugstr_guid(riid));
1764 return E_NOINTERFACE;
1767 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
1769 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1771 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1773 return InterlockedIncrement(&This->ref);
1776 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
1778 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1779 ULONG ref = InterlockedDecrement(&This->ref);
1781 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
1786 HeapFree(GetProcessHeap(), 0, This);
1792 /*** ID3DXBaseEffect methods ***/
1793 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
1795 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1796 ID3DXBaseEffect *base = This->base_effect;
1798 TRACE("Forward iface %p, base %p\n", This, base);
1800 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1803 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1805 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1806 ID3DXBaseEffect *base = This->base_effect;
1808 TRACE("Forward iface %p, base %p\n", This, base);
1810 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1813 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1815 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1816 ID3DXBaseEffect *base = This->base_effect;
1818 TRACE("Forward iface %p, base %p\n", This, base);
1820 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1823 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1825 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1826 ID3DXBaseEffect *base = This->base_effect;
1828 TRACE("Forward iface %p, base %p\n", This, base);
1830 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1833 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1835 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1836 ID3DXBaseEffect *base = This->base_effect;
1838 TRACE("Forward iface %p, base %p\n", This, base);
1840 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1843 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1845 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1846 ID3DXBaseEffect *base = This->base_effect;
1848 TRACE("Forward iface %p, base %p\n", This, base);
1850 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1853 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1855 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1856 ID3DXBaseEffect *base = This->base_effect;
1858 TRACE("Forward iface %p, base %p\n", This, base);
1860 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1863 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1865 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1866 ID3DXBaseEffect *base = This->base_effect;
1868 TRACE("Forward iface %p, base %p\n", This, base);
1870 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1873 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1875 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1876 ID3DXBaseEffect *base = This->base_effect;
1878 TRACE("Forward iface %p, base %p\n", This, base);
1880 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1883 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
1885 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1886 ID3DXBaseEffect *base = This->base_effect;
1888 TRACE("Forward iface %p, base %p\n", This, base);
1890 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1893 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
1895 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1896 ID3DXBaseEffect *base = This->base_effect;
1898 TRACE("Forward iface %p, base %p\n", This, base);
1900 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1903 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
1905 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1906 ID3DXBaseEffect *base = This->base_effect;
1908 TRACE("Forward iface %p, base %p\n", This, base);
1910 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1913 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
1915 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1916 ID3DXBaseEffect *base = This->base_effect;
1918 TRACE("Forward iface %p, base %p\n", This, base);
1920 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1923 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
1925 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1926 ID3DXBaseEffect *base = This->base_effect;
1928 TRACE("Forward iface %p, base %p\n", This, base);
1930 return ID3DXBaseEffectImpl_GetFunction(base, index);
1933 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1935 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1936 ID3DXBaseEffect *base = This->base_effect;
1938 TRACE("Forward iface %p, base %p\n", This, base);
1940 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1943 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1945 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1946 ID3DXBaseEffect *base = This->base_effect;
1948 TRACE("Forward iface %p, base %p\n", This, base);
1950 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1953 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1955 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1956 ID3DXBaseEffect *base = This->base_effect;
1958 TRACE("Forward iface %p, base %p\n", This, base);
1960 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1963 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1965 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1966 ID3DXBaseEffect *base = This->base_effect;
1968 TRACE("Forward iface %p, base %p\n", This, base);
1970 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1973 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1975 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1976 ID3DXBaseEffect *base = This->base_effect;
1978 TRACE("Forward iface %p, base %p\n", This, base);
1980 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1983 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1985 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1986 ID3DXBaseEffect *base = This->base_effect;
1988 TRACE("Forward iface %p, base %p\n", This, base);
1990 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1993 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1995 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1996 ID3DXBaseEffect *base = This->base_effect;
1998 TRACE("Forward iface %p, base %p\n", This, base);
2000 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2003 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2005 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2006 ID3DXBaseEffect *base = This->base_effect;
2008 TRACE("Forward iface %p, base %p\n", This, base);
2010 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2013 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2015 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2016 ID3DXBaseEffect *base = This->base_effect;
2018 TRACE("Forward iface %p, base %p\n", This, base);
2020 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2023 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
2025 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2026 ID3DXBaseEffect *base = This->base_effect;
2028 TRACE("Forward iface %p, base %p\n", This, base);
2030 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2033 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
2035 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2036 ID3DXBaseEffect *base = This->base_effect;
2038 TRACE("Forward iface %p, base %p\n", This, base);
2040 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2043 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2045 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2046 ID3DXBaseEffect *base = This->base_effect;
2048 TRACE("Forward iface %p, base %p\n", This, base);
2050 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2053 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
2055 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2056 ID3DXBaseEffect *base = This->base_effect;
2058 TRACE("Forward iface %p, base %p\n", This, base);
2060 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2063 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
2065 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2066 ID3DXBaseEffect *base = This->base_effect;
2068 TRACE("Forward iface %p, base %p\n", This, base);
2070 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2073 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
2075 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2076 ID3DXBaseEffect *base = This->base_effect;
2078 TRACE("Forward iface %p, base %p\n", This, base);
2080 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2083 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2085 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2086 ID3DXBaseEffect *base = This->base_effect;
2088 TRACE("Forward iface %p, base %p\n", This, base);
2090 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2093 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2095 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2096 ID3DXBaseEffect *base = This->base_effect;
2098 TRACE("Forward iface %p, base %p\n", This, base);
2100 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2103 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2105 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2106 ID3DXBaseEffect *base = This->base_effect;
2108 TRACE("Forward iface %p, base %p\n", This, base);
2110 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2113 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2115 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2116 ID3DXBaseEffect *base = This->base_effect;
2118 TRACE("Forward iface %p, base %p\n", This, base);
2120 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2123 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2125 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2126 ID3DXBaseEffect *base = This->base_effect;
2128 TRACE("Forward iface %p, base %p\n", This, base);
2130 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2133 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2135 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2136 ID3DXBaseEffect *base = This->base_effect;
2138 TRACE("Forward iface %p, base %p\n", This, base);
2140 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2143 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2145 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2146 ID3DXBaseEffect *base = This->base_effect;
2148 TRACE("Forward iface %p, base %p\n", This, base);
2150 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2153 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2155 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2156 ID3DXBaseEffect *base = This->base_effect;
2158 TRACE("Forward iface %p, base %p\n", This, base);
2160 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2163 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2165 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2166 ID3DXBaseEffect *base = This->base_effect;
2168 TRACE("Forward iface %p, base %p\n", This, base);
2170 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2173 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2175 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2176 ID3DXBaseEffect *base = This->base_effect;
2178 TRACE("Forward iface %p, base %p\n", This, base);
2180 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2183 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2185 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2186 ID3DXBaseEffect *base = This->base_effect;
2188 TRACE("Forward iface %p, base %p\n", This, base);
2190 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2193 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2195 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2196 ID3DXBaseEffect *base = This->base_effect;
2198 TRACE("Forward iface %p, base %p\n", This, base);
2200 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2203 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2205 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2206 ID3DXBaseEffect *base = This->base_effect;
2208 TRACE("Forward iface %p, base %p\n", This, base);
2210 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2213 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2215 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2216 ID3DXBaseEffect *base = This->base_effect;
2218 TRACE("Forward iface %p, base %p\n", This, base);
2220 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2223 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2225 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2226 ID3DXBaseEffect *base = This->base_effect;
2228 TRACE("Forward iface %p, base %p\n", This, base);
2230 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2233 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2235 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2236 ID3DXBaseEffect *base = This->base_effect;
2238 TRACE("Forward iface %p, base %p\n", This, base);
2240 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2243 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2245 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2246 ID3DXBaseEffect *base = This->base_effect;
2248 TRACE("Forward iface %p, base %p\n", This, base);
2250 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2253 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2255 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2256 ID3DXBaseEffect *base = This->base_effect;
2258 TRACE("Forward iface %p, base %p\n", This, base);
2260 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2263 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
2265 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2266 ID3DXBaseEffect *base = This->base_effect;
2268 TRACE("Forward iface %p, base %p\n", This, base);
2270 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2273 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
2275 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2276 ID3DXBaseEffect *base = This->base_effect;
2278 TRACE("Forward iface %p, base %p\n", This, base);
2280 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2283 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2285 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2286 ID3DXBaseEffect *base = This->base_effect;
2288 TRACE("Forward iface %p, base %p\n", This, base);
2290 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2293 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2295 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2296 ID3DXBaseEffect *base = This->base_effect;
2298 TRACE("Forward iface %p, base %p\n", This, base);
2300 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2303 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2305 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2306 ID3DXBaseEffect *base = This->base_effect;
2308 TRACE("Forward iface %p, base %p\n", This, base);
2310 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2313 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2315 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2316 ID3DXBaseEffect *base = This->base_effect;
2318 TRACE("Forward iface %p, base %p\n", This, base);
2320 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2323 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2325 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2326 ID3DXBaseEffect *base = This->base_effect;
2328 TRACE("Forward iface %p, base %p\n", This, base);
2330 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2333 /*** ID3DXEffect methods ***/
2334 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
2336 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2338 TRACE("iface %p, pool %p\n", This, pool);
2342 WARN("Invalid argument supplied.\n");
2343 return D3DERR_INVALIDCALL;
2348 This->pool->lpVtbl->AddRef(This->pool);
2353 TRACE("Returning pool %p\n", *pool);
2358 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2360 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2362 FIXME("(%p)->(%p): stub\n", This, technique);
2367 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
2369 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2371 FIXME("(%p)->(): stub\n", This);
2376 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2378 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2380 FIXME("(%p)->(%p): stub\n", This, technique);
2385 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
2387 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2389 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
2394 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
2396 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2398 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
2403 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
2405 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2407 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
2412 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
2414 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2416 FIXME("(%p)->(%u): stub\n", This, pass);
2421 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
2423 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2425 FIXME("(%p)->(): stub\n", This);
2430 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
2432 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2434 FIXME("(%p)->(): stub\n", This);
2439 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
2441 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2443 FIXME("(%p)->(): stub\n", This);
2448 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
2450 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2452 TRACE("iface %p, device %p\n", This, device);
2456 WARN("Invalid argument supplied.\n");
2457 return D3DERR_INVALIDCALL;
2460 IDirect3DDevice9_AddRef(This->device);
2462 *device = This->device;
2464 TRACE("Returning device %p\n", *device);
2469 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
2471 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2473 FIXME("(%p)->(): stub\n", This);
2478 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
2480 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2482 FIXME("(%p)->(): stub\n", This);
2487 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect *iface, LPD3DXEFFECTSTATEMANAGER manager)
2489 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2491 TRACE("iface %p, manager %p\n", This, manager);
2493 if (This->manager) IUnknown_Release(This->manager);
2494 if (manager) IUnknown_AddRef(manager);
2496 This->manager = manager;
2501 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect *iface, LPD3DXEFFECTSTATEMANAGER *manager)
2503 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2505 TRACE("iface %p, manager %p\n", This, manager);
2509 WARN("Invalid argument supplied.\n");
2510 return D3DERR_INVALIDCALL;
2513 if (This->manager) IUnknown_AddRef(This->manager);
2514 *manager = This->manager;
2519 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
2521 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2523 FIXME("(%p)->(): stub\n", This);
2528 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
2530 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2532 FIXME("(%p)->(): stub\n", This);
2537 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2539 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2541 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2546 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2548 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2550 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2555 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
2557 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2559 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
2564 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
2566 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2568 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
2573 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
2575 /*** IUnknown methods ***/
2576 ID3DXEffectImpl_QueryInterface,
2577 ID3DXEffectImpl_AddRef,
2578 ID3DXEffectImpl_Release,
2579 /*** ID3DXBaseEffect methods ***/
2580 ID3DXEffectImpl_GetDesc,
2581 ID3DXEffectImpl_GetParameterDesc,
2582 ID3DXEffectImpl_GetTechniqueDesc,
2583 ID3DXEffectImpl_GetPassDesc,
2584 ID3DXEffectImpl_GetFunctionDesc,
2585 ID3DXEffectImpl_GetParameter,
2586 ID3DXEffectImpl_GetParameterByName,
2587 ID3DXEffectImpl_GetParameterBySemantic,
2588 ID3DXEffectImpl_GetParameterElement,
2589 ID3DXEffectImpl_GetTechnique,
2590 ID3DXEffectImpl_GetTechniqueByName,
2591 ID3DXEffectImpl_GetPass,
2592 ID3DXEffectImpl_GetPassByName,
2593 ID3DXEffectImpl_GetFunction,
2594 ID3DXEffectImpl_GetFunctionByName,
2595 ID3DXEffectImpl_GetAnnotation,
2596 ID3DXEffectImpl_GetAnnotationByName,
2597 ID3DXEffectImpl_SetValue,
2598 ID3DXEffectImpl_GetValue,
2599 ID3DXEffectImpl_SetBool,
2600 ID3DXEffectImpl_GetBool,
2601 ID3DXEffectImpl_SetBoolArray,
2602 ID3DXEffectImpl_GetBoolArray,
2603 ID3DXEffectImpl_SetInt,
2604 ID3DXEffectImpl_GetInt,
2605 ID3DXEffectImpl_SetIntArray,
2606 ID3DXEffectImpl_GetIntArray,
2607 ID3DXEffectImpl_SetFloat,
2608 ID3DXEffectImpl_GetFloat,
2609 ID3DXEffectImpl_SetFloatArray,
2610 ID3DXEffectImpl_GetFloatArray,
2611 ID3DXEffectImpl_SetVector,
2612 ID3DXEffectImpl_GetVector,
2613 ID3DXEffectImpl_SetVectorArray,
2614 ID3DXEffectImpl_GetVectorArray,
2615 ID3DXEffectImpl_SetMatrix,
2616 ID3DXEffectImpl_GetMatrix,
2617 ID3DXEffectImpl_SetMatrixArray,
2618 ID3DXEffectImpl_GetMatrixArray,
2619 ID3DXEffectImpl_SetMatrixPointerArray,
2620 ID3DXEffectImpl_GetMatrixPointerArray,
2621 ID3DXEffectImpl_SetMatrixTranspose,
2622 ID3DXEffectImpl_GetMatrixTranspose,
2623 ID3DXEffectImpl_SetMatrixTransposeArray,
2624 ID3DXEffectImpl_GetMatrixTransposeArray,
2625 ID3DXEffectImpl_SetMatrixTransposePointerArray,
2626 ID3DXEffectImpl_GetMatrixTransposePointerArray,
2627 ID3DXEffectImpl_SetString,
2628 ID3DXEffectImpl_GetString,
2629 ID3DXEffectImpl_SetTexture,
2630 ID3DXEffectImpl_GetTexture,
2631 ID3DXEffectImpl_GetPixelShader,
2632 ID3DXEffectImpl_GetVertexShader,
2633 ID3DXEffectImpl_SetArrayRange,
2634 /*** ID3DXEffect methods ***/
2635 ID3DXEffectImpl_GetPool,
2636 ID3DXEffectImpl_SetTechnique,
2637 ID3DXEffectImpl_GetCurrentTechnique,
2638 ID3DXEffectImpl_ValidateTechnique,
2639 ID3DXEffectImpl_FindNextValidTechnique,
2640 ID3DXEffectImpl_IsParameterUsed,
2641 ID3DXEffectImpl_Begin,
2642 ID3DXEffectImpl_BeginPass,
2643 ID3DXEffectImpl_CommitChanges,
2644 ID3DXEffectImpl_EndPass,
2645 ID3DXEffectImpl_End,
2646 ID3DXEffectImpl_GetDevice,
2647 ID3DXEffectImpl_OnLostDevice,
2648 ID3DXEffectImpl_OnResetDevice,
2649 ID3DXEffectImpl_SetStateManager,
2650 ID3DXEffectImpl_GetStateManager,
2651 ID3DXEffectImpl_BeginParameterBlock,
2652 ID3DXEffectImpl_EndParameterBlock,
2653 ID3DXEffectImpl_ApplyParameterBlock,
2654 ID3DXEffectImpl_DeleteParameterBlock,
2655 ID3DXEffectImpl_CloneEffect,
2656 ID3DXEffectImpl_SetRawValue
2659 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
2661 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
2664 /*** IUnknown methods ***/
2665 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
2667 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2669 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
2671 if (IsEqualGUID(riid, &IID_IUnknown) ||
2672 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
2674 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
2679 ERR("Interface %s not found\n", debugstr_guid(riid));
2681 return E_NOINTERFACE;
2684 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
2686 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2688 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
2690 return InterlockedIncrement(&This->ref);
2693 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
2695 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2696 ULONG ref = InterlockedDecrement(&This->ref);
2698 TRACE("iface %p: Release from %u\n", iface, ref + 1);
2702 free_effect_compiler(This);
2703 HeapFree(GetProcessHeap(), 0, This);
2709 /*** ID3DXBaseEffect methods ***/
2710 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
2712 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2713 ID3DXBaseEffect *base = This->base_effect;
2715 TRACE("Forward iface %p, base %p\n", This, base);
2717 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2720 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2722 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2723 ID3DXBaseEffect *base = This->base_effect;
2725 TRACE("Forward iface %p, base %p\n", This, base);
2727 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2730 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2732 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2733 ID3DXBaseEffect *base = This->base_effect;
2735 TRACE("Forward iface %p, base %p\n", This, base);
2737 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2740 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2742 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2743 ID3DXBaseEffect *base = This->base_effect;
2745 TRACE("Forward iface %p, base %p\n", This, base);
2747 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2750 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2752 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2753 ID3DXBaseEffect *base = This->base_effect;
2755 TRACE("Forward iface %p, base %p\n", This, base);
2757 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2760 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2762 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2763 ID3DXBaseEffect *base = This->base_effect;
2765 TRACE("Forward iface %p, base %p\n", This, base);
2767 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2770 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
2772 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2773 ID3DXBaseEffect *base = This->base_effect;
2775 TRACE("Forward iface %p, base %p\n", This, base);
2777 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2780 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
2782 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2783 ID3DXBaseEffect *base = This->base_effect;
2785 TRACE("Forward iface %p, base %p\n", This, base);
2787 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2790 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2792 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2793 ID3DXBaseEffect *base = This->base_effect;
2795 TRACE("Forward iface %p, base %p\n", This, base);
2797 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2800 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
2802 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2803 ID3DXBaseEffect *base = This->base_effect;
2805 TRACE("Forward iface %p, base %p\n", This, base);
2807 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2810 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
2812 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2813 ID3DXBaseEffect *base = This->base_effect;
2815 TRACE("Forward iface %p, base %p\n", This, base);
2817 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2820 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
2822 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2823 ID3DXBaseEffect *base = This->base_effect;
2825 TRACE("Forward iface %p, base %p\n", This, base);
2827 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2830 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
2832 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2833 ID3DXBaseEffect *base = This->base_effect;
2835 TRACE("Forward iface %p, base %p\n", This, base);
2837 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2840 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
2842 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2843 ID3DXBaseEffect *base = This->base_effect;
2845 TRACE("Forward iface %p, base %p\n", This, base);
2847 return ID3DXBaseEffectImpl_GetFunction(base, index);
2850 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
2852 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2853 ID3DXBaseEffect *base = This->base_effect;
2855 TRACE("Forward iface %p, base %p\n", This, base);
2857 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2860 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
2862 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2863 ID3DXBaseEffect *base = This->base_effect;
2865 TRACE("Forward iface %p, base %p\n", This, base);
2867 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2870 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
2872 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2873 ID3DXBaseEffect *base = This->base_effect;
2875 TRACE("Forward iface %p, base %p\n", This, base);
2877 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2880 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2882 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2883 ID3DXBaseEffect *base = This->base_effect;
2885 TRACE("Forward iface %p, base %p\n", This, base);
2887 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2890 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2892 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2893 ID3DXBaseEffect *base = This->base_effect;
2895 TRACE("Forward iface %p, base %p\n", This, base);
2897 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2900 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
2902 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2903 ID3DXBaseEffect *base = This->base_effect;
2905 TRACE("Forward iface %p, base %p\n", This, base);
2907 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2910 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
2912 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2913 ID3DXBaseEffect *base = This->base_effect;
2915 TRACE("Forward iface %p, base %p\n", This, base);
2917 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2920 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2922 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2923 ID3DXBaseEffect *base = This->base_effect;
2925 TRACE("Forward iface %p, base %p\n", This, base);
2927 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2930 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2932 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2933 ID3DXBaseEffect *base = This->base_effect;
2935 TRACE("Forward iface %p, base %p\n", This, base);
2937 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2940 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
2942 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2943 ID3DXBaseEffect *base = This->base_effect;
2945 TRACE("Forward iface %p, base %p\n", This, base);
2947 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2950 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2952 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2953 ID3DXBaseEffect *base = This->base_effect;
2955 TRACE("Forward iface %p, base %p\n", This, base);
2957 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2960 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2962 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2963 ID3DXBaseEffect *base = This->base_effect;
2965 TRACE("Forward iface %p, base %p\n", This, base);
2967 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2970 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2972 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2973 ID3DXBaseEffect *base = This->base_effect;
2975 TRACE("Forward iface %p, base %p\n", This, base);
2977 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2980 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2982 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2983 ID3DXBaseEffect *base = This->base_effect;
2985 TRACE("Forward iface %p, base %p\n", This, base);
2987 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2990 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2992 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2993 ID3DXBaseEffect *base = This->base_effect;
2995 TRACE("Forward iface %p, base %p\n", This, base);
2997 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
3000 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
3002 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3003 ID3DXBaseEffect *base = This->base_effect;
3005 TRACE("Forward iface %p, base %p\n", This, base);
3007 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
3010 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
3012 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3013 ID3DXBaseEffect *base = This->base_effect;
3015 TRACE("Forward iface %p, base %p\n", This, base);
3017 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
3020 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
3022 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3023 ID3DXBaseEffect *base = This->base_effect;
3025 TRACE("Forward iface %p, base %p\n", This, base);
3027 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
3030 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
3032 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3033 ID3DXBaseEffect *base = This->base_effect;
3035 TRACE("Forward iface %p, base %p\n", This, base);
3037 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
3040 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
3042 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3043 ID3DXBaseEffect *base = This->base_effect;
3045 TRACE("Forward iface %p, base %p\n", This, base);
3047 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
3050 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
3052 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3053 ID3DXBaseEffect *base = This->base_effect;
3055 TRACE("Forward iface %p, base %p\n", This, base);
3057 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
3060 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3062 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3063 ID3DXBaseEffect *base = This->base_effect;
3065 TRACE("Forward iface %p, base %p\n", This, base);
3067 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
3070 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3072 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3073 ID3DXBaseEffect *base = This->base_effect;
3075 TRACE("Forward iface %p, base %p\n", This, base);
3077 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
3080 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3082 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3083 ID3DXBaseEffect *base = This->base_effect;
3085 TRACE("Forward iface %p, base %p\n", This, base);
3087 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
3090 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3092 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3093 ID3DXBaseEffect *base = This->base_effect;
3095 TRACE("Forward iface %p, base %p\n", This, base);
3097 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
3100 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3102 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3103 ID3DXBaseEffect *base = This->base_effect;
3105 TRACE("Forward iface %p, base %p\n", This, base);
3107 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
3110 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3112 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3113 ID3DXBaseEffect *base = This->base_effect;
3115 TRACE("Forward iface %p, base %p\n", This, base);
3117 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
3120 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3122 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3123 ID3DXBaseEffect *base = This->base_effect;
3125 TRACE("Forward iface %p, base %p\n", This, base);
3127 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
3130 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3132 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3133 ID3DXBaseEffect *base = This->base_effect;
3135 TRACE("Forward iface %p, base %p\n", This, base);
3137 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
3140 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3142 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3143 ID3DXBaseEffect *base = This->base_effect;
3145 TRACE("Forward iface %p, base %p\n", This, base);
3147 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
3150 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3152 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3153 ID3DXBaseEffect *base = This->base_effect;
3155 TRACE("Forward iface %p, base %p\n", This, base);
3157 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
3160 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3162 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3163 ID3DXBaseEffect *base = This->base_effect;
3165 TRACE("Forward iface %p, base %p\n", This, base);
3167 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
3170 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3172 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3173 ID3DXBaseEffect *base = This->base_effect;
3175 TRACE("Forward iface %p, base %p\n", This, base);
3177 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
3180 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
3182 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3183 ID3DXBaseEffect *base = This->base_effect;
3185 TRACE("Forward iface %p, base %p\n", This, base);
3187 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
3190 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
3192 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3193 ID3DXBaseEffect *base = This->base_effect;
3195 TRACE("Forward iface %p, base %p\n", This, base);
3197 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
3200 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
3202 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3203 ID3DXBaseEffect *base = This->base_effect;
3205 TRACE("Forward iface %p, base %p\n", This, base);
3207 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
3210 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
3212 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3213 ID3DXBaseEffect *base = This->base_effect;
3215 TRACE("Forward iface %p, base %p\n", This, base);
3217 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
3220 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
3222 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3223 ID3DXBaseEffect *base = This->base_effect;
3225 TRACE("Forward iface %p, base %p\n", This, base);
3227 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
3230 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
3232 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3233 ID3DXBaseEffect *base = This->base_effect;
3235 TRACE("Forward iface %p, base %p\n", This, base);
3237 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
3240 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
3242 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3243 ID3DXBaseEffect *base = This->base_effect;
3245 TRACE("Forward iface %p, base %p\n", This, base);
3247 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
3250 /*** ID3DXEffectCompiler methods ***/
3251 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
3253 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3255 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
3260 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
3262 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3264 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
3269 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
3270 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
3272 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3274 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
3279 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
3280 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
3282 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3284 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3285 This, function, target, flags, shader, error_msgs, constant_table);
3290 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
3292 /*** IUnknown methods ***/
3293 ID3DXEffectCompilerImpl_QueryInterface,
3294 ID3DXEffectCompilerImpl_AddRef,
3295 ID3DXEffectCompilerImpl_Release,
3296 /*** ID3DXBaseEffect methods ***/
3297 ID3DXEffectCompilerImpl_GetDesc,
3298 ID3DXEffectCompilerImpl_GetParameterDesc,
3299 ID3DXEffectCompilerImpl_GetTechniqueDesc,
3300 ID3DXEffectCompilerImpl_GetPassDesc,
3301 ID3DXEffectCompilerImpl_GetFunctionDesc,
3302 ID3DXEffectCompilerImpl_GetParameter,
3303 ID3DXEffectCompilerImpl_GetParameterByName,
3304 ID3DXEffectCompilerImpl_GetParameterBySemantic,
3305 ID3DXEffectCompilerImpl_GetParameterElement,
3306 ID3DXEffectCompilerImpl_GetTechnique,
3307 ID3DXEffectCompilerImpl_GetTechniqueByName,
3308 ID3DXEffectCompilerImpl_GetPass,
3309 ID3DXEffectCompilerImpl_GetPassByName,
3310 ID3DXEffectCompilerImpl_GetFunction,
3311 ID3DXEffectCompilerImpl_GetFunctionByName,
3312 ID3DXEffectCompilerImpl_GetAnnotation,
3313 ID3DXEffectCompilerImpl_GetAnnotationByName,
3314 ID3DXEffectCompilerImpl_SetValue,
3315 ID3DXEffectCompilerImpl_GetValue,
3316 ID3DXEffectCompilerImpl_SetBool,
3317 ID3DXEffectCompilerImpl_GetBool,
3318 ID3DXEffectCompilerImpl_SetBoolArray,
3319 ID3DXEffectCompilerImpl_GetBoolArray,
3320 ID3DXEffectCompilerImpl_SetInt,
3321 ID3DXEffectCompilerImpl_GetInt,
3322 ID3DXEffectCompilerImpl_SetIntArray,
3323 ID3DXEffectCompilerImpl_GetIntArray,
3324 ID3DXEffectCompilerImpl_SetFloat,
3325 ID3DXEffectCompilerImpl_GetFloat,
3326 ID3DXEffectCompilerImpl_SetFloatArray,
3327 ID3DXEffectCompilerImpl_GetFloatArray,
3328 ID3DXEffectCompilerImpl_SetVector,
3329 ID3DXEffectCompilerImpl_GetVector,
3330 ID3DXEffectCompilerImpl_SetVectorArray,
3331 ID3DXEffectCompilerImpl_GetVectorArray,
3332 ID3DXEffectCompilerImpl_SetMatrix,
3333 ID3DXEffectCompilerImpl_GetMatrix,
3334 ID3DXEffectCompilerImpl_SetMatrixArray,
3335 ID3DXEffectCompilerImpl_GetMatrixArray,
3336 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
3337 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
3338 ID3DXEffectCompilerImpl_SetMatrixTranspose,
3339 ID3DXEffectCompilerImpl_GetMatrixTranspose,
3340 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
3341 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
3342 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
3343 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
3344 ID3DXEffectCompilerImpl_SetString,
3345 ID3DXEffectCompilerImpl_GetString,
3346 ID3DXEffectCompilerImpl_SetTexture,
3347 ID3DXEffectCompilerImpl_GetTexture,
3348 ID3DXEffectCompilerImpl_GetPixelShader,
3349 ID3DXEffectCompilerImpl_GetVertexShader,
3350 ID3DXEffectCompilerImpl_SetArrayRange,
3351 /*** ID3DXEffectCompiler methods ***/
3352 ID3DXEffectCompilerImpl_SetLiteral,
3353 ID3DXEffectCompilerImpl_GetLiteral,
3354 ID3DXEffectCompilerImpl_CompileEffect,
3355 ID3DXEffectCompilerImpl_CompileShader,
3358 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char **ptr)
3365 if (param->element_count)
3367 param->data = value;
3369 for (i = 0; i < param->element_count; ++i)
3371 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3373 hr = d3dx9_parse_value(member, value ? (char *)value + old_size : NULL, ptr);
3376 WARN("Failed to parse value\n");
3380 old_size += member->bytes;
3386 switch(param->class)
3390 case D3DXPC_MATRIX_ROWS:
3391 case D3DXPC_MATRIX_COLUMNS:
3392 param->data = value;
3396 param->data = value;
3398 for (i = 0; i < param->member_count; ++i)
3400 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3402 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3405 WARN("Failed to parse value\n");
3409 old_size += member->bytes;
3414 switch (param->type)
3417 case D3DXPT_TEXTURE:
3418 case D3DXPT_TEXTURE1D:
3419 case D3DXPT_TEXTURE2D:
3420 case D3DXPT_TEXTURE3D:
3421 case D3DXPT_TEXTURECUBE:
3422 case D3DXPT_PIXELSHADER:
3423 case D3DXPT_VERTEXSHADER:
3424 read_dword(ptr, &id);
3425 TRACE("Id: %u\n", id);
3426 param->base->objects[id] = get_parameter_handle(param);
3427 param->data = value;
3430 case D3DXPT_SAMPLER:
3431 case D3DXPT_SAMPLER1D:
3432 case D3DXPT_SAMPLER2D:
3433 case D3DXPT_SAMPLER3D:
3434 case D3DXPT_SAMPLERCUBE:
3438 read_dword(ptr, &state_count);
3439 TRACE("Count: %u\n", state_count);
3441 for (i = 0; i < state_count; ++i)
3443 /* Todo: parse states */
3444 skip_dword_unknown(ptr, 4);
3450 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3456 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3463 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
3465 UINT size = param->bytes;
3469 TRACE("param size: %u\n", size);
3473 value = HeapAlloc(GetProcessHeap(), 0, size);
3476 ERR("Failed to allocate data memory.\n");
3477 return E_OUTOFMEMORY;
3480 TRACE("Data: %s.\n", debugstr_an(ptr, size));
3481 memcpy(value, ptr, size);
3484 hr = d3dx9_parse_value(param, value, &ptr);
3487 WARN("Failed to parse value\n");
3488 HeapFree(GetProcessHeap(), 0, value);
3492 param->data = value;
3497 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
3501 read_dword(&ptr, &size);
3502 TRACE("Name size: %#x\n", size);
3509 *name = HeapAlloc(GetProcessHeap(), 0, size);
3512 ERR("Failed to allocate name memory.\n");
3513 return E_OUTOFMEMORY;
3516 TRACE("Name: %s.\n", debugstr_an(ptr, size));
3517 memcpy(*name, ptr, size);
3522 static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr)
3527 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type));
3529 read_dword(ptr, &size);
3530 TRACE("Data size: %#x\n", size);
3534 TRACE("Size is 0\n");
3535 *(void **)param->data = NULL;
3539 switch (param->type)
3542 /* re-read with size (sizeof(DWORD) = 4) */
3543 hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
3546 WARN("Failed to parse string data\n");
3551 case D3DXPT_VERTEXSHADER:
3552 hr = IDirect3DDevice9_CreateVertexShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DVERTEXSHADER9 *)param->data);
3555 WARN("Failed to create vertex shader\n");
3560 case D3DXPT_PIXELSHADER:
3561 hr = IDirect3DDevice9_CreatePixelShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DPIXELSHADER9 *)param->data);
3564 WARN("Failed to create pixel shader\n");
3570 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3575 *ptr += ((size + 3) & ~3);
3580 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr,
3581 struct d3dx_parameter *parent, UINT flags)
3585 D3DXHANDLE *member_handles = NULL;
3588 param->flags = flags;
3592 read_dword(ptr, ¶m->type);
3593 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
3595 read_dword(ptr, ¶m->class);
3596 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
3598 read_dword(ptr, &offset);
3599 TRACE("Type name offset: %#x\n", offset);
3600 hr = d3dx9_parse_name(¶m->name, data + offset);
3603 WARN("Failed to parse name\n");
3607 read_dword(ptr, &offset);
3608 TRACE("Type semantic offset: %#x\n", offset);
3609 hr = d3dx9_parse_name(¶m->semantic, data + offset);
3612 WARN("Failed to parse semantic\n");
3616 read_dword(ptr, ¶m->element_count);
3617 TRACE("Elements: %u\n", param->element_count);
3619 switch (param->class)
3622 read_dword(ptr, ¶m->columns);
3623 TRACE("Columns: %u\n", param->columns);
3625 read_dword(ptr, ¶m->rows);
3626 TRACE("Rows: %u\n", param->rows);
3628 /* sizeof(DWORD) * rows * columns */
3629 param->bytes = 4 * param->rows * param->columns;
3633 case D3DXPC_MATRIX_ROWS:
3634 case D3DXPC_MATRIX_COLUMNS:
3635 read_dword(ptr, ¶m->rows);
3636 TRACE("Rows: %u\n", param->rows);
3638 read_dword(ptr, ¶m->columns);
3639 TRACE("Columns: %u\n", param->columns);
3641 /* sizeof(DWORD) * rows * columns */
3642 param->bytes = 4 * param->rows * param->columns;
3646 read_dword(ptr, ¶m->member_count);
3647 TRACE("Members: %u\n", param->member_count);
3651 switch (param->type)
3654 param->bytes = sizeof(LPCSTR);
3657 case D3DXPT_PIXELSHADER:
3658 param->bytes = sizeof(LPDIRECT3DPIXELSHADER9);
3661 case D3DXPT_VERTEXSHADER:
3662 param->bytes = sizeof(LPDIRECT3DVERTEXSHADER9);
3665 case D3DXPT_TEXTURE:
3666 case D3DXPT_TEXTURE1D:
3667 case D3DXPT_TEXTURE2D:
3668 case D3DXPT_TEXTURE3D:
3669 case D3DXPT_TEXTURECUBE:
3670 param->bytes = sizeof(LPDIRECT3DBASETEXTURE9);
3673 case D3DXPT_SAMPLER:
3674 case D3DXPT_SAMPLER1D:
3675 case D3DXPT_SAMPLER2D:
3676 case D3DXPT_SAMPLER3D:
3677 case D3DXPT_SAMPLERCUBE:
3682 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3688 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3695 param->type = parent->type;
3696 param->class = parent->class;
3697 param->name = parent->name;
3698 param->semantic = parent->semantic;
3699 param->element_count = 0;
3700 param->annotation_count = 0;
3701 param->member_count = parent->member_count;
3702 param->bytes = parent->bytes;
3703 param->rows = parent->rows;
3704 param->columns = parent->columns;
3707 if (param->element_count)
3709 unsigned int param_bytes = 0;
3710 const char *save_ptr = *ptr;
3712 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
3713 if (!member_handles)
3715 ERR("Out of memory\n");
3720 for (i = 0; i < param->element_count; ++i)
3722 struct d3dx_parameter *member;
3725 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3728 ERR("Out of memory\n");
3733 member_handles[i] = get_parameter_handle(member);
3734 member->base = param->base;
3736 hr = d3dx9_parse_effect_typedef(member, data, ptr, param, flags);
3739 WARN("Failed to parse member\n");
3743 param_bytes += member->bytes;
3746 param->bytes = param_bytes;
3748 else if (param->member_count)
3750 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
3751 if (!member_handles)
3753 ERR("Out of memory\n");
3758 for (i = 0; i < param->member_count; ++i)
3760 struct d3dx_parameter *member;
3762 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3765 ERR("Out of memory\n");
3770 member_handles[i] = get_parameter_handle(member);
3771 member->base = param->base;
3773 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL, flags);
3776 WARN("Failed to parse member\n");
3780 param->bytes += member->bytes;
3784 param->member_handles = member_handles;
3794 if (param->element_count) count = param->element_count;
3795 else count = param->member_count;
3797 for (i = 0; i < count; ++i)
3799 free_parameter(member_handles[i], param->element_count != 0, TRUE);
3801 HeapFree(GetProcessHeap(), 0, member_handles);
3806 HeapFree(GetProcessHeap(), 0, param->name);
3807 HeapFree(GetProcessHeap(), 0, param->semantic);
3810 param->semantic = NULL;
3815 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
3821 anno->flags = D3DX_PARAMETER_ANNOTATION;
3823 read_dword(ptr, &offset);
3824 TRACE("Typedef offset: %#x\n", offset);
3825 ptr2 = data + offset;
3826 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION);
3829 WARN("Failed to parse type definition\n");
3833 read_dword(ptr, &offset);
3834 TRACE("Value offset: %#x\n", offset);
3835 hr = d3dx9_parse_init_value(anno, data + offset);
3838 WARN("Failed to parse value\n");
3845 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
3850 D3DXHANDLE *annotation_handles = NULL;
3853 read_dword(ptr, &offset);
3854 TRACE("Typedef offset: %#x\n", offset);
3855 ptr2 = data + offset;
3857 read_dword(ptr, &offset);
3858 TRACE("Value offset: %#x\n", offset);
3860 read_dword(ptr, ¶m->flags);
3861 TRACE("Flags: %#x\n", param->flags);
3863 read_dword(ptr, ¶m->annotation_count);
3864 TRACE("Annotation count: %u\n", param->annotation_count);
3866 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags);
3869 WARN("Failed to parse type definition\n");
3873 hr = d3dx9_parse_init_value(param, data + offset);
3876 WARN("Failed to parse value\n");
3880 if (param->annotation_count)
3882 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
3883 if (!annotation_handles)
3885 ERR("Out of memory\n");
3890 for (i = 0; i < param->annotation_count; ++i)
3892 struct d3dx_parameter *annotation;
3894 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3897 ERR("Out of memory\n");
3902 annotation_handles[i] = get_parameter_handle(annotation);
3903 annotation->base = param->base;
3905 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3908 WARN("Failed to parse annotation\n");
3914 param->annotation_handles = annotation_handles;
3920 if (annotation_handles)
3922 for (i = 0; i < param->annotation_count; ++i)
3924 free_parameter(annotation_handles[i], FALSE, FALSE);
3926 HeapFree(GetProcessHeap(), 0, annotation_handles);
3932 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr)
3937 D3DXHANDLE *annotation_handles = NULL;
3940 read_dword(ptr, &offset);
3941 TRACE("Pass name offset: %#x\n", offset);
3942 hr = d3dx9_parse_name(&name, data + offset);
3945 WARN("Failed to parse name\n");
3949 read_dword(ptr, &pass->annotation_count);
3950 TRACE("Annotation count: %u\n", pass->annotation_count);
3952 read_dword(ptr, &pass->state_count);
3953 TRACE("State count: %u\n", pass->state_count);
3955 if (pass->annotation_count)
3957 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
3958 if (!annotation_handles)
3960 ERR("Out of memory\n");
3965 for (i = 0; i < pass->annotation_count; ++i)
3967 struct d3dx_parameter *annotation;
3969 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3972 ERR("Out of memory\n");
3977 annotation_handles[i] = get_parameter_handle(annotation);
3978 annotation->base = pass->base;
3980 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3983 WARN("Failed to parse annotations\n");
3989 if (pass->state_count)
3991 for (i = 0; i < pass->state_count; ++i)
3993 skip_dword_unknown(ptr, 4);
3998 pass->annotation_handles = annotation_handles;
4004 if (annotation_handles)
4006 for (i = 0; i < pass->annotation_count; ++i)
4008 free_parameter(annotation_handles[i], FALSE, FALSE);
4010 HeapFree(GetProcessHeap(), 0, annotation_handles);
4013 HeapFree(GetProcessHeap(), 0, name);
4018 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr)
4023 D3DXHANDLE *annotation_handles = NULL;
4024 D3DXHANDLE *pass_handles = NULL;
4027 read_dword(ptr, &offset);
4028 TRACE("Technique name offset: %#x\n", offset);
4029 hr = d3dx9_parse_name(&name, data + offset);
4032 WARN("Failed to parse name\n");
4036 read_dword(ptr, &technique->annotation_count);
4037 TRACE("Annotation count: %u\n", technique->annotation_count);
4039 read_dword(ptr, &technique->pass_count);
4040 TRACE("Pass count: %u\n", technique->pass_count);
4042 if (technique->annotation_count)
4044 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
4045 if (!annotation_handles)
4047 ERR("Out of memory\n");
4052 for (i = 0; i < technique->annotation_count; ++i)
4054 struct d3dx_parameter *annotation;
4056 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
4059 ERR("Out of memory\n");
4064 annotation_handles[i] = get_parameter_handle(annotation);
4065 annotation->base = technique->base;
4067 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
4070 WARN("Failed to parse annotations\n");
4076 if (technique->pass_count)
4078 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
4081 ERR("Out of memory\n");
4086 for (i = 0; i < technique->pass_count; ++i)
4088 struct d3dx_pass *pass;
4090 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
4093 ERR("Out of memory\n");
4098 pass_handles[i] = get_pass_handle(pass);
4099 pass->base = technique->base;
4101 hr = d3dx9_parse_effect_pass(pass, data, ptr);
4104 WARN("Failed to parse passes\n");
4110 technique->name = name;
4111 technique->pass_handles = pass_handles;
4112 technique->annotation_handles = annotation_handles;
4120 for (i = 0; i < technique->pass_count; ++i)
4122 free_pass(pass_handles[i]);
4124 HeapFree(GetProcessHeap(), 0, pass_handles);
4127 if (annotation_handles)
4129 for (i = 0; i < technique->annotation_count; ++i)
4131 free_parameter(annotation_handles[i], FALSE, FALSE);
4133 HeapFree(GetProcessHeap(), 0, annotation_handles);
4136 HeapFree(GetProcessHeap(), 0, name);
4141 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
4143 const char *ptr = data + start;
4144 D3DXHANDLE *parameter_handles = NULL;
4145 D3DXHANDLE *technique_handles = NULL;
4146 D3DXHANDLE *objects = NULL;
4147 unsigned int stringcount;
4151 read_dword(&ptr, &base->parameter_count);
4152 TRACE("Parameter count: %u\n", base->parameter_count);
4154 read_dword(&ptr, &base->technique_count);
4155 TRACE("Technique count: %u\n", base->technique_count);
4157 skip_dword_unknown(&ptr, 1);
4159 read_dword(&ptr, &base->object_count);
4160 TRACE("Object count: %u\n", base->object_count);
4162 objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * base->object_count);
4165 ERR("Out of memory\n");
4170 base->objects = objects;
4172 if (base->parameter_count)
4174 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
4175 if (!parameter_handles)
4177 ERR("Out of memory\n");
4182 for (i = 0; i < base->parameter_count; ++i)
4184 struct d3dx_parameter *parameter;
4186 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
4189 ERR("Out of memory\n");
4194 parameter_handles[i] = get_parameter_handle(parameter);
4195 parameter->base = base;
4197 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
4200 WARN("Failed to parse parameter\n");
4206 if (base->technique_count)
4208 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
4209 if (!technique_handles)
4211 ERR("Out of memory\n");
4216 for (i = 0; i < base->technique_count; ++i)
4218 struct d3dx_technique *technique;
4220 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
4223 ERR("Out of memory\n");
4228 technique_handles[i] = get_technique_handle(technique);
4229 technique->base = base;
4231 hr = d3dx9_parse_effect_technique(technique, data, &ptr);
4234 WARN("Failed to parse technique\n");
4240 read_dword(&ptr, &stringcount);
4241 TRACE("String count: %u\n", stringcount);
4243 skip_dword_unknown(&ptr, 1);
4245 for (i = 0; i < stringcount; ++i)
4248 struct d3dx_parameter *param;
4250 read_dword(&ptr, &id);
4251 TRACE("Id: %u\n", id);
4253 param = get_parameter_struct(base->objects[id]);
4255 hr = d3dx9_parse_data(param, &ptr);
4258 WARN("Failed to parse data\n");
4263 HeapFree(GetProcessHeap(), 0, objects);
4264 base->objects = NULL;
4266 base->technique_handles = technique_handles;
4267 base->parameter_handles = parameter_handles;
4273 if (technique_handles)
4275 for (i = 0; i < base->technique_count; ++i)
4277 free_technique(technique_handles[i]);
4279 HeapFree(GetProcessHeap(), 0, technique_handles);
4282 if (parameter_handles)
4284 for (i = 0; i < base->parameter_count; ++i)
4286 free_parameter(parameter_handles[i], FALSE, FALSE);
4288 HeapFree(GetProcessHeap(), 0, parameter_handles);
4291 HeapFree(GetProcessHeap(), 0, objects);
4296 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
4297 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
4300 const char *ptr = data;
4303 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
4305 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
4307 base->effect = effect;
4309 read_dword(&ptr, &tag);
4310 TRACE("Tag: %x\n", tag);
4312 if (tag != d3dx9_effect_version(9, 1))
4314 /* todo: compile hlsl ascii code */
4315 FIXME("HLSL ascii effects not supported, yet\n");
4317 /* Show the start of the shader for debugging info. */
4318 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
4322 read_dword(&ptr, &offset);
4323 TRACE("Offset: %x\n", offset);
4325 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
4328 FIXME("Failed to parse effect.\n");
4336 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
4337 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
4340 struct ID3DXBaseEffectImpl *object = NULL;
4342 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
4344 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
4347 if (pool) pool->lpVtbl->AddRef(pool);
4348 effect->pool = pool;
4350 IDirect3DDevice9_AddRef(device);
4351 effect->device = device;
4353 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4356 ERR("Out of memory\n");
4361 hr = d3dx9_base_effect_init(object, data, data_size, effect);
4364 FIXME("Failed to parse effect.\n");
4368 effect->base_effect = &object->ID3DXBaseEffect_iface;
4374 HeapFree(GetProcessHeap(), 0, object);
4375 free_effect(effect);
4380 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
4383 CONST D3DXMACRO* defines,
4384 LPD3DXINCLUDE include,
4385 LPCSTR skip_constants,
4387 LPD3DXEFFECTPOOL pool,
4388 LPD3DXEFFECT* effect,
4389 LPD3DXBUFFER* compilation_errors)
4391 struct ID3DXEffectImpl *object;
4394 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
4395 skip_constants, flags, pool, effect, compilation_errors);
4397 if (!device || !srcdata)
4398 return D3DERR_INVALIDCALL;
4403 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
4407 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4410 ERR("Out of memory\n");
4411 return E_OUTOFMEMORY;
4414 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
4417 WARN("Failed to initialize shader reflection\n");
4418 HeapFree(GetProcessHeap(), 0, object);
4422 *effect = &object->ID3DXEffect_iface;
4424 TRACE("Created ID3DXEffect %p\n", object);
4429 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
4432 CONST D3DXMACRO* defines,
4433 LPD3DXINCLUDE include,
4435 LPD3DXEFFECTPOOL pool,
4436 LPD3DXEFFECT* effect,
4437 LPD3DXBUFFER* compilation_errors)
4439 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
4440 include, flags, pool, effect, compilation_errors);
4442 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
4445 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
4448 struct ID3DXBaseEffectImpl *object = NULL;
4450 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
4452 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
4455 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4458 ERR("Out of memory\n");
4463 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
4466 FIXME("Failed to parse effect.\n");
4470 compiler->base_effect = &object->ID3DXBaseEffect_iface;
4476 HeapFree(GetProcessHeap(), 0, object);
4477 free_effect_compiler(compiler);
4482 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
4484 CONST D3DXMACRO *defines,
4485 LPD3DXINCLUDE include,
4487 LPD3DXEFFECTCOMPILER *compiler,
4488 LPD3DXBUFFER *parse_errors)
4490 struct ID3DXEffectCompilerImpl *object;
4493 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
4494 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
4496 if (!srcdata || !compiler)
4498 WARN("Invalid arguments supplied\n");
4499 return D3DERR_INVALIDCALL;
4502 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4505 ERR("Out of memory\n");
4506 return E_OUTOFMEMORY;
4509 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
4512 WARN("Failed to initialize effect compiler\n");
4513 HeapFree(GetProcessHeap(), 0, object);
4517 *compiler = &object->ID3DXEffectCompiler_iface;
4519 TRACE("Created ID3DXEffectCompiler %p\n", object);
4524 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
4526 struct ID3DXEffectPoolImpl
4528 ID3DXEffectPool ID3DXEffectPool_iface;
4532 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
4534 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
4537 /*** IUnknown methods ***/
4538 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
4540 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4542 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
4544 if (IsEqualGUID(riid, &IID_IUnknown) ||
4545 IsEqualGUID(riid, &IID_ID3DXEffectPool))
4547 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
4552 WARN("Interface %s not found\n", debugstr_guid(riid));
4554 return E_NOINTERFACE;
4557 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
4559 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4561 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
4563 return InterlockedIncrement(&This->ref);
4566 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
4568 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4569 ULONG ref = InterlockedDecrement(&This->ref);
4571 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
4574 HeapFree(GetProcessHeap(), 0, This);
4579 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
4581 /*** IUnknown methods ***/
4582 ID3DXEffectPoolImpl_QueryInterface,
4583 ID3DXEffectPoolImpl_AddRef,
4584 ID3DXEffectPoolImpl_Release
4587 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
4589 struct ID3DXEffectPoolImpl *object;
4591 TRACE("(%p)\n", pool);
4594 return D3DERR_INVALIDCALL;
4596 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4599 ERR("Out of memory\n");
4600 return E_OUTOFMEMORY;
4603 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
4606 *pool = &object->ID3DXEffectPool_iface;
4611 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4612 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4613 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4619 TRACE("(%s): relay\n", debugstr_w(srcfile));
4621 if (!device || !srcfile)
4622 return D3DERR_INVALIDCALL;
4624 ret = map_view_of_file(srcfile, &buffer, &size);
4627 return D3DXERR_INVALIDDATA;
4629 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4630 UnmapViewOfFile(buffer);
4635 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4636 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4637 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4643 TRACE("(void): relay\n");
4646 return D3DERR_INVALIDCALL;
4648 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4649 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4650 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4652 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4653 HeapFree(GetProcessHeap(), 0, srcfileW);
4658 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4659 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4660 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4662 TRACE("(void): relay\n");
4663 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4666 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4667 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4668 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4670 TRACE("(void): relay\n");
4671 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4674 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4675 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4676 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4680 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4683 return D3DERR_INVALIDCALL;
4685 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4693 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4696 return D3DXERR_INVALIDDATA;
4698 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4701 return D3DXERR_INVALIDDATA;
4704 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4705 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4706 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4710 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4713 return D3DERR_INVALIDCALL;
4715 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4723 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4726 return D3DXERR_INVALIDDATA;
4728 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4731 return D3DXERR_INVALIDDATA;
4734 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4735 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4736 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4738 TRACE("(void): relay\n");
4739 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4742 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4743 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4744 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4746 TRACE("(void): relay\n");
4747 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4750 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4751 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4757 TRACE("(%s): relay\n", debugstr_w(srcfile));
4760 return D3DERR_INVALIDCALL;
4762 ret = map_view_of_file(srcfile, &buffer, &size);
4765 return D3DXERR_INVALIDDATA;
4767 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4768 UnmapViewOfFile(buffer);
4773 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4774 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4780 TRACE("(void): relay\n");
4783 return D3DERR_INVALIDCALL;
4785 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4786 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4787 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4789 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
4790 HeapFree(GetProcessHeap(), 0, srcfileW);
4795 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
4796 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4800 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4802 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4810 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4813 return D3DXERR_INVALIDDATA;
4815 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4818 return D3DXERR_INVALIDDATA;
4821 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
4822 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4826 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4828 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4836 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4839 return D3DXERR_INVALIDDATA;
4841 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4844 return D3DXERR_INVALIDDATA;