d3dx9: Implement ID3DXBaseEffect::GetAnnotation().
[wine/multimedia.git] / dlls / d3dx9_36 / effect.c
blobe2b671058b43c6eae523ec34508ea0a7e9c06c29
1 /*
2 * Copyright 2010 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
20 #include "wine/port.h"
21 #include "wine/debug.h"
22 #include "wine/unicode.h"
23 #include "windef.h"
24 #include "wingdi.h"
25 #include "d3dx9_36_private.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
29 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl;
30 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl;
31 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl;
33 struct d3dx_parameter
35 struct ID3DXBaseEffectImpl *base;
37 char *name;
38 char *semantic;
39 void *data;
40 D3DXPARAMETER_CLASS class;
41 D3DXPARAMETER_TYPE type;
42 UINT rows;
43 UINT columns;
44 UINT element_count;
45 UINT annotation_count;
46 UINT member_count;
47 DWORD flags;
48 UINT bytes;
50 D3DXHANDLE *annotation_handles;
51 D3DXHANDLE *member_handles;
54 struct d3dx_pass
56 struct ID3DXBaseEffectImpl *base;
58 char *name;
59 UINT state_count;
60 UINT annotation_count;
62 D3DXHANDLE *annotation_handles;
65 struct d3dx_technique
67 struct ID3DXBaseEffectImpl *base;
69 char *name;
70 UINT pass_count;
71 UINT annotation_count;
73 D3DXHANDLE *annotation_handles;
74 D3DXHANDLE *pass_handles;
77 struct ID3DXBaseEffectImpl
79 ID3DXBaseEffect ID3DXBaseEffect_iface;
80 LONG ref;
82 struct ID3DXEffectImpl *effect;
84 UINT parameter_count;
85 UINT technique_count;
86 UINT object_count;
88 D3DXHANDLE *parameter_handles;
89 D3DXHANDLE *technique_handles;
90 D3DXHANDLE *objects;
93 struct ID3DXEffectImpl
95 ID3DXEffect ID3DXEffect_iface;
96 LONG ref;
98 LPDIRECT3DDEVICE9 device;
99 LPD3DXEFFECTPOOL pool;
101 ID3DXBaseEffect *base_effect;
104 struct ID3DXEffectCompilerImpl
106 ID3DXEffectCompiler ID3DXEffectCompiler_iface;
107 LONG ref;
109 ID3DXBaseEffect *base_effect;
112 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
113 struct d3dx_parameter *parameter, LPCSTR name);
114 static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl *base,
115 struct d3dx_parameter *parameter, LPCSTR name);
117 static inline void read_dword(const char **ptr, DWORD *d)
119 memcpy(d, *ptr, sizeof(*d));
120 *ptr += sizeof(*d);
123 static void skip_dword_unknown(const char **ptr, unsigned int count)
125 unsigned int i;
126 DWORD d;
128 FIXME("Skipping %u unknown DWORDs:\n", count);
129 for (i = 0; i < count; ++i)
131 read_dword(ptr, &d);
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)
168 unsigned int i;
170 for (i = 0; i < base->technique_count; ++i)
172 if (base->technique_handles[i] == technique)
174 return get_technique_struct(technique);
178 return NULL;
181 static struct d3dx_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
183 unsigned int i, k;
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);
198 return NULL;
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);
214 if (p) return p;
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);
228 if (p) return p;
231 return NULL;
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);
247 if (p) return p;
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);
266 if (p) return p;
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);
278 if (p) return p;
282 return NULL;
285 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
287 unsigned int i;
288 struct d3dx_parameter *param = get_parameter_struct(handle);
290 TRACE("Free parameter %p, child %s\n", param, child ? "yes" : "no");
292 if (!param)
294 return;
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)
308 unsigned int count;
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)
322 switch(param->type)
324 case D3DXPT_STRING:
325 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
326 break;
328 case D3DXPT_PIXELSHADER:
329 case D3DXPT_VERTEXSHADER:
330 if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data);
331 break;
333 default:
334 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
335 break;
339 if (!child)
341 HeapFree(GetProcessHeap(), 0, param->data);
344 /* only the parent has to release name and semantic */
345 if (!element)
347 HeapFree(GetProcessHeap(), 0, param->name);
348 HeapFree(GetProcessHeap(), 0, param->semantic);
351 HeapFree(GetProcessHeap(), 0, param);
354 static void free_pass(D3DXHANDLE handle)
356 unsigned int i;
357 struct d3dx_pass *pass = get_pass_struct(handle);
359 TRACE("Free pass %p\n", pass);
361 if (!pass)
363 return;
366 if (pass->annotation_handles)
368 for (i = 0; i < pass->annotation_count; ++i)
370 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
372 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
375 HeapFree(GetProcessHeap(), 0, pass->name);
376 HeapFree(GetProcessHeap(), 0, pass);
379 static void free_technique(D3DXHANDLE handle)
381 unsigned int i;
382 struct d3dx_technique *technique = get_technique_struct(handle);
384 TRACE("Free technique %p\n", technique);
386 if (!technique)
388 return;
391 if (technique->annotation_handles)
393 for (i = 0; i < technique->annotation_count; ++i)
395 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
397 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
400 if (technique->pass_handles)
402 for (i = 0; i < technique->pass_count; ++i)
404 free_pass(technique->pass_handles[i]);
406 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
409 HeapFree(GetProcessHeap(), 0, technique->name);
410 HeapFree(GetProcessHeap(), 0, technique);
413 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
415 unsigned int i;
417 TRACE("Free base effect %p\n", base);
419 if (base->parameter_handles)
421 for (i = 0; i < base->parameter_count; ++i)
423 free_parameter(base->parameter_handles[i], FALSE, FALSE);
425 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
428 if (base->technique_handles)
430 for (i = 0; i < base->technique_count; ++i)
432 free_technique(base->technique_handles[i]);
434 HeapFree(GetProcessHeap(), 0, base->technique_handles);
438 static void free_effect(struct ID3DXEffectImpl *effect)
440 TRACE("Free effect %p\n", effect);
442 if (effect->base_effect)
444 effect->base_effect->lpVtbl->Release(effect->base_effect);
447 if (effect->pool)
449 effect->pool->lpVtbl->Release(effect->pool);
452 IDirect3DDevice9_Release(effect->device);
455 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
457 TRACE("Free effect compiler %p\n", compiler);
459 if (compiler->base_effect)
461 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
465 static struct d3dx_parameter *get_parameter_element_by_name(struct ID3DXBaseEffectImpl *base,
466 struct d3dx_parameter *parameter, LPCSTR name)
468 UINT element;
469 struct d3dx_parameter *temp_parameter;
470 LPCSTR part;
472 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
474 if (!name || !*name) return parameter;
476 element = atoi(name);
477 part = strchr(name, ']') + 1;
479 if (parameter->element_count > element)
481 temp_parameter = get_parameter_struct(parameter->member_handles[element]);
483 switch (*part++)
485 case '.':
486 return get_parameter_by_name(base, temp_parameter, part);
488 case '@':
489 return get_parameter_annotation_by_name(base, temp_parameter, part);
491 case '\0':
492 TRACE("Returning parameter %p\n", temp_parameter);
493 return temp_parameter;
495 default:
496 FIXME("Unhandled case \"%c\"\n", *--part);
497 break;
501 TRACE("Parameter not found\n");
502 return NULL;
505 static struct d3dx_parameter *get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl *base,
506 struct d3dx_parameter *parameter, LPCSTR name)
508 UINT i, length;
509 struct d3dx_parameter *temp_parameter;
510 LPCSTR part;
512 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
514 if (!name || !*name) return parameter;
516 length = strcspn( name, "[.@" );
517 part = name + length;
519 for (i = 0; i < parameter->annotation_count; ++i)
521 temp_parameter = get_parameter_struct(parameter->annotation_handles[i]);
523 if (!strcmp(temp_parameter->name, name))
525 TRACE("Returning parameter %p\n", temp_parameter);
526 return temp_parameter;
528 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
530 switch (*part++)
532 case '.':
533 return get_parameter_by_name(base, temp_parameter, part);
535 case '[':
536 return get_parameter_element_by_name(base, temp_parameter, part);
538 default:
539 FIXME("Unhandled case \"%c\"\n", *--part);
540 break;
545 TRACE("Parameter not found\n");
546 return NULL;
549 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
550 struct d3dx_parameter *parameter, LPCSTR name)
552 UINT i, count, length;
553 struct d3dx_parameter *temp_parameter;
554 D3DXHANDLE *handles;
555 LPCSTR part;
557 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
559 if (!name || !*name) return parameter;
561 if (!parameter)
563 count = base->parameter_count;
564 handles = base->parameter_handles;
566 else
568 count = parameter->member_count;
569 handles = parameter->member_handles;
572 length = strcspn( name, "[.@" );
573 part = name + length;
575 for (i = 0; i < count; i++)
577 temp_parameter = get_parameter_struct(handles[i]);
579 if (!strcmp(temp_parameter->name, name))
581 TRACE("Returning parameter %p\n", temp_parameter);
582 return temp_parameter;
584 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
586 switch (*part++)
588 case '.':
589 return get_parameter_by_name(base, temp_parameter, part);
591 case '@':
592 return get_parameter_annotation_by_name(base, temp_parameter, part);
594 case '[':
595 return get_parameter_element_by_name(base, temp_parameter, part);
597 default:
598 FIXME("Unhandled case \"%c\"\n", *--part);
599 break;
604 TRACE("Parameter not found\n");
605 return NULL;
608 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
610 return (0xfeff0000 | ((major) << 8) | (minor));
613 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
615 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
618 /*** IUnknown methods ***/
619 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
621 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
623 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
625 if (IsEqualGUID(riid, &IID_IUnknown) ||
626 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
628 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
629 *object = This;
630 return S_OK;
633 ERR("Interface %s not found\n", debugstr_guid(riid));
635 return E_NOINTERFACE;
638 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
640 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
642 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
644 return InterlockedIncrement(&This->ref);
647 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
649 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
650 ULONG ref = InterlockedDecrement(&This->ref);
652 TRACE("iface %p: Release from %u\n", iface, ref + 1);
654 if (!ref)
656 free_base_effect(This);
657 HeapFree(GetProcessHeap(), 0, This);
660 return ref;
663 /*** ID3DXBaseEffect methods ***/
664 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
666 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
668 FIXME("iface %p, desc %p stub\n", This, desc);
670 return E_NOTIMPL;
673 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
675 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
676 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
678 TRACE("iface %p, parameter %p, desc %p\n", This, parameter, desc);
680 if (!param) param = get_parameter_struct(iface->lpVtbl->GetParameterByName(iface, NULL, parameter));
682 if (!desc || !param)
684 WARN("Invalid argument specified.\n");
685 return D3DERR_INVALIDCALL;
688 desc->Name = param->name;
689 desc->Semantic = param->semantic;
690 desc->Class = param->class;
691 desc->Type = param->type;
692 desc->Rows = param->rows;
693 desc->Columns = param->columns;
694 desc->Elements = param->element_count;
695 desc->Annotations = param->annotation_count;
696 desc->StructMembers = param->member_count;
697 desc->Flags = param->flags;
698 desc->Bytes = param->bytes;
700 return D3D_OK;
703 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
705 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
706 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
708 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
710 if (!desc || !tech)
712 WARN("Invalid argument specified.\n");
713 return D3DERR_INVALIDCALL;
716 desc->Name = tech->name;
717 desc->Passes = tech->pass_count;
718 desc->Annotations = tech->annotation_count;
720 return D3D_OK;
723 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
725 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
726 struct d3dx_pass *p = is_valid_pass(This, pass);
728 TRACE("iface %p, pass %p, desc %p\n", This, pass, desc);
730 if (!desc || !p)
732 WARN("Invalid argument specified.\n");
733 return D3DERR_INVALIDCALL;
736 desc->Name = p->name;
737 desc->Annotations = p->annotation_count;
739 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
740 desc->pVertexShaderFunction = NULL;
741 desc->pVertexShaderFunction = NULL;
743 return D3D_OK;
746 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
748 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
750 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
752 return E_NOTIMPL;
755 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
757 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
758 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
760 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
762 if (!param) param = get_parameter_by_name(This, NULL, parameter);
764 if (!parameter)
766 if (index < This->parameter_count)
768 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
769 return This->parameter_handles[index];
772 else
774 if (param && !param->element_count && index < param->member_count)
776 TRACE("Returning parameter %p\n", param->member_handles[index]);
777 return param->member_handles[index];
781 WARN("Invalid argument specified.\n");
783 return NULL;
786 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
788 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
789 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
790 D3DXHANDLE handle;
792 TRACE("iface %p, parameter %p, name %s\n", This, parameter, debugstr_a(name));
794 if (!param) param = get_parameter_by_name(This, NULL, parameter);
796 if (!name)
798 handle = get_parameter_handle(param);
799 TRACE("Returning parameter %p\n", handle);
800 return handle;
803 handle = get_parameter_handle(get_parameter_by_name(This, param, name));
804 TRACE("Returning parameter %p\n", handle);
806 return handle;
809 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
811 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
812 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
813 struct d3dx_parameter *temp_param;
814 UINT i;
816 TRACE("iface %p, parameter %p, semantic %s\n", This, parameter, debugstr_a(semantic));
818 if (!param) param = get_parameter_by_name(This, NULL, parameter);
820 if (!parameter)
822 for (i = 0; i < This->parameter_count; ++i)
824 temp_param = get_parameter_struct(This->parameter_handles[i]);
826 if (!temp_param->semantic)
828 if (!semantic)
830 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
831 return This->parameter_handles[i];
833 continue;
836 if (!strcasecmp(temp_param->semantic, semantic))
838 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
839 return This->parameter_handles[i];
843 else if (param)
845 for (i = 0; i < param->member_count; ++i)
847 temp_param = get_parameter_struct(param->member_handles[i]);
849 if (!temp_param->semantic)
851 if (!semantic)
853 TRACE("Returning parameter %p\n", param->member_handles[i]);
854 return param->member_handles[i];
856 continue;
859 if (!strcasecmp(temp_param->semantic, semantic))
861 TRACE("Returning parameter %p\n", param->member_handles[i]);
862 return param->member_handles[i];
867 WARN("Invalid argument specified\n");
869 return NULL;
872 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
874 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
875 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
877 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
879 if (!param) param = get_parameter_by_name(This, NULL, parameter);
881 if (!param)
883 if (index < This->parameter_count)
885 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
886 return This->parameter_handles[index];
889 else
891 if (index < param->element_count)
893 TRACE("Returning parameter %p\n", param->member_handles[index]);
894 return param->member_handles[index];
898 WARN("Invalid argument specified\n");
900 return NULL;
903 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
905 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
907 TRACE("iface %p, index %u\n", This, index);
909 if (index >= This->technique_count)
911 WARN("Invalid argument specified.\n");
912 return NULL;
915 TRACE("Returning technique %p\n", This->technique_handles[index]);
917 return This->technique_handles[index];
920 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
922 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
923 unsigned int i;
925 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
927 if (!name)
929 WARN("Invalid argument specified.\n");
930 return NULL;
933 for (i = 0; i < This->technique_count; ++i)
935 struct d3dx_technique *tech = get_technique_struct(This->technique_handles[i]);
937 if (!strcmp(tech->name, name))
939 TRACE("Returning technique %p\n", This->technique_handles[i]);
940 return This->technique_handles[i];
944 WARN("Invalid argument specified.\n");
946 return NULL;
949 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
951 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
952 struct d3dx_technique *tech = is_valid_technique(This, technique);
954 TRACE("iface %p, technique %p, index %u\n", This, technique, index);
956 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
958 if (tech && index < tech->pass_count)
960 TRACE("Returning pass %p\n", tech->pass_handles[index]);
961 return tech->pass_handles[index];
964 WARN("Invalid argument specified.\n");
966 return NULL;
969 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
971 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
972 struct d3dx_technique *tech = is_valid_technique(This, technique);
974 TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
976 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
978 if (tech && name)
980 unsigned int i;
982 for (i = 0; i < tech->pass_count; ++i)
984 struct d3dx_pass *pass = get_pass_struct(tech->pass_handles[i]);
986 if (!strcmp(pass->name, name))
988 TRACE("Returning pass %p\n", tech->pass_handles[i]);
989 return tech->pass_handles[i];
994 WARN("Invalid argument specified.\n");
996 return NULL;
999 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
1001 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1003 FIXME("iface %p, index %u stub\n", This, index);
1005 return NULL;
1008 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
1010 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1012 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
1014 return NULL;
1017 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
1019 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1020 struct d3dx_parameter *param = is_valid_parameter(This, object);
1021 struct d3dx_pass *pass = is_valid_pass(This, object);
1022 struct d3dx_technique *technique = is_valid_technique(This, object);
1023 UINT annotation_count = 0;
1024 D3DXHANDLE *annotation_handles = NULL;
1026 FIXME("iface %p, object %p, index %u partial stub\n", This, object, index);
1028 if (pass)
1030 annotation_count = pass->annotation_count;
1031 annotation_handles = pass->annotation_handles;
1033 else if (technique)
1035 annotation_count = technique->annotation_count;
1036 annotation_handles = technique->annotation_handles;
1038 else
1040 if (!param) param = get_parameter_by_name(This, NULL, object);
1042 if (param)
1044 annotation_count = param->annotation_count;
1045 annotation_handles = param->annotation_handles;
1048 /* Todo: add funcs */
1050 if (index < annotation_count)
1052 TRACE("Returning parameter %p\n", annotation_handles[index]);
1053 return annotation_handles[index];
1056 WARN("Invalid argument specified\n");
1058 return NULL;
1061 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
1063 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1065 FIXME("iface %p, object %p, name %s stub\n", This, object, debugstr_a(name));
1067 return NULL;
1070 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1072 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1074 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
1076 return E_NOTIMPL;
1079 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1081 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1082 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1084 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1086 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1088 if (data && param && param->data && param->bytes <= bytes)
1090 if (param->type == D3DXPT_VERTEXSHADER || param->type == D3DXPT_PIXELSHADER)
1092 UINT i;
1094 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
1096 IUnknown *unk = ((IUnknown **)param->data)[i];
1097 if (unk) IUnknown_AddRef(unk);
1098 ((IUnknown **)data)[i] = unk;
1101 else
1103 TRACE("Copy %u bytes\n", param->bytes);
1104 memcpy(data, param->data, param->bytes);
1106 return D3D_OK;
1109 WARN("Invalid argument specified\n");
1111 return D3DERR_INVALIDCALL;
1114 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
1116 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1118 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
1120 return E_NOTIMPL;
1123 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
1125 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1127 FIXME("iface %p, parameter %p, b %p stub\n", This, parameter, b);
1129 return E_NOTIMPL;
1132 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1134 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1136 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1138 return E_NOTIMPL;
1141 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1143 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1145 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1147 return E_NOTIMPL;
1150 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
1152 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1154 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
1156 return E_NOTIMPL;
1159 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1161 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1163 FIXME("iface %p, parameter %p, n %p stub\n", This, parameter, n);
1165 return E_NOTIMPL;
1168 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1170 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1172 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1174 return E_NOTIMPL;
1177 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1179 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1181 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1183 return E_NOTIMPL;
1186 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1188 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1190 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
1192 return E_NOTIMPL;
1195 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1197 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1199 FIXME("iface %p, parameter %p, f %p stub\n", This, parameter, f);
1201 return E_NOTIMPL;
1204 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1206 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1208 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1210 return E_NOTIMPL;
1213 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1215 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1217 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1219 return E_NOTIMPL;
1222 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
1224 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1226 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1228 return E_NOTIMPL;
1231 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1233 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1235 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1237 return E_NOTIMPL;
1240 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1242 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1244 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1246 return E_NOTIMPL;
1249 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1251 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1253 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1255 return E_NOTIMPL;
1258 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1260 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1262 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1264 return E_NOTIMPL;
1267 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1269 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1271 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1273 return E_NOTIMPL;
1276 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1278 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1280 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1282 return E_NOTIMPL;
1285 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1287 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1289 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1291 return E_NOTIMPL;
1294 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1296 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1298 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1300 return E_NOTIMPL;
1303 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1305 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1307 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1309 return E_NOTIMPL;
1312 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1314 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1316 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1318 return E_NOTIMPL;
1321 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1323 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1325 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1327 return E_NOTIMPL;
1330 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1332 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1334 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1336 return E_NOTIMPL;
1339 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1341 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1343 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1345 return E_NOTIMPL;
1348 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1350 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1352 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1354 return E_NOTIMPL;
1357 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1359 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1361 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1363 return E_NOTIMPL;
1366 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1368 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1370 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1372 return E_NOTIMPL;
1375 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1377 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1378 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1380 TRACE("iface %p, parameter %p, string %p\n", This, parameter, string);
1382 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1384 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
1386 *string = *(LPCSTR *)param->data;
1387 TRACE("Returning %s\n", debugstr_a(*string));
1388 return D3D_OK;
1391 WARN("Invalid argument specified\n");
1393 return D3DERR_INVALIDCALL;
1396 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1398 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1400 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1402 return E_NOTIMPL;
1405 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1407 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1409 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1411 return E_NOTIMPL;
1414 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1416 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1417 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1419 TRACE("iface %p, parameter %p, pshader %p\n", This, parameter, pshader);
1421 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1423 if (pshader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
1425 *pshader = *(LPDIRECT3DPIXELSHADER9 *)param->data;
1426 if (*pshader) IDirect3DPixelShader9_AddRef(*pshader);
1427 TRACE("Returning %p\n", *pshader);
1428 return D3D_OK;
1431 WARN("Invalid argument specified\n");
1433 return D3DERR_INVALIDCALL;
1436 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1438 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1439 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1441 TRACE("iface %p, parameter %p, vshader %p\n", This, parameter, vshader);
1443 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1445 if (vshader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
1447 *vshader = *(LPDIRECT3DVERTEXSHADER9 *)param->data;
1448 if (*vshader) IDirect3DVertexShader9_AddRef(*vshader);
1449 TRACE("Returning %p\n", *vshader);
1450 return D3D_OK;
1453 WARN("Invalid argument specified\n");
1455 return D3DERR_INVALIDCALL;
1458 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1460 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1462 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
1464 return E_NOTIMPL;
1467 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
1469 /*** IUnknown methods ***/
1470 ID3DXBaseEffectImpl_QueryInterface,
1471 ID3DXBaseEffectImpl_AddRef,
1472 ID3DXBaseEffectImpl_Release,
1473 /*** ID3DXBaseEffect methods ***/
1474 ID3DXBaseEffectImpl_GetDesc,
1475 ID3DXBaseEffectImpl_GetParameterDesc,
1476 ID3DXBaseEffectImpl_GetTechniqueDesc,
1477 ID3DXBaseEffectImpl_GetPassDesc,
1478 ID3DXBaseEffectImpl_GetFunctionDesc,
1479 ID3DXBaseEffectImpl_GetParameter,
1480 ID3DXBaseEffectImpl_GetParameterByName,
1481 ID3DXBaseEffectImpl_GetParameterBySemantic,
1482 ID3DXBaseEffectImpl_GetParameterElement,
1483 ID3DXBaseEffectImpl_GetTechnique,
1484 ID3DXBaseEffectImpl_GetTechniqueByName,
1485 ID3DXBaseEffectImpl_GetPass,
1486 ID3DXBaseEffectImpl_GetPassByName,
1487 ID3DXBaseEffectImpl_GetFunction,
1488 ID3DXBaseEffectImpl_GetFunctionByName,
1489 ID3DXBaseEffectImpl_GetAnnotation,
1490 ID3DXBaseEffectImpl_GetAnnotationByName,
1491 ID3DXBaseEffectImpl_SetValue,
1492 ID3DXBaseEffectImpl_GetValue,
1493 ID3DXBaseEffectImpl_SetBool,
1494 ID3DXBaseEffectImpl_GetBool,
1495 ID3DXBaseEffectImpl_SetBoolArray,
1496 ID3DXBaseEffectImpl_GetBoolArray,
1497 ID3DXBaseEffectImpl_SetInt,
1498 ID3DXBaseEffectImpl_GetInt,
1499 ID3DXBaseEffectImpl_SetIntArray,
1500 ID3DXBaseEffectImpl_GetIntArray,
1501 ID3DXBaseEffectImpl_SetFloat,
1502 ID3DXBaseEffectImpl_GetFloat,
1503 ID3DXBaseEffectImpl_SetFloatArray,
1504 ID3DXBaseEffectImpl_GetFloatArray,
1505 ID3DXBaseEffectImpl_SetVector,
1506 ID3DXBaseEffectImpl_GetVector,
1507 ID3DXBaseEffectImpl_SetVectorArray,
1508 ID3DXBaseEffectImpl_GetVectorArray,
1509 ID3DXBaseEffectImpl_SetMatrix,
1510 ID3DXBaseEffectImpl_GetMatrix,
1511 ID3DXBaseEffectImpl_SetMatrixArray,
1512 ID3DXBaseEffectImpl_GetMatrixArray,
1513 ID3DXBaseEffectImpl_SetMatrixPointerArray,
1514 ID3DXBaseEffectImpl_GetMatrixPointerArray,
1515 ID3DXBaseEffectImpl_SetMatrixTranspose,
1516 ID3DXBaseEffectImpl_GetMatrixTranspose,
1517 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
1518 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
1519 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
1520 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
1521 ID3DXBaseEffectImpl_SetString,
1522 ID3DXBaseEffectImpl_GetString,
1523 ID3DXBaseEffectImpl_SetTexture,
1524 ID3DXBaseEffectImpl_GetTexture,
1525 ID3DXBaseEffectImpl_GetPixelShader,
1526 ID3DXBaseEffectImpl_GetVertexShader,
1527 ID3DXBaseEffectImpl_SetArrayRange,
1530 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
1532 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
1535 /*** IUnknown methods ***/
1536 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
1538 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1540 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
1542 if (IsEqualGUID(riid, &IID_IUnknown) ||
1543 IsEqualGUID(riid, &IID_ID3DXEffect))
1545 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
1546 *object = This;
1547 return S_OK;
1550 ERR("Interface %s not found\n", debugstr_guid(riid));
1552 return E_NOINTERFACE;
1555 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
1557 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1559 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1561 return InterlockedIncrement(&This->ref);
1564 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
1566 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1567 ULONG ref = InterlockedDecrement(&This->ref);
1569 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
1571 if (!ref)
1573 free_effect(This);
1574 HeapFree(GetProcessHeap(), 0, This);
1577 return ref;
1580 /*** ID3DXBaseEffect methods ***/
1581 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
1583 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1584 ID3DXBaseEffect *base = This->base_effect;
1586 TRACE("Forward iface %p, base %p\n", This, base);
1588 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1591 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1593 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1594 ID3DXBaseEffect *base = This->base_effect;
1596 TRACE("Forward iface %p, base %p\n", This, base);
1598 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1601 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1603 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1604 ID3DXBaseEffect *base = This->base_effect;
1606 TRACE("Forward iface %p, base %p\n", This, base);
1608 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1611 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1613 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1614 ID3DXBaseEffect *base = This->base_effect;
1616 TRACE("Forward iface %p, base %p\n", This, base);
1618 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1621 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1623 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1624 ID3DXBaseEffect *base = This->base_effect;
1626 TRACE("Forward iface %p, base %p\n", This, base);
1628 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1631 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1633 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1634 ID3DXBaseEffect *base = This->base_effect;
1636 TRACE("Forward iface %p, base %p\n", This, base);
1638 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1641 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1643 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1644 ID3DXBaseEffect *base = This->base_effect;
1646 TRACE("Forward iface %p, base %p\n", This, base);
1648 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1651 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1653 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1654 ID3DXBaseEffect *base = This->base_effect;
1656 TRACE("Forward iface %p, base %p\n", This, base);
1658 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1661 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1663 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1664 ID3DXBaseEffect *base = This->base_effect;
1666 TRACE("Forward iface %p, base %p\n", This, base);
1668 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1671 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
1673 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1674 ID3DXBaseEffect *base = This->base_effect;
1676 TRACE("Forward iface %p, base %p\n", This, base);
1678 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1681 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
1683 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1684 ID3DXBaseEffect *base = This->base_effect;
1686 TRACE("Forward iface %p, base %p\n", This, base);
1688 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1691 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
1693 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1694 ID3DXBaseEffect *base = This->base_effect;
1696 TRACE("Forward iface %p, base %p\n", This, base);
1698 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1701 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
1703 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1704 ID3DXBaseEffect *base = This->base_effect;
1706 TRACE("Forward iface %p, base %p\n", This, base);
1708 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1711 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
1713 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1714 ID3DXBaseEffect *base = This->base_effect;
1716 TRACE("Forward iface %p, base %p\n", This, base);
1718 return ID3DXBaseEffectImpl_GetFunction(base, index);
1721 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1723 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1724 ID3DXBaseEffect *base = This->base_effect;
1726 TRACE("Forward iface %p, base %p\n", This, base);
1728 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1731 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1733 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1734 ID3DXBaseEffect *base = This->base_effect;
1736 TRACE("Forward iface %p, base %p\n", This, base);
1738 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1741 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1743 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1744 ID3DXBaseEffect *base = This->base_effect;
1746 TRACE("Forward iface %p, base %p\n", This, base);
1748 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1751 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1753 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1754 ID3DXBaseEffect *base = This->base_effect;
1756 TRACE("Forward iface %p, base %p\n", This, base);
1758 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1761 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1763 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1764 ID3DXBaseEffect *base = This->base_effect;
1766 TRACE("Forward iface %p, base %p\n", This, base);
1768 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1771 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1773 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1774 ID3DXBaseEffect *base = This->base_effect;
1776 TRACE("Forward iface %p, base %p\n", This, base);
1778 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1781 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1783 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1784 ID3DXBaseEffect *base = This->base_effect;
1786 TRACE("Forward iface %p, base %p\n", This, base);
1788 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1791 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1793 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1794 ID3DXBaseEffect *base = This->base_effect;
1796 TRACE("Forward iface %p, base %p\n", This, base);
1798 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1801 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1803 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1804 ID3DXBaseEffect *base = This->base_effect;
1806 TRACE("Forward iface %p, base %p\n", This, base);
1808 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1811 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
1813 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1814 ID3DXBaseEffect *base = This->base_effect;
1816 TRACE("Forward iface %p, base %p\n", This, base);
1818 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1821 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1823 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1824 ID3DXBaseEffect *base = This->base_effect;
1826 TRACE("Forward iface %p, base %p\n", This, base);
1828 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1831 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1833 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1834 ID3DXBaseEffect *base = This->base_effect;
1836 TRACE("Forward iface %p, base %p\n", This, base);
1838 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1841 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1843 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1844 ID3DXBaseEffect *base = This->base_effect;
1846 TRACE("Forward iface %p, base %p\n", This, base);
1848 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1851 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
1853 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1854 ID3DXBaseEffect *base = This->base_effect;
1856 TRACE("Forward iface %p, base %p\n", This, base);
1858 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1861 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1863 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1864 ID3DXBaseEffect *base = This->base_effect;
1866 TRACE("Forward iface %p, base %p\n", This, base);
1868 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1871 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1873 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1874 ID3DXBaseEffect *base = This->base_effect;
1876 TRACE("Forward iface %p, base %p\n", This, base);
1878 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1881 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1883 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1884 ID3DXBaseEffect *base = This->base_effect;
1886 TRACE("Forward iface %p, base %p\n", This, base);
1888 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1891 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1893 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1894 ID3DXBaseEffect *base = This->base_effect;
1896 TRACE("Forward iface %p, base %p\n", This, base);
1898 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1901 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1903 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1904 ID3DXBaseEffect *base = This->base_effect;
1906 TRACE("Forward iface %p, base %p\n", This, base);
1908 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1911 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1913 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1914 ID3DXBaseEffect *base = This->base_effect;
1916 TRACE("Forward iface %p, base %p\n", This, base);
1918 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1921 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1923 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1924 ID3DXBaseEffect *base = This->base_effect;
1926 TRACE("Forward iface %p, base %p\n", This, base);
1928 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
1931 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1933 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1934 ID3DXBaseEffect *base = This->base_effect;
1936 TRACE("Forward iface %p, base %p\n", This, base);
1938 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
1941 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1943 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1944 ID3DXBaseEffect *base = This->base_effect;
1946 TRACE("Forward iface %p, base %p\n", This, base);
1948 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
1951 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1953 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1954 ID3DXBaseEffect *base = This->base_effect;
1956 TRACE("Forward iface %p, base %p\n", This, base);
1958 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
1961 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1963 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1964 ID3DXBaseEffect *base = This->base_effect;
1966 TRACE("Forward iface %p, base %p\n", This, base);
1968 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
1971 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1973 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1974 ID3DXBaseEffect *base = This->base_effect;
1976 TRACE("Forward iface %p, base %p\n", This, base);
1978 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
1981 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1983 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1984 ID3DXBaseEffect *base = This->base_effect;
1986 TRACE("Forward iface %p, base %p\n", This, base);
1988 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
1991 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1993 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1994 ID3DXBaseEffect *base = This->base_effect;
1996 TRACE("Forward iface %p, base %p\n", This, base);
1998 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2001 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2003 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2004 ID3DXBaseEffect *base = This->base_effect;
2006 TRACE("Forward iface %p, base %p\n", This, base);
2008 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2011 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2013 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2014 ID3DXBaseEffect *base = This->base_effect;
2016 TRACE("Forward iface %p, base %p\n", This, base);
2018 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2021 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2023 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2024 ID3DXBaseEffect *base = This->base_effect;
2026 TRACE("Forward iface %p, base %p\n", This, base);
2028 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2031 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2033 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2034 ID3DXBaseEffect *base = This->base_effect;
2036 TRACE("Forward iface %p, base %p\n", This, base);
2038 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2041 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2043 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2044 ID3DXBaseEffect *base = This->base_effect;
2046 TRACE("Forward iface %p, base %p\n", This, base);
2048 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2051 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
2053 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2054 ID3DXBaseEffect *base = This->base_effect;
2056 TRACE("Forward iface %p, base %p\n", This, base);
2058 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2061 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
2063 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2064 ID3DXBaseEffect *base = This->base_effect;
2066 TRACE("Forward iface %p, base %p\n", This, base);
2068 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2071 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2073 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2074 ID3DXBaseEffect *base = This->base_effect;
2076 TRACE("Forward iface %p, base %p\n", This, base);
2078 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2081 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2083 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2084 ID3DXBaseEffect *base = This->base_effect;
2086 TRACE("Forward iface %p, base %p\n", This, base);
2088 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2091 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2093 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2094 ID3DXBaseEffect *base = This->base_effect;
2096 TRACE("Forward iface %p, base %p\n", This, base);
2098 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2101 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2103 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2104 ID3DXBaseEffect *base = This->base_effect;
2106 TRACE("Forward iface %p, base %p\n", This, base);
2108 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2111 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2113 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2114 ID3DXBaseEffect *base = This->base_effect;
2116 TRACE("Forward iface %p, base %p\n", This, base);
2118 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2121 /*** ID3DXEffect methods ***/
2122 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
2124 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2126 TRACE("iface %p, pool %p\n", This, pool);
2128 if (!pool)
2130 WARN("Invalid argument supplied.\n");
2131 return D3DERR_INVALIDCALL;
2134 if (This->pool)
2136 This->pool->lpVtbl->AddRef(This->pool);
2139 *pool = This->pool;
2141 TRACE("Returning pool %p\n", *pool);
2143 return S_OK;
2146 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2148 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2150 FIXME("(%p)->(%p): stub\n", This, technique);
2152 return E_NOTIMPL;
2155 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
2157 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2159 FIXME("(%p)->(): stub\n", This);
2161 return NULL;
2164 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2166 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2168 FIXME("(%p)->(%p): stub\n", This, technique);
2170 return D3D_OK;
2173 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
2175 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2177 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
2179 return E_NOTIMPL;
2182 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
2184 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2186 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
2188 return FALSE;
2191 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
2193 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2195 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
2197 return E_NOTIMPL;
2200 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
2202 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2204 FIXME("(%p)->(%u): stub\n", This, pass);
2206 return E_NOTIMPL;
2209 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
2211 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2213 FIXME("(%p)->(): stub\n", This);
2215 return E_NOTIMPL;
2218 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
2220 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2222 FIXME("(%p)->(): stub\n", This);
2224 return E_NOTIMPL;
2227 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
2229 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2231 FIXME("(%p)->(): stub\n", This);
2233 return E_NOTIMPL;
2236 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
2238 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2240 TRACE("iface %p, device %p\n", This, device);
2242 if (!device)
2244 WARN("Invalid argument supplied.\n");
2245 return D3DERR_INVALIDCALL;
2248 IDirect3DDevice9_AddRef(This->device);
2250 *device = This->device;
2252 TRACE("Returning device %p\n", *device);
2254 return S_OK;
2257 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
2259 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2261 FIXME("(%p)->(): stub\n", This);
2263 return E_NOTIMPL;
2266 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
2268 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2270 FIXME("(%p)->(): stub\n", This);
2272 return E_NOTIMPL;
2275 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER manager)
2277 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2279 FIXME("(%p)->(%p): stub\n", This, manager);
2281 return E_NOTIMPL;
2284 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER* manager)
2286 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2288 FIXME("(%p)->(%p): stub\n", This, manager);
2290 return E_NOTIMPL;
2293 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
2295 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2297 FIXME("(%p)->(): stub\n", This);
2299 return E_NOTIMPL;
2302 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
2304 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2306 FIXME("(%p)->(): stub\n", This);
2308 return NULL;
2311 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2313 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2315 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2317 return E_NOTIMPL;
2320 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2322 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2324 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2326 return E_NOTIMPL;
2329 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
2331 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2333 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
2335 return E_NOTIMPL;
2338 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
2340 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2342 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
2344 return E_NOTIMPL;
2347 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
2349 /*** IUnknown methods ***/
2350 ID3DXEffectImpl_QueryInterface,
2351 ID3DXEffectImpl_AddRef,
2352 ID3DXEffectImpl_Release,
2353 /*** ID3DXBaseEffect methods ***/
2354 ID3DXEffectImpl_GetDesc,
2355 ID3DXEffectImpl_GetParameterDesc,
2356 ID3DXEffectImpl_GetTechniqueDesc,
2357 ID3DXEffectImpl_GetPassDesc,
2358 ID3DXEffectImpl_GetFunctionDesc,
2359 ID3DXEffectImpl_GetParameter,
2360 ID3DXEffectImpl_GetParameterByName,
2361 ID3DXEffectImpl_GetParameterBySemantic,
2362 ID3DXEffectImpl_GetParameterElement,
2363 ID3DXEffectImpl_GetTechnique,
2364 ID3DXEffectImpl_GetTechniqueByName,
2365 ID3DXEffectImpl_GetPass,
2366 ID3DXEffectImpl_GetPassByName,
2367 ID3DXEffectImpl_GetFunction,
2368 ID3DXEffectImpl_GetFunctionByName,
2369 ID3DXEffectImpl_GetAnnotation,
2370 ID3DXEffectImpl_GetAnnotationByName,
2371 ID3DXEffectImpl_SetValue,
2372 ID3DXEffectImpl_GetValue,
2373 ID3DXEffectImpl_SetBool,
2374 ID3DXEffectImpl_GetBool,
2375 ID3DXEffectImpl_SetBoolArray,
2376 ID3DXEffectImpl_GetBoolArray,
2377 ID3DXEffectImpl_SetInt,
2378 ID3DXEffectImpl_GetInt,
2379 ID3DXEffectImpl_SetIntArray,
2380 ID3DXEffectImpl_GetIntArray,
2381 ID3DXEffectImpl_SetFloat,
2382 ID3DXEffectImpl_GetFloat,
2383 ID3DXEffectImpl_SetFloatArray,
2384 ID3DXEffectImpl_GetFloatArray,
2385 ID3DXEffectImpl_SetVector,
2386 ID3DXEffectImpl_GetVector,
2387 ID3DXEffectImpl_SetVectorArray,
2388 ID3DXEffectImpl_GetVectorArray,
2389 ID3DXEffectImpl_SetMatrix,
2390 ID3DXEffectImpl_GetMatrix,
2391 ID3DXEffectImpl_SetMatrixArray,
2392 ID3DXEffectImpl_GetMatrixArray,
2393 ID3DXEffectImpl_SetMatrixPointerArray,
2394 ID3DXEffectImpl_GetMatrixPointerArray,
2395 ID3DXEffectImpl_SetMatrixTranspose,
2396 ID3DXEffectImpl_GetMatrixTranspose,
2397 ID3DXEffectImpl_SetMatrixTransposeArray,
2398 ID3DXEffectImpl_GetMatrixTransposeArray,
2399 ID3DXEffectImpl_SetMatrixTransposePointerArray,
2400 ID3DXEffectImpl_GetMatrixTransposePointerArray,
2401 ID3DXEffectImpl_SetString,
2402 ID3DXEffectImpl_GetString,
2403 ID3DXEffectImpl_SetTexture,
2404 ID3DXEffectImpl_GetTexture,
2405 ID3DXEffectImpl_GetPixelShader,
2406 ID3DXEffectImpl_GetVertexShader,
2407 ID3DXEffectImpl_SetArrayRange,
2408 /*** ID3DXEffect methods ***/
2409 ID3DXEffectImpl_GetPool,
2410 ID3DXEffectImpl_SetTechnique,
2411 ID3DXEffectImpl_GetCurrentTechnique,
2412 ID3DXEffectImpl_ValidateTechnique,
2413 ID3DXEffectImpl_FindNextValidTechnique,
2414 ID3DXEffectImpl_IsParameterUsed,
2415 ID3DXEffectImpl_Begin,
2416 ID3DXEffectImpl_BeginPass,
2417 ID3DXEffectImpl_CommitChanges,
2418 ID3DXEffectImpl_EndPass,
2419 ID3DXEffectImpl_End,
2420 ID3DXEffectImpl_GetDevice,
2421 ID3DXEffectImpl_OnLostDevice,
2422 ID3DXEffectImpl_OnResetDevice,
2423 ID3DXEffectImpl_SetStateManager,
2424 ID3DXEffectImpl_GetStateManager,
2425 ID3DXEffectImpl_BeginParameterBlock,
2426 ID3DXEffectImpl_EndParameterBlock,
2427 ID3DXEffectImpl_ApplyParameterBlock,
2428 ID3DXEffectImpl_DeleteParameterBlock,
2429 ID3DXEffectImpl_CloneEffect,
2430 ID3DXEffectImpl_SetRawValue
2433 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
2435 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
2438 /*** IUnknown methods ***/
2439 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
2441 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2443 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
2445 if (IsEqualGUID(riid, &IID_IUnknown) ||
2446 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
2448 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
2449 *object = This;
2450 return S_OK;
2453 ERR("Interface %s not found\n", debugstr_guid(riid));
2455 return E_NOINTERFACE;
2458 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
2460 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2462 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
2464 return InterlockedIncrement(&This->ref);
2467 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
2469 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2470 ULONG ref = InterlockedDecrement(&This->ref);
2472 TRACE("iface %p: Release from %u\n", iface, ref + 1);
2474 if (!ref)
2476 free_effect_compiler(This);
2477 HeapFree(GetProcessHeap(), 0, This);
2480 return ref;
2483 /*** ID3DXBaseEffect methods ***/
2484 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
2486 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2487 ID3DXBaseEffect *base = This->base_effect;
2489 TRACE("Forward iface %p, base %p\n", This, base);
2491 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2494 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2496 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2497 ID3DXBaseEffect *base = This->base_effect;
2499 TRACE("Forward iface %p, base %p\n", This, base);
2501 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2504 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2506 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2507 ID3DXBaseEffect *base = This->base_effect;
2509 TRACE("Forward iface %p, base %p\n", This, base);
2511 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2514 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2516 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2517 ID3DXBaseEffect *base = This->base_effect;
2519 TRACE("Forward iface %p, base %p\n", This, base);
2521 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2524 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2526 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2527 ID3DXBaseEffect *base = This->base_effect;
2529 TRACE("Forward iface %p, base %p\n", This, base);
2531 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2534 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2536 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2537 ID3DXBaseEffect *base = This->base_effect;
2539 TRACE("Forward iface %p, base %p\n", This, base);
2541 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2544 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
2546 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2547 ID3DXBaseEffect *base = This->base_effect;
2549 TRACE("Forward iface %p, base %p\n", This, base);
2551 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2554 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
2556 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2557 ID3DXBaseEffect *base = This->base_effect;
2559 TRACE("Forward iface %p, base %p\n", This, base);
2561 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2564 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2566 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2567 ID3DXBaseEffect *base = This->base_effect;
2569 TRACE("Forward iface %p, base %p\n", This, base);
2571 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2574 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
2576 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2577 ID3DXBaseEffect *base = This->base_effect;
2579 TRACE("Forward iface %p, base %p\n", This, base);
2581 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2584 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
2586 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2587 ID3DXBaseEffect *base = This->base_effect;
2589 TRACE("Forward iface %p, base %p\n", This, base);
2591 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2594 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
2596 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2597 ID3DXBaseEffect *base = This->base_effect;
2599 TRACE("Forward iface %p, base %p\n", This, base);
2601 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2604 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
2606 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2607 ID3DXBaseEffect *base = This->base_effect;
2609 TRACE("Forward iface %p, base %p\n", This, base);
2611 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2614 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
2616 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2617 ID3DXBaseEffect *base = This->base_effect;
2619 TRACE("Forward iface %p, base %p\n", This, base);
2621 return ID3DXBaseEffectImpl_GetFunction(base, index);
2624 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
2626 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2627 ID3DXBaseEffect *base = This->base_effect;
2629 TRACE("Forward iface %p, base %p\n", This, base);
2631 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2634 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
2636 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2637 ID3DXBaseEffect *base = This->base_effect;
2639 TRACE("Forward iface %p, base %p\n", This, base);
2641 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2644 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
2646 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2647 ID3DXBaseEffect *base = This->base_effect;
2649 TRACE("Forward iface %p, base %p\n", This, base);
2651 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2654 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2656 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2657 ID3DXBaseEffect *base = This->base_effect;
2659 TRACE("Forward iface %p, base %p\n", This, base);
2661 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2664 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2666 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2667 ID3DXBaseEffect *base = This->base_effect;
2669 TRACE("Forward iface %p, base %p\n", This, base);
2671 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2674 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
2676 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2677 ID3DXBaseEffect *base = This->base_effect;
2679 TRACE("Forward iface %p, base %p\n", This, base);
2681 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2684 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
2686 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2687 ID3DXBaseEffect *base = This->base_effect;
2689 TRACE("Forward iface %p, base %p\n", This, base);
2691 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2694 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2696 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2697 ID3DXBaseEffect *base = This->base_effect;
2699 TRACE("Forward iface %p, base %p\n", This, base);
2701 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2704 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2706 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2707 ID3DXBaseEffect *base = This->base_effect;
2709 TRACE("Forward iface %p, base %p\n", This, base);
2711 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2714 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
2716 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2717 ID3DXBaseEffect *base = This->base_effect;
2719 TRACE("Forward iface %p, base %p\n", This, base);
2721 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2724 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2726 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2727 ID3DXBaseEffect *base = This->base_effect;
2729 TRACE("Forward iface %p, base %p\n", This, base);
2731 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2734 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2736 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2737 ID3DXBaseEffect *base = This->base_effect;
2739 TRACE("Forward iface %p, base %p\n", This, base);
2741 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2744 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2746 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2747 ID3DXBaseEffect *base = This->base_effect;
2749 TRACE("Forward iface %p, base %p\n", This, base);
2751 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2754 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2756 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2757 ID3DXBaseEffect *base = This->base_effect;
2759 TRACE("Forward iface %p, base %p\n", This, base);
2761 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2764 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2766 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2767 ID3DXBaseEffect *base = This->base_effect;
2769 TRACE("Forward iface %p, base %p\n", This, base);
2771 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2774 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2776 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2777 ID3DXBaseEffect *base = This->base_effect;
2779 TRACE("Forward iface %p, base %p\n", This, base);
2781 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2784 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2786 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2787 ID3DXBaseEffect *base = This->base_effect;
2789 TRACE("Forward iface %p, base %p\n", This, base);
2791 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2794 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2796 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2797 ID3DXBaseEffect *base = This->base_effect;
2799 TRACE("Forward iface %p, base %p\n", This, base);
2801 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2804 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2806 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2807 ID3DXBaseEffect *base = This->base_effect;
2809 TRACE("Forward iface %p, base %p\n", This, base);
2811 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2814 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2816 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2817 ID3DXBaseEffect *base = This->base_effect;
2819 TRACE("Forward iface %p, base %p\n", This, base);
2821 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2824 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2826 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2827 ID3DXBaseEffect *base = This->base_effect;
2829 TRACE("Forward iface %p, base %p\n", This, base);
2831 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2834 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2836 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2837 ID3DXBaseEffect *base = This->base_effect;
2839 TRACE("Forward iface %p, base %p\n", This, base);
2841 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2844 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2846 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2847 ID3DXBaseEffect *base = This->base_effect;
2849 TRACE("Forward iface %p, base %p\n", This, base);
2851 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2854 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2856 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2857 ID3DXBaseEffect *base = This->base_effect;
2859 TRACE("Forward iface %p, base %p\n", This, base);
2861 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2864 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2866 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2867 ID3DXBaseEffect *base = This->base_effect;
2869 TRACE("Forward iface %p, base %p\n", This, base);
2871 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2874 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2876 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2877 ID3DXBaseEffect *base = This->base_effect;
2879 TRACE("Forward iface %p, base %p\n", This, base);
2881 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2884 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2886 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2887 ID3DXBaseEffect *base = This->base_effect;
2889 TRACE("Forward iface %p, base %p\n", This, base);
2891 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2894 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2896 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2897 ID3DXBaseEffect *base = This->base_effect;
2899 TRACE("Forward iface %p, base %p\n", This, base);
2901 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2904 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2906 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2907 ID3DXBaseEffect *base = This->base_effect;
2909 TRACE("Forward iface %p, base %p\n", This, base);
2911 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2914 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2916 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2917 ID3DXBaseEffect *base = This->base_effect;
2919 TRACE("Forward iface %p, base %p\n", This, base);
2921 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2924 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2926 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2927 ID3DXBaseEffect *base = This->base_effect;
2929 TRACE("Forward iface %p, base %p\n", This, base);
2931 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2934 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2936 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2937 ID3DXBaseEffect *base = This->base_effect;
2939 TRACE("Forward iface %p, base %p\n", This, base);
2941 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2944 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2946 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2947 ID3DXBaseEffect *base = This->base_effect;
2949 TRACE("Forward iface %p, base %p\n", This, base);
2951 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2954 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
2956 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2957 ID3DXBaseEffect *base = This->base_effect;
2959 TRACE("Forward iface %p, base %p\n", This, base);
2961 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2964 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
2966 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2967 ID3DXBaseEffect *base = This->base_effect;
2969 TRACE("Forward iface %p, base %p\n", This, base);
2971 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2974 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2976 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2977 ID3DXBaseEffect *base = This->base_effect;
2979 TRACE("Forward iface %p, base %p\n", This, base);
2981 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2984 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2986 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2987 ID3DXBaseEffect *base = This->base_effect;
2989 TRACE("Forward iface %p, base %p\n", This, base);
2991 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2994 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2996 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2997 ID3DXBaseEffect *base = This->base_effect;
2999 TRACE("Forward iface %p, base %p\n", This, base);
3001 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
3004 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
3006 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3007 ID3DXBaseEffect *base = This->base_effect;
3009 TRACE("Forward iface %p, base %p\n", This, base);
3011 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
3014 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
3016 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3017 ID3DXBaseEffect *base = This->base_effect;
3019 TRACE("Forward iface %p, base %p\n", This, base);
3021 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
3024 /*** ID3DXEffectCompiler methods ***/
3025 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
3027 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3029 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
3031 return E_NOTIMPL;
3034 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
3036 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3038 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
3040 return E_NOTIMPL;
3043 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
3044 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
3046 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3048 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
3050 return E_NOTIMPL;
3053 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
3054 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
3056 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3058 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3059 This, function, target, flags, shader, error_msgs, constant_table);
3061 return E_NOTIMPL;
3064 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
3066 /*** IUnknown methods ***/
3067 ID3DXEffectCompilerImpl_QueryInterface,
3068 ID3DXEffectCompilerImpl_AddRef,
3069 ID3DXEffectCompilerImpl_Release,
3070 /*** ID3DXBaseEffect methods ***/
3071 ID3DXEffectCompilerImpl_GetDesc,
3072 ID3DXEffectCompilerImpl_GetParameterDesc,
3073 ID3DXEffectCompilerImpl_GetTechniqueDesc,
3074 ID3DXEffectCompilerImpl_GetPassDesc,
3075 ID3DXEffectCompilerImpl_GetFunctionDesc,
3076 ID3DXEffectCompilerImpl_GetParameter,
3077 ID3DXEffectCompilerImpl_GetParameterByName,
3078 ID3DXEffectCompilerImpl_GetParameterBySemantic,
3079 ID3DXEffectCompilerImpl_GetParameterElement,
3080 ID3DXEffectCompilerImpl_GetTechnique,
3081 ID3DXEffectCompilerImpl_GetTechniqueByName,
3082 ID3DXEffectCompilerImpl_GetPass,
3083 ID3DXEffectCompilerImpl_GetPassByName,
3084 ID3DXEffectCompilerImpl_GetFunction,
3085 ID3DXEffectCompilerImpl_GetFunctionByName,
3086 ID3DXEffectCompilerImpl_GetAnnotation,
3087 ID3DXEffectCompilerImpl_GetAnnotationByName,
3088 ID3DXEffectCompilerImpl_SetValue,
3089 ID3DXEffectCompilerImpl_GetValue,
3090 ID3DXEffectCompilerImpl_SetBool,
3091 ID3DXEffectCompilerImpl_GetBool,
3092 ID3DXEffectCompilerImpl_SetBoolArray,
3093 ID3DXEffectCompilerImpl_GetBoolArray,
3094 ID3DXEffectCompilerImpl_SetInt,
3095 ID3DXEffectCompilerImpl_GetInt,
3096 ID3DXEffectCompilerImpl_SetIntArray,
3097 ID3DXEffectCompilerImpl_GetIntArray,
3098 ID3DXEffectCompilerImpl_SetFloat,
3099 ID3DXEffectCompilerImpl_GetFloat,
3100 ID3DXEffectCompilerImpl_SetFloatArray,
3101 ID3DXEffectCompilerImpl_GetFloatArray,
3102 ID3DXEffectCompilerImpl_SetVector,
3103 ID3DXEffectCompilerImpl_GetVector,
3104 ID3DXEffectCompilerImpl_SetVectorArray,
3105 ID3DXEffectCompilerImpl_GetVectorArray,
3106 ID3DXEffectCompilerImpl_SetMatrix,
3107 ID3DXEffectCompilerImpl_GetMatrix,
3108 ID3DXEffectCompilerImpl_SetMatrixArray,
3109 ID3DXEffectCompilerImpl_GetMatrixArray,
3110 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
3111 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
3112 ID3DXEffectCompilerImpl_SetMatrixTranspose,
3113 ID3DXEffectCompilerImpl_GetMatrixTranspose,
3114 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
3115 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
3116 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
3117 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
3118 ID3DXEffectCompilerImpl_SetString,
3119 ID3DXEffectCompilerImpl_GetString,
3120 ID3DXEffectCompilerImpl_SetTexture,
3121 ID3DXEffectCompilerImpl_GetTexture,
3122 ID3DXEffectCompilerImpl_GetPixelShader,
3123 ID3DXEffectCompilerImpl_GetVertexShader,
3124 ID3DXEffectCompilerImpl_SetArrayRange,
3125 /*** ID3DXEffectCompiler methods ***/
3126 ID3DXEffectCompilerImpl_SetLiteral,
3127 ID3DXEffectCompilerImpl_GetLiteral,
3128 ID3DXEffectCompilerImpl_CompileEffect,
3129 ID3DXEffectCompilerImpl_CompileShader,
3132 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char **ptr)
3134 unsigned int i;
3135 HRESULT hr;
3136 UINT old_size = 0;
3137 DWORD id;
3139 if (param->element_count)
3141 param->data = value;
3143 for (i = 0; i < param->element_count; ++i)
3145 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3147 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3148 if (hr != D3D_OK)
3150 WARN("Failed to parse value\n");
3151 return hr;
3154 old_size += member->bytes;
3157 return D3D_OK;
3160 switch(param->class)
3162 case D3DXPC_SCALAR:
3163 case D3DXPC_VECTOR:
3164 case D3DXPC_MATRIX_ROWS:
3165 case D3DXPC_MATRIX_COLUMNS:
3166 param->data = value;
3167 break;
3169 case D3DXPC_STRUCT:
3170 param->data = value;
3172 for (i = 0; i < param->member_count; ++i)
3174 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3176 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3177 if (hr != D3D_OK)
3179 WARN("Failed to parse value\n");
3180 return hr;
3183 old_size += member->bytes;
3185 break;
3187 case D3DXPC_OBJECT:
3188 switch (param->type)
3190 case D3DXPT_STRING:
3191 case D3DXPT_PIXELSHADER:
3192 case D3DXPT_VERTEXSHADER:
3193 read_dword(ptr, &id);
3194 TRACE("Id: %u\n", id);
3195 param->base->objects[id] = get_parameter_handle(param);
3196 param->data = value;
3197 break;
3199 default:
3200 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3201 break;
3203 break;
3205 default:
3206 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3207 break;
3210 return D3D_OK;
3213 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
3215 UINT size = param->bytes;
3216 HRESULT hr;
3217 void *value = NULL;
3219 TRACE("param size: %u\n", size);
3221 value = HeapAlloc(GetProcessHeap(), 0, size);
3222 if (!value)
3224 ERR("Failed to allocate data memory.\n");
3225 return E_OUTOFMEMORY;
3228 TRACE("Data: %s.\n", debugstr_an(ptr, size));
3229 memcpy(value, ptr, size);
3231 hr = d3dx9_parse_value(param, value, &ptr);
3232 if (hr != D3D_OK)
3234 WARN("Failed to parse value\n");
3235 HeapFree(GetProcessHeap(), 0, value);
3236 return hr;
3239 param->data = value;
3241 return D3D_OK;
3244 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
3246 DWORD size;
3248 read_dword(&ptr, &size);
3249 TRACE("Name size: %#x\n", size);
3251 if (!size)
3253 return D3D_OK;
3256 *name = HeapAlloc(GetProcessHeap(), 0, size);
3257 if (!*name)
3259 ERR("Failed to allocate name memory.\n");
3260 return E_OUTOFMEMORY;
3263 TRACE("Name: %s.\n", debugstr_an(ptr, size));
3264 memcpy(*name, ptr, size);
3266 return D3D_OK;
3269 static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr)
3271 DWORD size;
3272 HRESULT hr;
3274 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type));
3276 read_dword(ptr, &size);
3277 TRACE("Data size: %#x\n", size);
3279 if (!size)
3281 TRACE("Size is 0\n");
3282 *(void **)param->data = NULL;
3283 return D3D_OK;
3286 switch (param->type)
3288 case D3DXPT_STRING:
3289 /* re-read with size (sizeof(DWORD) = 4) */
3290 hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
3291 if (hr != D3D_OK)
3293 WARN("Failed to parse string data\n");
3294 return hr;
3296 break;
3298 case D3DXPT_VERTEXSHADER:
3299 hr = IDirect3DDevice9_CreateVertexShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DVERTEXSHADER9 *)param->data);
3300 if (hr != D3D_OK)
3302 WARN("Failed to create vertex shader\n");
3303 return hr;
3305 break;
3307 case D3DXPT_PIXELSHADER:
3308 hr = IDirect3DDevice9_CreatePixelShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DPIXELSHADER9 *)param->data);
3309 if (hr != D3D_OK)
3311 WARN("Failed to create pixel shader\n");
3312 return hr;
3314 break;
3316 default:
3317 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3318 break;
3322 *ptr += ((size + 3) & ~3);
3324 return D3D_OK;
3327 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr,
3328 struct d3dx_parameter *parent, UINT flags)
3330 DWORD offset;
3331 HRESULT hr;
3332 D3DXHANDLE *member_handles = NULL;
3333 UINT i;
3335 param->flags = flags;
3337 if (!parent)
3339 read_dword(ptr, &param->type);
3340 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
3342 read_dword(ptr, &param->class);
3343 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
3345 read_dword(ptr, &offset);
3346 TRACE("Type name offset: %#x\n", offset);
3347 hr = d3dx9_parse_name(&param->name, data + offset);
3348 if (hr != D3D_OK)
3350 WARN("Failed to parse name\n");
3351 goto err_out;
3354 read_dword(ptr, &offset);
3355 TRACE("Type semantic offset: %#x\n", offset);
3356 hr = d3dx9_parse_name(&param->semantic, data + offset);
3357 if (hr != D3D_OK)
3359 WARN("Failed to parse semantic\n");
3360 goto err_out;
3363 read_dword(ptr, &param->element_count);
3364 TRACE("Elements: %u\n", param->element_count);
3366 switch (param->class)
3368 case D3DXPC_VECTOR:
3369 read_dword(ptr, &param->columns);
3370 TRACE("Columns: %u\n", param->columns);
3372 read_dword(ptr, &param->rows);
3373 TRACE("Rows: %u\n", param->rows);
3375 /* sizeof(DWORD) * rows * columns */
3376 param->bytes = 4 * param->rows * param->columns;
3377 break;
3379 case D3DXPC_SCALAR:
3380 case D3DXPC_MATRIX_ROWS:
3381 case D3DXPC_MATRIX_COLUMNS:
3382 read_dword(ptr, &param->rows);
3383 TRACE("Rows: %u\n", param->rows);
3385 read_dword(ptr, &param->columns);
3386 TRACE("Columns: %u\n", param->columns);
3388 /* sizeof(DWORD) * rows * columns */
3389 param->bytes = 4 * param->rows * param->columns;
3390 break;
3392 case D3DXPC_STRUCT:
3393 read_dword(ptr, &param->member_count);
3394 TRACE("Members: %u\n", param->member_count);
3395 break;
3397 case D3DXPC_OBJECT:
3398 switch (param->type)
3400 case D3DXPT_STRING:
3401 param->bytes = sizeof(LPCSTR);
3402 break;
3404 case D3DXPT_PIXELSHADER:
3405 param->bytes = sizeof(LPDIRECT3DPIXELSHADER9);
3406 break;
3408 case D3DXPT_VERTEXSHADER:
3409 param->bytes = sizeof(LPDIRECT3DVERTEXSHADER9);
3410 break;
3412 default:
3413 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3414 break;
3416 break;
3418 default:
3419 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3420 break;
3423 else
3425 /* elements */
3426 param->type = parent->type;
3427 param->class = parent->class;
3428 param->name = parent->name;
3429 param->semantic = parent->semantic;
3430 param->element_count = 0;
3431 param->annotation_count = 0;
3432 param->member_count = parent->member_count;
3433 param->bytes = parent->bytes;
3434 param->rows = parent->rows;
3435 param->columns = parent->columns;
3438 if (param->element_count)
3440 unsigned int param_bytes = 0;
3441 const char *save_ptr = *ptr;
3443 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
3444 if (!member_handles)
3446 ERR("Out of memory\n");
3447 hr = E_OUTOFMEMORY;
3448 goto err_out;
3451 for (i = 0; i < param->element_count; ++i)
3453 struct d3dx_parameter *member;
3454 *ptr = save_ptr;
3456 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3457 if (!member)
3459 ERR("Out of memory\n");
3460 hr = E_OUTOFMEMORY;
3461 goto err_out;
3464 member_handles[i] = get_parameter_handle(member);
3465 member->base = param->base;
3467 hr = d3dx9_parse_effect_typedef(member, data, ptr, param, flags);
3468 if (hr != D3D_OK)
3470 WARN("Failed to parse member\n");
3471 goto err_out;
3474 param_bytes += member->bytes;
3477 param->bytes = param_bytes;
3479 else if (param->member_count)
3481 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
3482 if (!member_handles)
3484 ERR("Out of memory\n");
3485 hr = E_OUTOFMEMORY;
3486 goto err_out;
3489 for (i = 0; i < param->member_count; ++i)
3491 struct d3dx_parameter *member;
3493 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3494 if (!member)
3496 ERR("Out of memory\n");
3497 hr = E_OUTOFMEMORY;
3498 goto err_out;
3501 member_handles[i] = get_parameter_handle(member);
3502 member->base = param->base;
3504 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL, flags);
3505 if (hr != D3D_OK)
3507 WARN("Failed to parse member\n");
3508 goto err_out;
3511 param->bytes += member->bytes;
3515 param->member_handles = member_handles;
3517 return D3D_OK;
3519 err_out:
3521 if (member_handles)
3523 unsigned int count;
3525 if (param->element_count) count = param->element_count;
3526 else count = param->member_count;
3528 for (i = 0; i < count; ++i)
3530 free_parameter(member_handles[i], param->element_count != 0, TRUE);
3532 HeapFree(GetProcessHeap(), 0, member_handles);
3535 if (!parent)
3537 HeapFree(GetProcessHeap(), 0, param->name);
3538 HeapFree(GetProcessHeap(), 0, param->semantic);
3540 param->name = NULL;
3541 param->semantic = NULL;
3543 return hr;
3546 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
3548 DWORD offset;
3549 const char *ptr2;
3550 HRESULT hr;
3552 anno->flags = D3DX_PARAMETER_ANNOTATION;
3554 read_dword(ptr, &offset);
3555 TRACE("Typedef offset: %#x\n", offset);
3556 ptr2 = data + offset;
3557 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION);
3558 if (hr != D3D_OK)
3560 WARN("Failed to parse type definition\n");
3561 return hr;
3564 read_dword(ptr, &offset);
3565 TRACE("Value offset: %#x\n", offset);
3566 hr = d3dx9_parse_init_value(anno, data + offset);
3567 if (hr != D3D_OK)
3569 WARN("Failed to parse value\n");
3570 return hr;
3573 return D3D_OK;
3576 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
3578 DWORD offset;
3579 HRESULT hr;
3580 unsigned int i;
3581 D3DXHANDLE *annotation_handles = NULL;
3582 const char *ptr2;
3584 read_dword(ptr, &offset);
3585 TRACE("Typedef offset: %#x\n", offset);
3586 ptr2 = data + offset;
3588 read_dword(ptr, &offset);
3589 TRACE("Value offset: %#x\n", offset);
3591 read_dword(ptr, &param->flags);
3592 TRACE("Flags: %#x\n", param->flags);
3594 read_dword(ptr, &param->annotation_count);
3595 TRACE("Annotation count: %u\n", param->annotation_count);
3597 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags);
3598 if (hr != D3D_OK)
3600 WARN("Failed to parse type definition\n");
3601 return hr;
3604 hr = d3dx9_parse_init_value(param, data + offset);
3605 if (hr != D3D_OK)
3607 WARN("Failed to parse value\n");
3608 return hr;
3611 if (param->annotation_count)
3613 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
3614 if (!annotation_handles)
3616 ERR("Out of memory\n");
3617 hr = E_OUTOFMEMORY;
3618 goto err_out;
3621 for (i = 0; i < param->annotation_count; ++i)
3623 struct d3dx_parameter *annotation;
3625 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3626 if (!annotation)
3628 ERR("Out of memory\n");
3629 hr = E_OUTOFMEMORY;
3630 goto err_out;
3633 annotation_handles[i] = get_parameter_handle(annotation);
3634 annotation->base = param->base;
3636 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3637 if (hr != D3D_OK)
3639 WARN("Failed to parse annotation\n");
3640 goto err_out;
3645 param->annotation_handles = annotation_handles;
3647 return D3D_OK;
3649 err_out:
3651 if (annotation_handles)
3653 for (i = 0; i < param->annotation_count; ++i)
3655 free_parameter(annotation_handles[i], FALSE, FALSE);
3657 HeapFree(GetProcessHeap(), 0, annotation_handles);
3660 return hr;
3663 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr)
3665 DWORD offset;
3666 HRESULT hr;
3667 unsigned int i;
3668 D3DXHANDLE *annotation_handles = NULL;
3669 char *name = NULL;
3671 read_dword(ptr, &offset);
3672 TRACE("Pass name offset: %#x\n", offset);
3673 hr = d3dx9_parse_name(&name, data + offset);
3674 if (hr != D3D_OK)
3676 WARN("Failed to parse name\n");
3677 goto err_out;
3680 read_dword(ptr, &pass->annotation_count);
3681 TRACE("Annotation count: %u\n", pass->annotation_count);
3683 read_dword(ptr, &pass->state_count);
3684 TRACE("State count: %u\n", pass->state_count);
3686 if (pass->annotation_count)
3688 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
3689 if (!annotation_handles)
3691 ERR("Out of memory\n");
3692 hr = E_OUTOFMEMORY;
3693 goto err_out;
3696 for (i = 0; i < pass->annotation_count; ++i)
3698 struct d3dx_parameter *annotation;
3700 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3701 if (!annotation)
3703 ERR("Out of memory\n");
3704 hr = E_OUTOFMEMORY;
3705 goto err_out;
3708 annotation_handles[i] = get_parameter_handle(annotation);
3709 annotation->base = pass->base;
3711 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3712 if (hr != D3D_OK)
3714 WARN("Failed to parse annotations\n");
3715 goto err_out;
3720 if (pass->state_count)
3722 for (i = 0; i < pass->state_count; ++i)
3724 skip_dword_unknown(ptr, 4);
3728 pass->name = name;
3729 pass->annotation_handles = annotation_handles;
3731 return D3D_OK;
3733 err_out:
3735 if (annotation_handles)
3737 for (i = 0; i < pass->annotation_count; ++i)
3739 free_parameter(annotation_handles[i], FALSE, FALSE);
3741 HeapFree(GetProcessHeap(), 0, annotation_handles);
3744 HeapFree(GetProcessHeap(), 0, name);
3746 return hr;
3749 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr)
3751 DWORD offset;
3752 HRESULT hr;
3753 unsigned int i;
3754 D3DXHANDLE *annotation_handles = NULL;
3755 D3DXHANDLE *pass_handles = NULL;
3756 char *name = NULL;
3758 read_dword(ptr, &offset);
3759 TRACE("Technique name offset: %#x\n", offset);
3760 hr = d3dx9_parse_name(&name, data + offset);
3761 if (hr != D3D_OK)
3763 WARN("Failed to parse name\n");
3764 goto err_out;
3767 read_dword(ptr, &technique->annotation_count);
3768 TRACE("Annotation count: %u\n", technique->annotation_count);
3770 read_dword(ptr, &technique->pass_count);
3771 TRACE("Pass count: %u\n", technique->pass_count);
3773 if (technique->annotation_count)
3775 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
3776 if (!annotation_handles)
3778 ERR("Out of memory\n");
3779 hr = E_OUTOFMEMORY;
3780 goto err_out;
3783 for (i = 0; i < technique->annotation_count; ++i)
3785 struct d3dx_parameter *annotation;
3787 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3788 if (!annotation)
3790 ERR("Out of memory\n");
3791 hr = E_OUTOFMEMORY;
3792 goto err_out;
3795 annotation_handles[i] = get_parameter_handle(annotation);
3796 annotation->base = technique->base;
3798 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3799 if (hr != D3D_OK)
3801 WARN("Failed to parse annotations\n");
3802 goto err_out;
3807 if (technique->pass_count)
3809 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
3810 if (!pass_handles)
3812 ERR("Out of memory\n");
3813 hr = E_OUTOFMEMORY;
3814 goto err_out;
3817 for (i = 0; i < technique->pass_count; ++i)
3819 struct d3dx_pass *pass;
3821 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
3822 if (!pass)
3824 ERR("Out of memory\n");
3825 hr = E_OUTOFMEMORY;
3826 goto err_out;
3829 pass_handles[i] = get_pass_handle(pass);
3830 pass->base = technique->base;
3832 hr = d3dx9_parse_effect_pass(pass, data, ptr);
3833 if (hr != D3D_OK)
3835 WARN("Failed to parse passes\n");
3836 goto err_out;
3841 technique->name = name;
3842 technique->pass_handles = pass_handles;
3843 technique->annotation_handles = annotation_handles;
3845 return D3D_OK;
3847 err_out:
3849 if (pass_handles)
3851 for (i = 0; i < technique->pass_count; ++i)
3853 free_pass(pass_handles[i]);
3855 HeapFree(GetProcessHeap(), 0, pass_handles);
3858 if (annotation_handles)
3860 for (i = 0; i < technique->annotation_count; ++i)
3862 free_parameter(annotation_handles[i], FALSE, FALSE);
3864 HeapFree(GetProcessHeap(), 0, annotation_handles);
3867 HeapFree(GetProcessHeap(), 0, name);
3869 return hr;
3872 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
3874 const char *ptr = data + start;
3875 D3DXHANDLE *parameter_handles = NULL;
3876 D3DXHANDLE *technique_handles = NULL;
3877 D3DXHANDLE *objects = NULL;
3878 unsigned int stringcount;
3879 HRESULT hr;
3880 unsigned int i;
3882 read_dword(&ptr, &base->parameter_count);
3883 TRACE("Parameter count: %u\n", base->parameter_count);
3885 read_dword(&ptr, &base->technique_count);
3886 TRACE("Technique count: %u\n", base->technique_count);
3888 skip_dword_unknown(&ptr, 1);
3890 read_dword(&ptr, &base->object_count);
3891 TRACE("Object count: %u\n", base->object_count);
3893 objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * base->object_count);
3894 if (!objects)
3896 ERR("Out of memory\n");
3897 hr = E_OUTOFMEMORY;
3898 goto err_out;
3901 base->objects = objects;
3903 if (base->parameter_count)
3905 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
3906 if (!parameter_handles)
3908 ERR("Out of memory\n");
3909 hr = E_OUTOFMEMORY;
3910 goto err_out;
3913 for (i = 0; i < base->parameter_count; ++i)
3915 struct d3dx_parameter *parameter;
3917 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
3918 if (!parameter)
3920 ERR("Out of memory\n");
3921 hr = E_OUTOFMEMORY;
3922 goto err_out;
3925 parameter_handles[i] = get_parameter_handle(parameter);
3926 parameter->base = base;
3928 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
3929 if (hr != D3D_OK)
3931 WARN("Failed to parse parameter\n");
3932 goto err_out;
3937 if (base->technique_count)
3939 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
3940 if (!technique_handles)
3942 ERR("Out of memory\n");
3943 hr = E_OUTOFMEMORY;
3944 goto err_out;
3947 for (i = 0; i < base->technique_count; ++i)
3949 struct d3dx_technique *technique;
3951 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
3952 if (!technique)
3954 ERR("Out of memory\n");
3955 hr = E_OUTOFMEMORY;
3956 goto err_out;
3959 technique_handles[i] = get_technique_handle(technique);
3960 technique->base = base;
3962 hr = d3dx9_parse_effect_technique(technique, data, &ptr);
3963 if (hr != D3D_OK)
3965 WARN("Failed to parse technique\n");
3966 goto err_out;
3971 read_dword(&ptr, &stringcount);
3972 TRACE("String count: %u\n", stringcount);
3974 skip_dword_unknown(&ptr, 1);
3976 for (i = 0; i < stringcount; ++i)
3978 DWORD id;
3979 struct d3dx_parameter *param;
3981 read_dword(&ptr, &id);
3982 TRACE("Id: %u\n", id);
3984 param = get_parameter_struct(base->objects[id]);
3986 hr = d3dx9_parse_data(param, &ptr);
3987 if (hr != D3D_OK)
3989 WARN("Failed to parse data\n");
3990 goto err_out;
3994 HeapFree(GetProcessHeap(), 0, objects);
3995 base->objects = NULL;
3997 base->technique_handles = technique_handles;
3998 base->parameter_handles = parameter_handles;
4000 return D3D_OK;
4002 err_out:
4004 if (technique_handles)
4006 for (i = 0; i < base->technique_count; ++i)
4008 free_technique(technique_handles[i]);
4010 HeapFree(GetProcessHeap(), 0, technique_handles);
4013 if (parameter_handles)
4015 for (i = 0; i < base->parameter_count; ++i)
4017 free_parameter(parameter_handles[i], FALSE, FALSE);
4019 HeapFree(GetProcessHeap(), 0, parameter_handles);
4022 HeapFree(GetProcessHeap(), 0, objects);
4024 return hr;
4027 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
4028 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
4030 DWORD tag, offset;
4031 const char *ptr = data;
4032 HRESULT hr;
4034 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
4036 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
4037 base->ref = 1;
4038 base->effect = effect;
4040 read_dword(&ptr, &tag);
4041 TRACE("Tag: %x\n", tag);
4043 if (tag != d3dx9_effect_version(9, 1))
4045 /* todo: compile hlsl ascii code */
4046 FIXME("HLSL ascii effects not supported, yet\n");
4048 /* Show the start of the shader for debugging info. */
4049 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
4051 else
4053 read_dword(&ptr, &offset);
4054 TRACE("Offset: %x\n", offset);
4056 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
4057 if (hr != D3D_OK)
4059 FIXME("Failed to parse effect.\n");
4060 return hr;
4064 return D3D_OK;
4067 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
4068 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
4070 HRESULT hr;
4071 struct ID3DXBaseEffectImpl *object = NULL;
4073 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
4075 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
4076 effect->ref = 1;
4078 if (pool) pool->lpVtbl->AddRef(pool);
4079 effect->pool = pool;
4081 IDirect3DDevice9_AddRef(device);
4082 effect->device = device;
4084 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4085 if (!object)
4087 ERR("Out of memory\n");
4088 hr = E_OUTOFMEMORY;
4089 goto err_out;
4092 hr = d3dx9_base_effect_init(object, data, data_size, effect);
4093 if (hr != D3D_OK)
4095 FIXME("Failed to parse effect.\n");
4096 goto err_out;
4099 effect->base_effect = &object->ID3DXBaseEffect_iface;
4101 return D3D_OK;
4103 err_out:
4105 HeapFree(GetProcessHeap(), 0, object);
4106 free_effect(effect);
4108 return hr;
4111 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
4112 LPCVOID srcdata,
4113 UINT srcdatalen,
4114 CONST D3DXMACRO* defines,
4115 LPD3DXINCLUDE include,
4116 LPCSTR skip_constants,
4117 DWORD flags,
4118 LPD3DXEFFECTPOOL pool,
4119 LPD3DXEFFECT* effect,
4120 LPD3DXBUFFER* compilation_errors)
4122 struct ID3DXEffectImpl *object;
4123 HRESULT hr;
4125 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
4126 skip_constants, flags, pool, effect, compilation_errors);
4128 if (!device || !srcdata)
4129 return D3DERR_INVALIDCALL;
4131 if (!srcdatalen)
4132 return E_FAIL;
4134 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
4135 if (!effect)
4136 return D3D_OK;
4138 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4139 if (!object)
4141 ERR("Out of memory\n");
4142 return E_OUTOFMEMORY;
4145 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
4146 if (FAILED(hr))
4148 WARN("Failed to initialize shader reflection\n");
4149 HeapFree(GetProcessHeap(), 0, object);
4150 return hr;
4153 *effect = &object->ID3DXEffect_iface;
4155 TRACE("Created ID3DXEffect %p\n", object);
4157 return D3D_OK;
4160 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
4161 LPCVOID srcdata,
4162 UINT srcdatalen,
4163 CONST D3DXMACRO* defines,
4164 LPD3DXINCLUDE include,
4165 DWORD flags,
4166 LPD3DXEFFECTPOOL pool,
4167 LPD3DXEFFECT* effect,
4168 LPD3DXBUFFER* compilation_errors)
4170 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
4171 include, flags, pool, effect, compilation_errors);
4173 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
4176 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
4178 HRESULT hr;
4179 struct ID3DXBaseEffectImpl *object = NULL;
4181 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
4183 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
4184 compiler->ref = 1;
4186 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4187 if (!object)
4189 ERR("Out of memory\n");
4190 hr = E_OUTOFMEMORY;
4191 goto err_out;
4194 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
4195 if (hr != D3D_OK)
4197 FIXME("Failed to parse effect.\n");
4198 goto err_out;
4201 compiler->base_effect = &object->ID3DXBaseEffect_iface;
4203 return D3D_OK;
4205 err_out:
4207 HeapFree(GetProcessHeap(), 0, object);
4208 free_effect_compiler(compiler);
4210 return hr;
4213 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
4214 UINT srcdatalen,
4215 CONST D3DXMACRO *defines,
4216 LPD3DXINCLUDE include,
4217 DWORD flags,
4218 LPD3DXEFFECTCOMPILER *compiler,
4219 LPD3DXBUFFER *parse_errors)
4221 struct ID3DXEffectCompilerImpl *object;
4222 HRESULT hr;
4224 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
4225 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
4227 if (!srcdata || !compiler)
4229 WARN("Invalid arguments supplied\n");
4230 return D3DERR_INVALIDCALL;
4233 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4234 if (!object)
4236 ERR("Out of memory\n");
4237 return E_OUTOFMEMORY;
4240 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
4241 if (FAILED(hr))
4243 WARN("Failed to initialize effect compiler\n");
4244 HeapFree(GetProcessHeap(), 0, object);
4245 return hr;
4248 *compiler = &object->ID3DXEffectCompiler_iface;
4250 TRACE("Created ID3DXEffectCompiler %p\n", object);
4252 return D3D_OK;
4255 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
4257 struct ID3DXEffectPoolImpl
4259 ID3DXEffectPool ID3DXEffectPool_iface;
4260 LONG ref;
4263 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
4265 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
4268 /*** IUnknown methods ***/
4269 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
4271 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4273 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
4275 if (IsEqualGUID(riid, &IID_IUnknown) ||
4276 IsEqualGUID(riid, &IID_ID3DXEffectPool))
4278 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
4279 *object = This;
4280 return S_OK;
4283 WARN("Interface %s not found\n", debugstr_guid(riid));
4285 return E_NOINTERFACE;
4288 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
4290 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4292 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
4294 return InterlockedIncrement(&This->ref);
4297 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
4299 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4300 ULONG ref = InterlockedDecrement(&This->ref);
4302 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
4304 if (!ref)
4305 HeapFree(GetProcessHeap(), 0, This);
4307 return ref;
4310 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
4312 /*** IUnknown methods ***/
4313 ID3DXEffectPoolImpl_QueryInterface,
4314 ID3DXEffectPoolImpl_AddRef,
4315 ID3DXEffectPoolImpl_Release
4318 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
4320 struct ID3DXEffectPoolImpl *object;
4322 TRACE("(%p)\n", pool);
4324 if (!pool)
4325 return D3DERR_INVALIDCALL;
4327 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4328 if (!object)
4330 ERR("Out of memory\n");
4331 return E_OUTOFMEMORY;
4334 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
4335 object->ref = 1;
4337 *pool = &object->ID3DXEffectPool_iface;
4339 return S_OK;
4342 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4343 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4344 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4346 LPVOID buffer;
4347 HRESULT ret;
4348 DWORD size;
4350 TRACE("(%s): relay\n", debugstr_w(srcfile));
4352 if (!device || !srcfile || !defines)
4353 return D3DERR_INVALIDCALL;
4355 ret = map_view_of_file(srcfile, &buffer, &size);
4357 if (FAILED(ret))
4358 return D3DXERR_INVALIDDATA;
4360 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4361 UnmapViewOfFile(buffer);
4363 return ret;
4366 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4367 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4368 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4370 LPWSTR srcfileW;
4371 HRESULT ret;
4372 DWORD len;
4374 TRACE("(void): relay\n");
4376 if (!srcfile || !defines)
4377 return D3DERR_INVALIDCALL;
4379 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4380 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4381 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4383 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4384 HeapFree(GetProcessHeap(), 0, srcfileW);
4386 return ret;
4389 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4390 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4391 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4393 TRACE("(void): relay\n");
4394 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4397 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4398 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4399 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4401 TRACE("(void): relay\n");
4402 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4405 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4406 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4407 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4409 HRSRC resinfo;
4411 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4413 if (!device || !defines)
4414 return D3DERR_INVALIDCALL;
4416 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4418 if (resinfo)
4420 LPVOID buffer;
4421 HRESULT ret;
4422 DWORD size;
4424 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4426 if (FAILED(ret))
4427 return D3DXERR_INVALIDDATA;
4429 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4432 return D3DXERR_INVALIDDATA;
4435 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4436 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4437 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4439 HRSRC resinfo;
4441 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4443 if (!device || !defines)
4444 return D3DERR_INVALIDCALL;
4446 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4448 if (resinfo)
4450 LPVOID buffer;
4451 HRESULT ret;
4452 DWORD size;
4454 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4456 if (FAILED(ret))
4457 return D3DXERR_INVALIDDATA;
4459 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4462 return D3DXERR_INVALIDDATA;
4465 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4466 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4467 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4469 TRACE("(void): relay\n");
4470 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4473 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4474 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4475 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4477 TRACE("(void): relay\n");
4478 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4481 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4482 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4484 LPVOID buffer;
4485 HRESULT ret;
4486 DWORD size;
4488 TRACE("(%s): relay\n", debugstr_w(srcfile));
4490 if (!srcfile || !defines)
4491 return D3DERR_INVALIDCALL;
4493 ret = map_view_of_file(srcfile, &buffer, &size);
4495 if (FAILED(ret))
4496 return D3DXERR_INVALIDDATA;
4498 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4499 UnmapViewOfFile(buffer);
4501 return ret;
4504 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4505 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4507 LPWSTR srcfileW;
4508 HRESULT ret;
4509 DWORD len;
4511 TRACE("(void): relay\n");
4513 if (!srcfile || !defines)
4514 return D3DERR_INVALIDCALL;
4516 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4517 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4518 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4520 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
4521 HeapFree(GetProcessHeap(), 0, srcfileW);
4523 return ret;
4526 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
4527 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4529 HRSRC resinfo;
4531 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4533 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4535 if (resinfo)
4537 LPVOID buffer;
4538 HRESULT ret;
4539 DWORD size;
4541 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4543 if (FAILED(ret))
4544 return D3DXERR_INVALIDDATA;
4546 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4549 return D3DXERR_INVALIDDATA;
4552 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
4553 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4555 HRSRC resinfo;
4557 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4559 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4561 if (resinfo)
4563 LPVOID buffer;
4564 HRESULT ret;
4565 DWORD size;
4567 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4569 if (FAILED(ret))
4570 return D3DXERR_INVALIDDATA;
4572 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4575 return D3DXERR_INVALIDDATA;