d3dx9: Implement ID3DXBaseEffect::GetParameterBySemantic().
[wine.git] / dlls / d3dx9_36 / effect.c
blob27f22b2cd43e2139372b1c0062d96b2080879e0d
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);
1021 FIXME("iface %p, object %p, index %u stub\n", This, object, index);
1023 return NULL;
1026 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
1028 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1030 FIXME("iface %p, object %p, name %s stub\n", This, object, debugstr_a(name));
1032 return NULL;
1035 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1037 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1039 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
1041 return E_NOTIMPL;
1044 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1046 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1047 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1049 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1051 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1053 if (data && param && param->data && param->bytes <= bytes)
1055 if (param->type == D3DXPT_VERTEXSHADER || param->type == D3DXPT_PIXELSHADER)
1057 UINT i;
1059 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
1061 IUnknown *unk = ((IUnknown **)param->data)[i];
1062 if (unk) IUnknown_AddRef(unk);
1063 ((IUnknown **)data)[i] = unk;
1066 else
1068 TRACE("Copy %u bytes\n", param->bytes);
1069 memcpy(data, param->data, param->bytes);
1071 return D3D_OK;
1074 WARN("Invalid argument specified\n");
1076 return D3DERR_INVALIDCALL;
1079 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
1081 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1083 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
1085 return E_NOTIMPL;
1088 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
1090 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1092 FIXME("iface %p, parameter %p, b %p stub\n", This, parameter, b);
1094 return E_NOTIMPL;
1097 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1099 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1101 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1103 return E_NOTIMPL;
1106 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1108 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1110 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1112 return E_NOTIMPL;
1115 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
1117 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1119 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
1121 return E_NOTIMPL;
1124 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1126 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1128 FIXME("iface %p, parameter %p, n %p stub\n", This, parameter, n);
1130 return E_NOTIMPL;
1133 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1135 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1137 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1139 return E_NOTIMPL;
1142 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1144 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1146 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1148 return E_NOTIMPL;
1151 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1153 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1155 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
1157 return E_NOTIMPL;
1160 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1162 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1164 FIXME("iface %p, parameter %p, f %p stub\n", This, parameter, f);
1166 return E_NOTIMPL;
1169 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1171 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1173 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1175 return E_NOTIMPL;
1178 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1180 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1182 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1184 return E_NOTIMPL;
1187 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
1189 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1191 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1193 return E_NOTIMPL;
1196 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1198 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1200 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1202 return E_NOTIMPL;
1205 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1207 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1209 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1211 return E_NOTIMPL;
1214 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1216 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1218 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1220 return E_NOTIMPL;
1223 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1225 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1227 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1229 return E_NOTIMPL;
1232 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1234 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1236 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1238 return E_NOTIMPL;
1241 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1243 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1245 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1247 return E_NOTIMPL;
1250 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1252 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1254 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1256 return E_NOTIMPL;
1259 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1261 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1263 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1265 return E_NOTIMPL;
1268 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1270 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1272 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1274 return E_NOTIMPL;
1277 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1279 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1281 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1283 return E_NOTIMPL;
1286 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1288 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1290 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1292 return E_NOTIMPL;
1295 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1297 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1299 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1301 return E_NOTIMPL;
1304 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1306 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1308 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1310 return E_NOTIMPL;
1313 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1315 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1317 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1319 return E_NOTIMPL;
1322 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1324 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1326 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1328 return E_NOTIMPL;
1331 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1333 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1335 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1337 return E_NOTIMPL;
1340 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1342 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1343 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1345 TRACE("iface %p, parameter %p, string %p\n", This, parameter, string);
1347 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1349 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
1351 *string = *(LPCSTR *)param->data;
1352 TRACE("Returning %s\n", debugstr_a(*string));
1353 return D3D_OK;
1356 WARN("Invalid argument specified\n");
1358 return D3DERR_INVALIDCALL;
1361 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1363 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1365 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1367 return E_NOTIMPL;
1370 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1372 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1374 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1376 return E_NOTIMPL;
1379 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
1381 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1382 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1384 TRACE("iface %p, parameter %p, pshader %p\n", This, parameter, pshader);
1386 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1388 if (pshader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
1390 *pshader = *(LPDIRECT3DPIXELSHADER9 *)param->data;
1391 if (*pshader) IDirect3DPixelShader9_AddRef(*pshader);
1392 TRACE("Returning %p\n", *pshader);
1393 return D3D_OK;
1396 WARN("Invalid argument specified\n");
1398 return D3DERR_INVALIDCALL;
1401 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
1403 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1404 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1406 TRACE("iface %p, parameter %p, vshader %p\n", This, parameter, vshader);
1408 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1410 if (vshader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
1412 *vshader = *(LPDIRECT3DVERTEXSHADER9 *)param->data;
1413 if (*vshader) IDirect3DVertexShader9_AddRef(*vshader);
1414 TRACE("Returning %p\n", *vshader);
1415 return D3D_OK;
1418 WARN("Invalid argument specified\n");
1420 return D3DERR_INVALIDCALL;
1423 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
1425 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1427 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
1429 return E_NOTIMPL;
1432 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
1434 /*** IUnknown methods ***/
1435 ID3DXBaseEffectImpl_QueryInterface,
1436 ID3DXBaseEffectImpl_AddRef,
1437 ID3DXBaseEffectImpl_Release,
1438 /*** ID3DXBaseEffect methods ***/
1439 ID3DXBaseEffectImpl_GetDesc,
1440 ID3DXBaseEffectImpl_GetParameterDesc,
1441 ID3DXBaseEffectImpl_GetTechniqueDesc,
1442 ID3DXBaseEffectImpl_GetPassDesc,
1443 ID3DXBaseEffectImpl_GetFunctionDesc,
1444 ID3DXBaseEffectImpl_GetParameter,
1445 ID3DXBaseEffectImpl_GetParameterByName,
1446 ID3DXBaseEffectImpl_GetParameterBySemantic,
1447 ID3DXBaseEffectImpl_GetParameterElement,
1448 ID3DXBaseEffectImpl_GetTechnique,
1449 ID3DXBaseEffectImpl_GetTechniqueByName,
1450 ID3DXBaseEffectImpl_GetPass,
1451 ID3DXBaseEffectImpl_GetPassByName,
1452 ID3DXBaseEffectImpl_GetFunction,
1453 ID3DXBaseEffectImpl_GetFunctionByName,
1454 ID3DXBaseEffectImpl_GetAnnotation,
1455 ID3DXBaseEffectImpl_GetAnnotationByName,
1456 ID3DXBaseEffectImpl_SetValue,
1457 ID3DXBaseEffectImpl_GetValue,
1458 ID3DXBaseEffectImpl_SetBool,
1459 ID3DXBaseEffectImpl_GetBool,
1460 ID3DXBaseEffectImpl_SetBoolArray,
1461 ID3DXBaseEffectImpl_GetBoolArray,
1462 ID3DXBaseEffectImpl_SetInt,
1463 ID3DXBaseEffectImpl_GetInt,
1464 ID3DXBaseEffectImpl_SetIntArray,
1465 ID3DXBaseEffectImpl_GetIntArray,
1466 ID3DXBaseEffectImpl_SetFloat,
1467 ID3DXBaseEffectImpl_GetFloat,
1468 ID3DXBaseEffectImpl_SetFloatArray,
1469 ID3DXBaseEffectImpl_GetFloatArray,
1470 ID3DXBaseEffectImpl_SetVector,
1471 ID3DXBaseEffectImpl_GetVector,
1472 ID3DXBaseEffectImpl_SetVectorArray,
1473 ID3DXBaseEffectImpl_GetVectorArray,
1474 ID3DXBaseEffectImpl_SetMatrix,
1475 ID3DXBaseEffectImpl_GetMatrix,
1476 ID3DXBaseEffectImpl_SetMatrixArray,
1477 ID3DXBaseEffectImpl_GetMatrixArray,
1478 ID3DXBaseEffectImpl_SetMatrixPointerArray,
1479 ID3DXBaseEffectImpl_GetMatrixPointerArray,
1480 ID3DXBaseEffectImpl_SetMatrixTranspose,
1481 ID3DXBaseEffectImpl_GetMatrixTranspose,
1482 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
1483 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
1484 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
1485 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
1486 ID3DXBaseEffectImpl_SetString,
1487 ID3DXBaseEffectImpl_GetString,
1488 ID3DXBaseEffectImpl_SetTexture,
1489 ID3DXBaseEffectImpl_GetTexture,
1490 ID3DXBaseEffectImpl_GetPixelShader,
1491 ID3DXBaseEffectImpl_GetVertexShader,
1492 ID3DXBaseEffectImpl_SetArrayRange,
1495 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
1497 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
1500 /*** IUnknown methods ***/
1501 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
1503 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1505 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
1507 if (IsEqualGUID(riid, &IID_IUnknown) ||
1508 IsEqualGUID(riid, &IID_ID3DXEffect))
1510 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
1511 *object = This;
1512 return S_OK;
1515 ERR("Interface %s not found\n", debugstr_guid(riid));
1517 return E_NOINTERFACE;
1520 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
1522 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1524 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
1526 return InterlockedIncrement(&This->ref);
1529 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
1531 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1532 ULONG ref = InterlockedDecrement(&This->ref);
1534 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
1536 if (!ref)
1538 free_effect(This);
1539 HeapFree(GetProcessHeap(), 0, This);
1542 return ref;
1545 /*** ID3DXBaseEffect methods ***/
1546 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
1548 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1549 ID3DXBaseEffect *base = This->base_effect;
1551 TRACE("Forward iface %p, base %p\n", This, base);
1553 return ID3DXBaseEffectImpl_GetDesc(base, desc);
1556 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1558 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1559 ID3DXBaseEffect *base = This->base_effect;
1561 TRACE("Forward iface %p, base %p\n", This, base);
1563 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
1566 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1568 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1569 ID3DXBaseEffect *base = This->base_effect;
1571 TRACE("Forward iface %p, base %p\n", This, base);
1573 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
1576 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1578 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1579 ID3DXBaseEffect *base = This->base_effect;
1581 TRACE("Forward iface %p, base %p\n", This, base);
1583 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
1586 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1588 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1589 ID3DXBaseEffect *base = This->base_effect;
1591 TRACE("Forward iface %p, base %p\n", This, base);
1593 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
1596 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1598 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1599 ID3DXBaseEffect *base = This->base_effect;
1601 TRACE("Forward iface %p, base %p\n", This, base);
1603 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
1606 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1608 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1609 ID3DXBaseEffect *base = This->base_effect;
1611 TRACE("Forward iface %p, base %p\n", This, base);
1613 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
1616 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1618 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1619 ID3DXBaseEffect *base = This->base_effect;
1621 TRACE("Forward iface %p, base %p\n", This, base);
1623 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
1626 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
1628 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1629 ID3DXBaseEffect *base = This->base_effect;
1631 TRACE("Forward iface %p, base %p\n", This, base);
1633 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
1636 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
1638 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1639 ID3DXBaseEffect *base = This->base_effect;
1641 TRACE("Forward iface %p, base %p\n", This, base);
1643 return ID3DXBaseEffectImpl_GetTechnique(base, index);
1646 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
1648 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1649 ID3DXBaseEffect *base = This->base_effect;
1651 TRACE("Forward iface %p, base %p\n", This, base);
1653 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
1656 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
1658 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1659 ID3DXBaseEffect *base = This->base_effect;
1661 TRACE("Forward iface %p, base %p\n", This, base);
1663 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
1666 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
1668 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1669 ID3DXBaseEffect *base = This->base_effect;
1671 TRACE("Forward iface %p, base %p\n", This, base);
1673 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
1676 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
1678 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1679 ID3DXBaseEffect *base = This->base_effect;
1681 TRACE("Forward iface %p, base %p\n", This, base);
1683 return ID3DXBaseEffectImpl_GetFunction(base, index);
1686 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
1688 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1689 ID3DXBaseEffect *base = This->base_effect;
1691 TRACE("Forward iface %p, base %p\n", This, base);
1693 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
1696 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
1698 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1699 ID3DXBaseEffect *base = This->base_effect;
1701 TRACE("Forward iface %p, base %p\n", This, base);
1703 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
1706 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
1708 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1709 ID3DXBaseEffect *base = This->base_effect;
1711 TRACE("Forward iface %p, base %p\n", This, base);
1713 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
1716 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1718 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1719 ID3DXBaseEffect *base = This->base_effect;
1721 TRACE("Forward iface %p, base %p\n", This, base);
1723 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
1726 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1728 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1729 ID3DXBaseEffect *base = This->base_effect;
1731 TRACE("Forward iface %p, base %p\n", This, base);
1733 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
1736 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
1738 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1739 ID3DXBaseEffect *base = This->base_effect;
1741 TRACE("Forward iface %p, base %p\n", This, base);
1743 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
1746 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
1748 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1749 ID3DXBaseEffect *base = This->base_effect;
1751 TRACE("Forward iface %p, base %p\n", This, base);
1753 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
1756 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1758 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1759 ID3DXBaseEffect *base = This->base_effect;
1761 TRACE("Forward iface %p, base %p\n", This, base);
1763 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
1766 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1768 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1769 ID3DXBaseEffect *base = This->base_effect;
1771 TRACE("Forward iface %p, base %p\n", This, base);
1773 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
1776 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
1778 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1779 ID3DXBaseEffect *base = This->base_effect;
1781 TRACE("Forward iface %p, base %p\n", This, base);
1783 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
1786 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
1788 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1789 ID3DXBaseEffect *base = This->base_effect;
1791 TRACE("Forward iface %p, base %p\n", This, base);
1793 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
1796 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1798 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1799 ID3DXBaseEffect *base = This->base_effect;
1801 TRACE("Forward iface %p, base %p\n", This, base);
1803 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
1806 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1808 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1809 ID3DXBaseEffect *base = This->base_effect;
1811 TRACE("Forward iface %p, base %p\n", This, base);
1813 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
1816 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
1818 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1819 ID3DXBaseEffect *base = This->base_effect;
1821 TRACE("Forward iface %p, base %p\n", This, base);
1823 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
1826 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1828 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1829 ID3DXBaseEffect *base = This->base_effect;
1831 TRACE("Forward iface %p, base %p\n", This, base);
1833 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
1836 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1838 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1839 ID3DXBaseEffect *base = This->base_effect;
1841 TRACE("Forward iface %p, base %p\n", This, base);
1843 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
1846 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1848 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1849 ID3DXBaseEffect *base = This->base_effect;
1851 TRACE("Forward iface %p, base %p\n", This, base);
1853 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
1856 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
1858 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1859 ID3DXBaseEffect *base = This->base_effect;
1861 TRACE("Forward iface %p, base %p\n", This, base);
1863 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
1866 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1868 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1869 ID3DXBaseEffect *base = This->base_effect;
1871 TRACE("Forward iface %p, base %p\n", This, base);
1873 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
1876 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1878 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1879 ID3DXBaseEffect *base = This->base_effect;
1881 TRACE("Forward iface %p, base %p\n", This, base);
1883 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
1886 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1888 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1889 ID3DXBaseEffect *base = This->base_effect;
1891 TRACE("Forward iface %p, base %p\n", This, base);
1893 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
1896 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1898 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1899 ID3DXBaseEffect *base = This->base_effect;
1901 TRACE("Forward iface %p, base %p\n", This, base);
1903 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
1906 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1908 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1909 ID3DXBaseEffect *base = This->base_effect;
1911 TRACE("Forward iface %p, base %p\n", This, base);
1913 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
1916 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1918 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1919 ID3DXBaseEffect *base = This->base_effect;
1921 TRACE("Forward iface %p, base %p\n", This, base);
1923 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
1926 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1928 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1929 ID3DXBaseEffect *base = This->base_effect;
1931 TRACE("Forward iface %p, base %p\n", This, base);
1933 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
1936 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1938 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1939 ID3DXBaseEffect *base = This->base_effect;
1941 TRACE("Forward iface %p, base %p\n", This, base);
1943 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
1946 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1948 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1949 ID3DXBaseEffect *base = This->base_effect;
1951 TRACE("Forward iface %p, base %p\n", This, base);
1953 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
1956 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1958 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1959 ID3DXBaseEffect *base = This->base_effect;
1961 TRACE("Forward iface %p, base %p\n", This, base);
1963 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
1966 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1968 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1969 ID3DXBaseEffect *base = This->base_effect;
1971 TRACE("Forward iface %p, base %p\n", This, base);
1973 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
1976 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1978 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1979 ID3DXBaseEffect *base = This->base_effect;
1981 TRACE("Forward iface %p, base %p\n", This, base);
1983 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
1986 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1988 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1989 ID3DXBaseEffect *base = This->base_effect;
1991 TRACE("Forward iface %p, base %p\n", This, base);
1993 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
1996 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1998 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
1999 ID3DXBaseEffect *base = This->base_effect;
2001 TRACE("Forward iface %p, base %p\n", This, base);
2003 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2006 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2008 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2009 ID3DXBaseEffect *base = This->base_effect;
2011 TRACE("Forward iface %p, base %p\n", This, base);
2013 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2016 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
2018 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2019 ID3DXBaseEffect *base = This->base_effect;
2021 TRACE("Forward iface %p, base %p\n", This, base);
2023 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2026 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
2028 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2029 ID3DXBaseEffect *base = This->base_effect;
2031 TRACE("Forward iface %p, base %p\n", This, base);
2033 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2036 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2038 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2039 ID3DXBaseEffect *base = This->base_effect;
2041 TRACE("Forward iface %p, base %p\n", This, base);
2043 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2046 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2048 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2049 ID3DXBaseEffect *base = This->base_effect;
2051 TRACE("Forward iface %p, base %p\n", This, base);
2053 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2056 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2058 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2059 ID3DXBaseEffect *base = This->base_effect;
2061 TRACE("Forward iface %p, base %p\n", This, base);
2063 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2066 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2068 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2069 ID3DXBaseEffect *base = This->base_effect;
2071 TRACE("Forward iface %p, base %p\n", This, base);
2073 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2076 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2078 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2079 ID3DXBaseEffect *base = This->base_effect;
2081 TRACE("Forward iface %p, base %p\n", This, base);
2083 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2086 /*** ID3DXEffect methods ***/
2087 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
2089 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2091 TRACE("iface %p, pool %p\n", This, pool);
2093 if (!pool)
2095 WARN("Invalid argument supplied.\n");
2096 return D3DERR_INVALIDCALL;
2099 if (This->pool)
2101 This->pool->lpVtbl->AddRef(This->pool);
2104 *pool = This->pool;
2106 TRACE("Returning pool %p\n", *pool);
2108 return S_OK;
2111 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2113 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2115 FIXME("(%p)->(%p): stub\n", This, technique);
2117 return E_NOTIMPL;
2120 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect* iface)
2122 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2124 FIXME("(%p)->(): stub\n", This);
2126 return NULL;
2129 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2131 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2133 FIXME("(%p)->(%p): stub\n", This, technique);
2135 return D3D_OK;
2138 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
2140 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2142 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
2144 return E_NOTIMPL;
2147 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
2149 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2151 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
2153 return FALSE;
2156 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags)
2158 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2160 FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags);
2162 return E_NOTIMPL;
2165 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass)
2167 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2169 FIXME("(%p)->(%u): stub\n", This, pass);
2171 return E_NOTIMPL;
2174 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
2176 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2178 FIXME("(%p)->(): stub\n", This);
2180 return E_NOTIMPL;
2183 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect* iface)
2185 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2187 FIXME("(%p)->(): stub\n", This);
2189 return E_NOTIMPL;
2192 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
2194 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2196 FIXME("(%p)->(): stub\n", This);
2198 return E_NOTIMPL;
2201 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
2203 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2205 TRACE("iface %p, device %p\n", This, device);
2207 if (!device)
2209 WARN("Invalid argument supplied.\n");
2210 return D3DERR_INVALIDCALL;
2213 IDirect3DDevice9_AddRef(This->device);
2215 *device = This->device;
2217 TRACE("Returning device %p\n", *device);
2219 return S_OK;
2222 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
2224 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2226 FIXME("(%p)->(): stub\n", This);
2228 return E_NOTIMPL;
2231 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
2233 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2235 FIXME("(%p)->(): stub\n", This);
2237 return E_NOTIMPL;
2240 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER manager)
2242 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2244 FIXME("(%p)->(%p): stub\n", This, manager);
2246 return E_NOTIMPL;
2249 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect* iface, LPD3DXEFFECTSTATEMANAGER* manager)
2251 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2253 FIXME("(%p)->(%p): stub\n", This, manager);
2255 return E_NOTIMPL;
2258 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
2260 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2262 FIXME("(%p)->(): stub\n", This);
2264 return E_NOTIMPL;
2267 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
2269 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2271 FIXME("(%p)->(): stub\n", This);
2273 return NULL;
2276 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2278 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2280 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2282 return E_NOTIMPL;
2285 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2287 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2289 FIXME("(%p)->(%p): stub\n", This, parameter_block);
2291 return E_NOTIMPL;
2294 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
2296 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2298 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
2300 return E_NOTIMPL;
2303 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
2305 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2307 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
2309 return E_NOTIMPL;
2312 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
2314 /*** IUnknown methods ***/
2315 ID3DXEffectImpl_QueryInterface,
2316 ID3DXEffectImpl_AddRef,
2317 ID3DXEffectImpl_Release,
2318 /*** ID3DXBaseEffect methods ***/
2319 ID3DXEffectImpl_GetDesc,
2320 ID3DXEffectImpl_GetParameterDesc,
2321 ID3DXEffectImpl_GetTechniqueDesc,
2322 ID3DXEffectImpl_GetPassDesc,
2323 ID3DXEffectImpl_GetFunctionDesc,
2324 ID3DXEffectImpl_GetParameter,
2325 ID3DXEffectImpl_GetParameterByName,
2326 ID3DXEffectImpl_GetParameterBySemantic,
2327 ID3DXEffectImpl_GetParameterElement,
2328 ID3DXEffectImpl_GetTechnique,
2329 ID3DXEffectImpl_GetTechniqueByName,
2330 ID3DXEffectImpl_GetPass,
2331 ID3DXEffectImpl_GetPassByName,
2332 ID3DXEffectImpl_GetFunction,
2333 ID3DXEffectImpl_GetFunctionByName,
2334 ID3DXEffectImpl_GetAnnotation,
2335 ID3DXEffectImpl_GetAnnotationByName,
2336 ID3DXEffectImpl_SetValue,
2337 ID3DXEffectImpl_GetValue,
2338 ID3DXEffectImpl_SetBool,
2339 ID3DXEffectImpl_GetBool,
2340 ID3DXEffectImpl_SetBoolArray,
2341 ID3DXEffectImpl_GetBoolArray,
2342 ID3DXEffectImpl_SetInt,
2343 ID3DXEffectImpl_GetInt,
2344 ID3DXEffectImpl_SetIntArray,
2345 ID3DXEffectImpl_GetIntArray,
2346 ID3DXEffectImpl_SetFloat,
2347 ID3DXEffectImpl_GetFloat,
2348 ID3DXEffectImpl_SetFloatArray,
2349 ID3DXEffectImpl_GetFloatArray,
2350 ID3DXEffectImpl_SetVector,
2351 ID3DXEffectImpl_GetVector,
2352 ID3DXEffectImpl_SetVectorArray,
2353 ID3DXEffectImpl_GetVectorArray,
2354 ID3DXEffectImpl_SetMatrix,
2355 ID3DXEffectImpl_GetMatrix,
2356 ID3DXEffectImpl_SetMatrixArray,
2357 ID3DXEffectImpl_GetMatrixArray,
2358 ID3DXEffectImpl_SetMatrixPointerArray,
2359 ID3DXEffectImpl_GetMatrixPointerArray,
2360 ID3DXEffectImpl_SetMatrixTranspose,
2361 ID3DXEffectImpl_GetMatrixTranspose,
2362 ID3DXEffectImpl_SetMatrixTransposeArray,
2363 ID3DXEffectImpl_GetMatrixTransposeArray,
2364 ID3DXEffectImpl_SetMatrixTransposePointerArray,
2365 ID3DXEffectImpl_GetMatrixTransposePointerArray,
2366 ID3DXEffectImpl_SetString,
2367 ID3DXEffectImpl_GetString,
2368 ID3DXEffectImpl_SetTexture,
2369 ID3DXEffectImpl_GetTexture,
2370 ID3DXEffectImpl_GetPixelShader,
2371 ID3DXEffectImpl_GetVertexShader,
2372 ID3DXEffectImpl_SetArrayRange,
2373 /*** ID3DXEffect methods ***/
2374 ID3DXEffectImpl_GetPool,
2375 ID3DXEffectImpl_SetTechnique,
2376 ID3DXEffectImpl_GetCurrentTechnique,
2377 ID3DXEffectImpl_ValidateTechnique,
2378 ID3DXEffectImpl_FindNextValidTechnique,
2379 ID3DXEffectImpl_IsParameterUsed,
2380 ID3DXEffectImpl_Begin,
2381 ID3DXEffectImpl_BeginPass,
2382 ID3DXEffectImpl_CommitChanges,
2383 ID3DXEffectImpl_EndPass,
2384 ID3DXEffectImpl_End,
2385 ID3DXEffectImpl_GetDevice,
2386 ID3DXEffectImpl_OnLostDevice,
2387 ID3DXEffectImpl_OnResetDevice,
2388 ID3DXEffectImpl_SetStateManager,
2389 ID3DXEffectImpl_GetStateManager,
2390 ID3DXEffectImpl_BeginParameterBlock,
2391 ID3DXEffectImpl_EndParameterBlock,
2392 ID3DXEffectImpl_ApplyParameterBlock,
2393 ID3DXEffectImpl_DeleteParameterBlock,
2394 ID3DXEffectImpl_CloneEffect,
2395 ID3DXEffectImpl_SetRawValue
2398 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
2400 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
2403 /*** IUnknown methods ***/
2404 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
2406 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2408 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
2410 if (IsEqualGUID(riid, &IID_IUnknown) ||
2411 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
2413 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
2414 *object = This;
2415 return S_OK;
2418 ERR("Interface %s not found\n", debugstr_guid(riid));
2420 return E_NOINTERFACE;
2423 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
2425 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2427 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
2429 return InterlockedIncrement(&This->ref);
2432 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
2434 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2435 ULONG ref = InterlockedDecrement(&This->ref);
2437 TRACE("iface %p: Release from %u\n", iface, ref + 1);
2439 if (!ref)
2441 free_effect_compiler(This);
2442 HeapFree(GetProcessHeap(), 0, This);
2445 return ref;
2448 /*** ID3DXBaseEffect methods ***/
2449 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
2451 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2452 ID3DXBaseEffect *base = This->base_effect;
2454 TRACE("Forward iface %p, base %p\n", This, base);
2456 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2459 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2461 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2462 ID3DXBaseEffect *base = This->base_effect;
2464 TRACE("Forward iface %p, base %p\n", This, base);
2466 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2469 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2471 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2472 ID3DXBaseEffect *base = This->base_effect;
2474 TRACE("Forward iface %p, base %p\n", This, base);
2476 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2479 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2481 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2482 ID3DXBaseEffect *base = This->base_effect;
2484 TRACE("Forward iface %p, base %p\n", This, base);
2486 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2489 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2491 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2492 ID3DXBaseEffect *base = This->base_effect;
2494 TRACE("Forward iface %p, base %p\n", This, base);
2496 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2499 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2501 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2502 ID3DXBaseEffect *base = This->base_effect;
2504 TRACE("Forward iface %p, base %p\n", This, base);
2506 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2509 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
2511 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2512 ID3DXBaseEffect *base = This->base_effect;
2514 TRACE("Forward iface %p, base %p\n", This, base);
2516 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2519 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
2521 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2522 ID3DXBaseEffect *base = This->base_effect;
2524 TRACE("Forward iface %p, base %p\n", This, base);
2526 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2529 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
2531 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2532 ID3DXBaseEffect *base = This->base_effect;
2534 TRACE("Forward iface %p, base %p\n", This, base);
2536 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2539 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
2541 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2542 ID3DXBaseEffect *base = This->base_effect;
2544 TRACE("Forward iface %p, base %p\n", This, base);
2546 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2549 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
2551 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2552 ID3DXBaseEffect *base = This->base_effect;
2554 TRACE("Forward iface %p, base %p\n", This, base);
2556 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2559 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
2561 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2562 ID3DXBaseEffect *base = This->base_effect;
2564 TRACE("Forward iface %p, base %p\n", This, base);
2566 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2569 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
2571 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2572 ID3DXBaseEffect *base = This->base_effect;
2574 TRACE("Forward iface %p, base %p\n", This, base);
2576 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2579 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
2581 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2582 ID3DXBaseEffect *base = This->base_effect;
2584 TRACE("Forward iface %p, base %p\n", This, base);
2586 return ID3DXBaseEffectImpl_GetFunction(base, index);
2589 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
2591 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2592 ID3DXBaseEffect *base = This->base_effect;
2594 TRACE("Forward iface %p, base %p\n", This, base);
2596 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2599 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
2601 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2602 ID3DXBaseEffect *base = This->base_effect;
2604 TRACE("Forward iface %p, base %p\n", This, base);
2606 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2609 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
2611 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2612 ID3DXBaseEffect *base = This->base_effect;
2614 TRACE("Forward iface %p, base %p\n", This, base);
2616 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2619 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2621 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2622 ID3DXBaseEffect *base = This->base_effect;
2624 TRACE("Forward iface %p, base %p\n", This, base);
2626 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2629 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2631 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2632 ID3DXBaseEffect *base = This->base_effect;
2634 TRACE("Forward iface %p, base %p\n", This, base);
2636 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2639 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
2641 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2642 ID3DXBaseEffect *base = This->base_effect;
2644 TRACE("Forward iface %p, base %p\n", This, base);
2646 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2649 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
2651 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2652 ID3DXBaseEffect *base = This->base_effect;
2654 TRACE("Forward iface %p, base %p\n", This, base);
2656 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2659 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2661 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2662 ID3DXBaseEffect *base = This->base_effect;
2664 TRACE("Forward iface %p, base %p\n", This, base);
2666 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2669 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2671 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2672 ID3DXBaseEffect *base = This->base_effect;
2674 TRACE("Forward iface %p, base %p\n", This, base);
2676 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2679 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
2681 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2682 ID3DXBaseEffect *base = This->base_effect;
2684 TRACE("Forward iface %p, base %p\n", This, base);
2686 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2689 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
2691 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2692 ID3DXBaseEffect *base = This->base_effect;
2694 TRACE("Forward iface %p, base %p\n", This, base);
2696 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2699 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2701 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2702 ID3DXBaseEffect *base = This->base_effect;
2704 TRACE("Forward iface %p, base %p\n", This, base);
2706 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2709 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
2711 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2712 ID3DXBaseEffect *base = This->base_effect;
2714 TRACE("Forward iface %p, base %p\n", This, base);
2716 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2719 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
2721 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2722 ID3DXBaseEffect *base = This->base_effect;
2724 TRACE("Forward iface %p, base %p\n", This, base);
2726 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2729 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
2731 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2732 ID3DXBaseEffect *base = This->base_effect;
2734 TRACE("Forward iface %p, base %p\n", This, base);
2736 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2739 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2741 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2742 ID3DXBaseEffect *base = This->base_effect;
2744 TRACE("Forward iface %p, base %p\n", This, base);
2746 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2749 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2751 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2752 ID3DXBaseEffect *base = This->base_effect;
2754 TRACE("Forward iface %p, base %p\n", This, base);
2756 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2759 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2761 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2762 ID3DXBaseEffect *base = This->base_effect;
2764 TRACE("Forward iface %p, base %p\n", This, base);
2766 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2769 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2771 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2772 ID3DXBaseEffect *base = This->base_effect;
2774 TRACE("Forward iface %p, base %p\n", This, base);
2776 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2779 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2781 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2782 ID3DXBaseEffect *base = This->base_effect;
2784 TRACE("Forward iface %p, base %p\n", This, base);
2786 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2789 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2791 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2792 ID3DXBaseEffect *base = This->base_effect;
2794 TRACE("Forward iface %p, base %p\n", This, base);
2796 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2799 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2801 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2802 ID3DXBaseEffect *base = This->base_effect;
2804 TRACE("Forward iface %p, base %p\n", This, base);
2806 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2809 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2811 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2812 ID3DXBaseEffect *base = This->base_effect;
2814 TRACE("Forward iface %p, base %p\n", This, base);
2816 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2819 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2821 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2822 ID3DXBaseEffect *base = This->base_effect;
2824 TRACE("Forward iface %p, base %p\n", This, base);
2826 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2829 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2831 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2832 ID3DXBaseEffect *base = This->base_effect;
2834 TRACE("Forward iface %p, base %p\n", This, base);
2836 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2839 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2841 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2842 ID3DXBaseEffect *base = This->base_effect;
2844 TRACE("Forward iface %p, base %p\n", This, base);
2846 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2849 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2851 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2852 ID3DXBaseEffect *base = This->base_effect;
2854 TRACE("Forward iface %p, base %p\n", This, base);
2856 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2859 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2861 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2862 ID3DXBaseEffect *base = This->base_effect;
2864 TRACE("Forward iface %p, base %p\n", This, base);
2866 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2869 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2871 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2872 ID3DXBaseEffect *base = This->base_effect;
2874 TRACE("Forward iface %p, base %p\n", This, base);
2876 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2879 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2881 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2882 ID3DXBaseEffect *base = This->base_effect;
2884 TRACE("Forward iface %p, base %p\n", This, base);
2886 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2889 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2891 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2892 ID3DXBaseEffect *base = This->base_effect;
2894 TRACE("Forward iface %p, base %p\n", This, base);
2896 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2899 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2901 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2902 ID3DXBaseEffect *base = This->base_effect;
2904 TRACE("Forward iface %p, base %p\n", This, base);
2906 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2909 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2911 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2912 ID3DXBaseEffect *base = This->base_effect;
2914 TRACE("Forward iface %p, base %p\n", This, base);
2916 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2919 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
2921 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2922 ID3DXBaseEffect *base = This->base_effect;
2924 TRACE("Forward iface %p, base %p\n", This, base);
2926 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2929 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
2931 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2932 ID3DXBaseEffect *base = This->base_effect;
2934 TRACE("Forward iface %p, base %p\n", This, base);
2936 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2939 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2941 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2942 ID3DXBaseEffect *base = This->base_effect;
2944 TRACE("Forward iface %p, base %p\n", This, base);
2946 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2949 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2951 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2952 ID3DXBaseEffect *base = This->base_effect;
2954 TRACE("Forward iface %p, base %p\n", This, base);
2956 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2959 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2961 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2962 ID3DXBaseEffect *base = This->base_effect;
2964 TRACE("Forward iface %p, base %p\n", This, base);
2966 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2969 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2971 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2972 ID3DXBaseEffect *base = This->base_effect;
2974 TRACE("Forward iface %p, base %p\n", This, base);
2976 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2979 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
2981 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2982 ID3DXBaseEffect *base = This->base_effect;
2984 TRACE("Forward iface %p, base %p\n", This, base);
2986 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2989 /*** ID3DXEffectCompiler methods ***/
2990 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
2992 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
2994 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
2996 return E_NOTIMPL;
2999 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
3001 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3003 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
3005 return E_NOTIMPL;
3008 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
3009 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
3011 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3013 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
3015 return E_NOTIMPL;
3018 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
3019 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
3021 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3023 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3024 This, function, target, flags, shader, error_msgs, constant_table);
3026 return E_NOTIMPL;
3029 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
3031 /*** IUnknown methods ***/
3032 ID3DXEffectCompilerImpl_QueryInterface,
3033 ID3DXEffectCompilerImpl_AddRef,
3034 ID3DXEffectCompilerImpl_Release,
3035 /*** ID3DXBaseEffect methods ***/
3036 ID3DXEffectCompilerImpl_GetDesc,
3037 ID3DXEffectCompilerImpl_GetParameterDesc,
3038 ID3DXEffectCompilerImpl_GetTechniqueDesc,
3039 ID3DXEffectCompilerImpl_GetPassDesc,
3040 ID3DXEffectCompilerImpl_GetFunctionDesc,
3041 ID3DXEffectCompilerImpl_GetParameter,
3042 ID3DXEffectCompilerImpl_GetParameterByName,
3043 ID3DXEffectCompilerImpl_GetParameterBySemantic,
3044 ID3DXEffectCompilerImpl_GetParameterElement,
3045 ID3DXEffectCompilerImpl_GetTechnique,
3046 ID3DXEffectCompilerImpl_GetTechniqueByName,
3047 ID3DXEffectCompilerImpl_GetPass,
3048 ID3DXEffectCompilerImpl_GetPassByName,
3049 ID3DXEffectCompilerImpl_GetFunction,
3050 ID3DXEffectCompilerImpl_GetFunctionByName,
3051 ID3DXEffectCompilerImpl_GetAnnotation,
3052 ID3DXEffectCompilerImpl_GetAnnotationByName,
3053 ID3DXEffectCompilerImpl_SetValue,
3054 ID3DXEffectCompilerImpl_GetValue,
3055 ID3DXEffectCompilerImpl_SetBool,
3056 ID3DXEffectCompilerImpl_GetBool,
3057 ID3DXEffectCompilerImpl_SetBoolArray,
3058 ID3DXEffectCompilerImpl_GetBoolArray,
3059 ID3DXEffectCompilerImpl_SetInt,
3060 ID3DXEffectCompilerImpl_GetInt,
3061 ID3DXEffectCompilerImpl_SetIntArray,
3062 ID3DXEffectCompilerImpl_GetIntArray,
3063 ID3DXEffectCompilerImpl_SetFloat,
3064 ID3DXEffectCompilerImpl_GetFloat,
3065 ID3DXEffectCompilerImpl_SetFloatArray,
3066 ID3DXEffectCompilerImpl_GetFloatArray,
3067 ID3DXEffectCompilerImpl_SetVector,
3068 ID3DXEffectCompilerImpl_GetVector,
3069 ID3DXEffectCompilerImpl_SetVectorArray,
3070 ID3DXEffectCompilerImpl_GetVectorArray,
3071 ID3DXEffectCompilerImpl_SetMatrix,
3072 ID3DXEffectCompilerImpl_GetMatrix,
3073 ID3DXEffectCompilerImpl_SetMatrixArray,
3074 ID3DXEffectCompilerImpl_GetMatrixArray,
3075 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
3076 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
3077 ID3DXEffectCompilerImpl_SetMatrixTranspose,
3078 ID3DXEffectCompilerImpl_GetMatrixTranspose,
3079 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
3080 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
3081 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
3082 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
3083 ID3DXEffectCompilerImpl_SetString,
3084 ID3DXEffectCompilerImpl_GetString,
3085 ID3DXEffectCompilerImpl_SetTexture,
3086 ID3DXEffectCompilerImpl_GetTexture,
3087 ID3DXEffectCompilerImpl_GetPixelShader,
3088 ID3DXEffectCompilerImpl_GetVertexShader,
3089 ID3DXEffectCompilerImpl_SetArrayRange,
3090 /*** ID3DXEffectCompiler methods ***/
3091 ID3DXEffectCompilerImpl_SetLiteral,
3092 ID3DXEffectCompilerImpl_GetLiteral,
3093 ID3DXEffectCompilerImpl_CompileEffect,
3094 ID3DXEffectCompilerImpl_CompileShader,
3097 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char **ptr)
3099 unsigned int i;
3100 HRESULT hr;
3101 UINT old_size = 0;
3102 DWORD id;
3104 if (param->element_count)
3106 param->data = value;
3108 for (i = 0; i < param->element_count; ++i)
3110 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3112 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3113 if (hr != D3D_OK)
3115 WARN("Failed to parse value\n");
3116 return hr;
3119 old_size += member->bytes;
3122 return D3D_OK;
3125 switch(param->class)
3127 case D3DXPC_SCALAR:
3128 case D3DXPC_VECTOR:
3129 case D3DXPC_MATRIX_ROWS:
3130 case D3DXPC_MATRIX_COLUMNS:
3131 param->data = value;
3132 break;
3134 case D3DXPC_STRUCT:
3135 param->data = value;
3137 for (i = 0; i < param->member_count; ++i)
3139 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3141 hr = d3dx9_parse_value(member, (char *)value + old_size, ptr);
3142 if (hr != D3D_OK)
3144 WARN("Failed to parse value\n");
3145 return hr;
3148 old_size += member->bytes;
3150 break;
3152 case D3DXPC_OBJECT:
3153 switch (param->type)
3155 case D3DXPT_STRING:
3156 case D3DXPT_PIXELSHADER:
3157 case D3DXPT_VERTEXSHADER:
3158 read_dword(ptr, &id);
3159 TRACE("Id: %u\n", id);
3160 param->base->objects[id] = get_parameter_handle(param);
3161 param->data = value;
3162 break;
3164 default:
3165 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3166 break;
3168 break;
3170 default:
3171 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3172 break;
3175 return D3D_OK;
3178 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *ptr)
3180 UINT size = param->bytes;
3181 HRESULT hr;
3182 void *value = NULL;
3184 TRACE("param size: %u\n", size);
3186 value = HeapAlloc(GetProcessHeap(), 0, size);
3187 if (!value)
3189 ERR("Failed to allocate data memory.\n");
3190 return E_OUTOFMEMORY;
3193 TRACE("Data: %s.\n", debugstr_an(ptr, size));
3194 memcpy(value, ptr, size);
3196 hr = d3dx9_parse_value(param, value, &ptr);
3197 if (hr != D3D_OK)
3199 WARN("Failed to parse value\n");
3200 HeapFree(GetProcessHeap(), 0, value);
3201 return hr;
3204 param->data = value;
3206 return D3D_OK;
3209 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
3211 DWORD size;
3213 read_dword(&ptr, &size);
3214 TRACE("Name size: %#x\n", size);
3216 if (!size)
3218 return D3D_OK;
3221 *name = HeapAlloc(GetProcessHeap(), 0, size);
3222 if (!*name)
3224 ERR("Failed to allocate name memory.\n");
3225 return E_OUTOFMEMORY;
3228 TRACE("Name: %s.\n", debugstr_an(ptr, size));
3229 memcpy(*name, ptr, size);
3231 return D3D_OK;
3234 static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr)
3236 DWORD size;
3237 HRESULT hr;
3239 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type));
3241 read_dword(ptr, &size);
3242 TRACE("Data size: %#x\n", size);
3244 if (!size)
3246 TRACE("Size is 0\n");
3247 *(void **)param->data = NULL;
3248 return D3D_OK;
3251 switch (param->type)
3253 case D3DXPT_STRING:
3254 /* re-read with size (sizeof(DWORD) = 4) */
3255 hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
3256 if (hr != D3D_OK)
3258 WARN("Failed to parse string data\n");
3259 return hr;
3261 break;
3263 case D3DXPT_VERTEXSHADER:
3264 hr = IDirect3DDevice9_CreateVertexShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DVERTEXSHADER9 *)param->data);
3265 if (hr != D3D_OK)
3267 WARN("Failed to create vertex shader\n");
3268 return hr;
3270 break;
3272 case D3DXPT_PIXELSHADER:
3273 hr = IDirect3DDevice9_CreatePixelShader(param->base->effect->device, (DWORD *)*ptr, (LPDIRECT3DPIXELSHADER9 *)param->data);
3274 if (hr != D3D_OK)
3276 WARN("Failed to create pixel shader\n");
3277 return hr;
3279 break;
3281 default:
3282 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3283 break;
3287 *ptr += ((size + 3) & ~3);
3289 return D3D_OK;
3292 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr,
3293 struct d3dx_parameter *parent, UINT flags)
3295 DWORD offset;
3296 HRESULT hr;
3297 D3DXHANDLE *member_handles = NULL;
3298 UINT i;
3300 param->flags = flags;
3302 if (!parent)
3304 read_dword(ptr, &param->type);
3305 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
3307 read_dword(ptr, &param->class);
3308 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
3310 read_dword(ptr, &offset);
3311 TRACE("Type name offset: %#x\n", offset);
3312 hr = d3dx9_parse_name(&param->name, data + offset);
3313 if (hr != D3D_OK)
3315 WARN("Failed to parse name\n");
3316 goto err_out;
3319 read_dword(ptr, &offset);
3320 TRACE("Type semantic offset: %#x\n", offset);
3321 hr = d3dx9_parse_name(&param->semantic, data + offset);
3322 if (hr != D3D_OK)
3324 WARN("Failed to parse semantic\n");
3325 goto err_out;
3328 read_dword(ptr, &param->element_count);
3329 TRACE("Elements: %u\n", param->element_count);
3331 switch (param->class)
3333 case D3DXPC_VECTOR:
3334 read_dword(ptr, &param->columns);
3335 TRACE("Columns: %u\n", param->columns);
3337 read_dword(ptr, &param->rows);
3338 TRACE("Rows: %u\n", param->rows);
3340 /* sizeof(DWORD) * rows * columns */
3341 param->bytes = 4 * param->rows * param->columns;
3342 break;
3344 case D3DXPC_SCALAR:
3345 case D3DXPC_MATRIX_ROWS:
3346 case D3DXPC_MATRIX_COLUMNS:
3347 read_dword(ptr, &param->rows);
3348 TRACE("Rows: %u\n", param->rows);
3350 read_dword(ptr, &param->columns);
3351 TRACE("Columns: %u\n", param->columns);
3353 /* sizeof(DWORD) * rows * columns */
3354 param->bytes = 4 * param->rows * param->columns;
3355 break;
3357 case D3DXPC_STRUCT:
3358 read_dword(ptr, &param->member_count);
3359 TRACE("Members: %u\n", param->member_count);
3360 break;
3362 case D3DXPC_OBJECT:
3363 switch (param->type)
3365 case D3DXPT_STRING:
3366 param->bytes = sizeof(LPCSTR);
3367 break;
3369 case D3DXPT_PIXELSHADER:
3370 param->bytes = sizeof(LPDIRECT3DPIXELSHADER9);
3371 break;
3373 case D3DXPT_VERTEXSHADER:
3374 param->bytes = sizeof(LPDIRECT3DVERTEXSHADER9);
3375 break;
3377 default:
3378 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3379 break;
3381 break;
3383 default:
3384 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3385 break;
3388 else
3390 /* elements */
3391 param->type = parent->type;
3392 param->class = parent->class;
3393 param->name = parent->name;
3394 param->semantic = parent->semantic;
3395 param->element_count = 0;
3396 param->annotation_count = 0;
3397 param->member_count = parent->member_count;
3398 param->bytes = parent->bytes;
3399 param->rows = parent->rows;
3400 param->columns = parent->columns;
3403 if (param->element_count)
3405 unsigned int param_bytes = 0;
3406 const char *save_ptr = *ptr;
3408 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
3409 if (!member_handles)
3411 ERR("Out of memory\n");
3412 hr = E_OUTOFMEMORY;
3413 goto err_out;
3416 for (i = 0; i < param->element_count; ++i)
3418 struct d3dx_parameter *member;
3419 *ptr = save_ptr;
3421 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3422 if (!member)
3424 ERR("Out of memory\n");
3425 hr = E_OUTOFMEMORY;
3426 goto err_out;
3429 member_handles[i] = get_parameter_handle(member);
3430 member->base = param->base;
3432 hr = d3dx9_parse_effect_typedef(member, data, ptr, param, flags);
3433 if (hr != D3D_OK)
3435 WARN("Failed to parse member\n");
3436 goto err_out;
3439 param_bytes += member->bytes;
3442 param->bytes = param_bytes;
3444 else if (param->member_count)
3446 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
3447 if (!member_handles)
3449 ERR("Out of memory\n");
3450 hr = E_OUTOFMEMORY;
3451 goto err_out;
3454 for (i = 0; i < param->member_count; ++i)
3456 struct d3dx_parameter *member;
3458 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
3459 if (!member)
3461 ERR("Out of memory\n");
3462 hr = E_OUTOFMEMORY;
3463 goto err_out;
3466 member_handles[i] = get_parameter_handle(member);
3467 member->base = param->base;
3469 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL, flags);
3470 if (hr != D3D_OK)
3472 WARN("Failed to parse member\n");
3473 goto err_out;
3476 param->bytes += member->bytes;
3480 param->member_handles = member_handles;
3482 return D3D_OK;
3484 err_out:
3486 if (member_handles)
3488 unsigned int count;
3490 if (param->element_count) count = param->element_count;
3491 else count = param->member_count;
3493 for (i = 0; i < count; ++i)
3495 free_parameter(member_handles[i], param->element_count != 0, TRUE);
3497 HeapFree(GetProcessHeap(), 0, member_handles);
3500 if (!parent)
3502 HeapFree(GetProcessHeap(), 0, param->name);
3503 HeapFree(GetProcessHeap(), 0, param->semantic);
3505 param->name = NULL;
3506 param->semantic = NULL;
3508 return hr;
3511 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr)
3513 DWORD offset;
3514 const char *ptr2;
3515 HRESULT hr;
3517 anno->flags = D3DX_PARAMETER_ANNOTATION;
3519 read_dword(ptr, &offset);
3520 TRACE("Typedef offset: %#x\n", offset);
3521 ptr2 = data + offset;
3522 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION);
3523 if (hr != D3D_OK)
3525 WARN("Failed to parse type definition\n");
3526 return hr;
3529 read_dword(ptr, &offset);
3530 TRACE("Value offset: %#x\n", offset);
3531 hr = d3dx9_parse_init_value(anno, data + offset);
3532 if (hr != D3D_OK)
3534 WARN("Failed to parse value\n");
3535 return hr;
3538 return D3D_OK;
3541 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr)
3543 DWORD offset;
3544 HRESULT hr;
3545 unsigned int i;
3546 D3DXHANDLE *annotation_handles = NULL;
3547 const char *ptr2;
3549 read_dword(ptr, &offset);
3550 TRACE("Typedef offset: %#x\n", offset);
3551 ptr2 = data + offset;
3553 read_dword(ptr, &offset);
3554 TRACE("Value offset: %#x\n", offset);
3556 read_dword(ptr, &param->flags);
3557 TRACE("Flags: %#x\n", param->flags);
3559 read_dword(ptr, &param->annotation_count);
3560 TRACE("Annotation count: %u\n", param->annotation_count);
3562 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags);
3563 if (hr != D3D_OK)
3565 WARN("Failed to parse type definition\n");
3566 return hr;
3569 hr = d3dx9_parse_init_value(param, data + offset);
3570 if (hr != D3D_OK)
3572 WARN("Failed to parse value\n");
3573 return hr;
3576 if (param->annotation_count)
3578 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
3579 if (!annotation_handles)
3581 ERR("Out of memory\n");
3582 hr = E_OUTOFMEMORY;
3583 goto err_out;
3586 for (i = 0; i < param->annotation_count; ++i)
3588 struct d3dx_parameter *annotation;
3590 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3591 if (!annotation)
3593 ERR("Out of memory\n");
3594 hr = E_OUTOFMEMORY;
3595 goto err_out;
3598 annotation_handles[i] = get_parameter_handle(annotation);
3599 annotation->base = param->base;
3601 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3602 if (hr != D3D_OK)
3604 WARN("Failed to parse annotation\n");
3605 goto err_out;
3610 param->annotation_handles = annotation_handles;
3612 return D3D_OK;
3614 err_out:
3616 if (annotation_handles)
3618 for (i = 0; i < param->annotation_count; ++i)
3620 free_parameter(annotation_handles[i], FALSE, FALSE);
3622 HeapFree(GetProcessHeap(), 0, annotation_handles);
3625 return hr;
3628 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr)
3630 DWORD offset;
3631 HRESULT hr;
3632 unsigned int i;
3633 D3DXHANDLE *annotation_handles = NULL;
3634 char *name = NULL;
3636 read_dword(ptr, &offset);
3637 TRACE("Pass name offset: %#x\n", offset);
3638 hr = d3dx9_parse_name(&name, data + offset);
3639 if (hr != D3D_OK)
3641 WARN("Failed to parse name\n");
3642 goto err_out;
3645 read_dword(ptr, &pass->annotation_count);
3646 TRACE("Annotation count: %u\n", pass->annotation_count);
3648 read_dword(ptr, &pass->state_count);
3649 TRACE("State count: %u\n", pass->state_count);
3651 if (pass->annotation_count)
3653 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
3654 if (!annotation_handles)
3656 ERR("Out of memory\n");
3657 hr = E_OUTOFMEMORY;
3658 goto err_out;
3661 for (i = 0; i < pass->annotation_count; ++i)
3663 struct d3dx_parameter *annotation;
3665 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3666 if (!annotation)
3668 ERR("Out of memory\n");
3669 hr = E_OUTOFMEMORY;
3670 goto err_out;
3673 annotation_handles[i] = get_parameter_handle(annotation);
3674 annotation->base = pass->base;
3676 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3677 if (hr != D3D_OK)
3679 WARN("Failed to parse annotations\n");
3680 goto err_out;
3685 if (pass->state_count)
3687 for (i = 0; i < pass->state_count; ++i)
3689 skip_dword_unknown(ptr, 4);
3693 pass->name = name;
3694 pass->annotation_handles = annotation_handles;
3696 return D3D_OK;
3698 err_out:
3700 if (annotation_handles)
3702 for (i = 0; i < pass->annotation_count; ++i)
3704 free_parameter(annotation_handles[i], FALSE, FALSE);
3706 HeapFree(GetProcessHeap(), 0, annotation_handles);
3709 HeapFree(GetProcessHeap(), 0, name);
3711 return hr;
3714 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr)
3716 DWORD offset;
3717 HRESULT hr;
3718 unsigned int i;
3719 D3DXHANDLE *annotation_handles = NULL;
3720 D3DXHANDLE *pass_handles = NULL;
3721 char *name = NULL;
3723 read_dword(ptr, &offset);
3724 TRACE("Technique name offset: %#x\n", offset);
3725 hr = d3dx9_parse_name(&name, data + offset);
3726 if (hr != D3D_OK)
3728 WARN("Failed to parse name\n");
3729 goto err_out;
3732 read_dword(ptr, &technique->annotation_count);
3733 TRACE("Annotation count: %u\n", technique->annotation_count);
3735 read_dword(ptr, &technique->pass_count);
3736 TRACE("Pass count: %u\n", technique->pass_count);
3738 if (technique->annotation_count)
3740 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
3741 if (!annotation_handles)
3743 ERR("Out of memory\n");
3744 hr = E_OUTOFMEMORY;
3745 goto err_out;
3748 for (i = 0; i < technique->annotation_count; ++i)
3750 struct d3dx_parameter *annotation;
3752 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
3753 if (!annotation)
3755 ERR("Out of memory\n");
3756 hr = E_OUTOFMEMORY;
3757 goto err_out;
3760 annotation_handles[i] = get_parameter_handle(annotation);
3761 annotation->base = technique->base;
3763 hr = d3dx9_parse_effect_annotation(annotation, data, ptr);
3764 if (hr != D3D_OK)
3766 WARN("Failed to parse annotations\n");
3767 goto err_out;
3772 if (technique->pass_count)
3774 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
3775 if (!pass_handles)
3777 ERR("Out of memory\n");
3778 hr = E_OUTOFMEMORY;
3779 goto err_out;
3782 for (i = 0; i < technique->pass_count; ++i)
3784 struct d3dx_pass *pass;
3786 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
3787 if (!pass)
3789 ERR("Out of memory\n");
3790 hr = E_OUTOFMEMORY;
3791 goto err_out;
3794 pass_handles[i] = get_pass_handle(pass);
3795 pass->base = technique->base;
3797 hr = d3dx9_parse_effect_pass(pass, data, ptr);
3798 if (hr != D3D_OK)
3800 WARN("Failed to parse passes\n");
3801 goto err_out;
3806 technique->name = name;
3807 technique->pass_handles = pass_handles;
3808 technique->annotation_handles = annotation_handles;
3810 return D3D_OK;
3812 err_out:
3814 if (pass_handles)
3816 for (i = 0; i < technique->pass_count; ++i)
3818 free_pass(pass_handles[i]);
3820 HeapFree(GetProcessHeap(), 0, pass_handles);
3823 if (annotation_handles)
3825 for (i = 0; i < technique->annotation_count; ++i)
3827 free_parameter(annotation_handles[i], FALSE, FALSE);
3829 HeapFree(GetProcessHeap(), 0, annotation_handles);
3832 HeapFree(GetProcessHeap(), 0, name);
3834 return hr;
3837 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
3839 const char *ptr = data + start;
3840 D3DXHANDLE *parameter_handles = NULL;
3841 D3DXHANDLE *technique_handles = NULL;
3842 D3DXHANDLE *objects = NULL;
3843 unsigned int stringcount;
3844 HRESULT hr;
3845 unsigned int i;
3847 read_dword(&ptr, &base->parameter_count);
3848 TRACE("Parameter count: %u\n", base->parameter_count);
3850 read_dword(&ptr, &base->technique_count);
3851 TRACE("Technique count: %u\n", base->technique_count);
3853 skip_dword_unknown(&ptr, 1);
3855 read_dword(&ptr, &base->object_count);
3856 TRACE("Object count: %u\n", base->object_count);
3858 objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * base->object_count);
3859 if (!objects)
3861 ERR("Out of memory\n");
3862 hr = E_OUTOFMEMORY;
3863 goto err_out;
3866 base->objects = objects;
3868 if (base->parameter_count)
3870 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
3871 if (!parameter_handles)
3873 ERR("Out of memory\n");
3874 hr = E_OUTOFMEMORY;
3875 goto err_out;
3878 for (i = 0; i < base->parameter_count; ++i)
3880 struct d3dx_parameter *parameter;
3882 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
3883 if (!parameter)
3885 ERR("Out of memory\n");
3886 hr = E_OUTOFMEMORY;
3887 goto err_out;
3890 parameter_handles[i] = get_parameter_handle(parameter);
3891 parameter->base = base;
3893 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr);
3894 if (hr != D3D_OK)
3896 WARN("Failed to parse parameter\n");
3897 goto err_out;
3902 if (base->technique_count)
3904 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
3905 if (!technique_handles)
3907 ERR("Out of memory\n");
3908 hr = E_OUTOFMEMORY;
3909 goto err_out;
3912 for (i = 0; i < base->technique_count; ++i)
3914 struct d3dx_technique *technique;
3916 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
3917 if (!technique)
3919 ERR("Out of memory\n");
3920 hr = E_OUTOFMEMORY;
3921 goto err_out;
3924 technique_handles[i] = get_technique_handle(technique);
3925 technique->base = base;
3927 hr = d3dx9_parse_effect_technique(technique, data, &ptr);
3928 if (hr != D3D_OK)
3930 WARN("Failed to parse technique\n");
3931 goto err_out;
3936 read_dword(&ptr, &stringcount);
3937 TRACE("String count: %u\n", stringcount);
3939 skip_dword_unknown(&ptr, 1);
3941 for (i = 0; i < stringcount; ++i)
3943 DWORD id;
3944 struct d3dx_parameter *param;
3946 read_dword(&ptr, &id);
3947 TRACE("Id: %u\n", id);
3949 param = get_parameter_struct(base->objects[id]);
3951 hr = d3dx9_parse_data(param, &ptr);
3952 if (hr != D3D_OK)
3954 WARN("Failed to parse data\n");
3955 goto err_out;
3959 HeapFree(GetProcessHeap(), 0, objects);
3960 base->objects = NULL;
3962 base->technique_handles = technique_handles;
3963 base->parameter_handles = parameter_handles;
3965 return D3D_OK;
3967 err_out:
3969 if (technique_handles)
3971 for (i = 0; i < base->technique_count; ++i)
3973 free_technique(technique_handles[i]);
3975 HeapFree(GetProcessHeap(), 0, technique_handles);
3978 if (parameter_handles)
3980 for (i = 0; i < base->parameter_count; ++i)
3982 free_parameter(parameter_handles[i], FALSE, FALSE);
3984 HeapFree(GetProcessHeap(), 0, parameter_handles);
3987 HeapFree(GetProcessHeap(), 0, objects);
3989 return hr;
3992 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
3993 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
3995 DWORD tag, offset;
3996 const char *ptr = data;
3997 HRESULT hr;
3999 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
4001 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
4002 base->ref = 1;
4003 base->effect = effect;
4005 read_dword(&ptr, &tag);
4006 TRACE("Tag: %x\n", tag);
4008 if (tag != d3dx9_effect_version(9, 1))
4010 /* todo: compile hlsl ascii code */
4011 FIXME("HLSL ascii effects not supported, yet\n");
4013 /* Show the start of the shader for debugging info. */
4014 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
4016 else
4018 read_dword(&ptr, &offset);
4019 TRACE("Offset: %x\n", offset);
4021 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
4022 if (hr != D3D_OK)
4024 FIXME("Failed to parse effect.\n");
4025 return hr;
4029 return D3D_OK;
4032 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
4033 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
4035 HRESULT hr;
4036 struct ID3DXBaseEffectImpl *object = NULL;
4038 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
4040 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
4041 effect->ref = 1;
4043 if (pool) pool->lpVtbl->AddRef(pool);
4044 effect->pool = pool;
4046 IDirect3DDevice9_AddRef(device);
4047 effect->device = device;
4049 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4050 if (!object)
4052 ERR("Out of memory\n");
4053 hr = E_OUTOFMEMORY;
4054 goto err_out;
4057 hr = d3dx9_base_effect_init(object, data, data_size, effect);
4058 if (hr != D3D_OK)
4060 FIXME("Failed to parse effect.\n");
4061 goto err_out;
4064 effect->base_effect = &object->ID3DXBaseEffect_iface;
4066 return D3D_OK;
4068 err_out:
4070 HeapFree(GetProcessHeap(), 0, object);
4071 free_effect(effect);
4073 return hr;
4076 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
4077 LPCVOID srcdata,
4078 UINT srcdatalen,
4079 CONST D3DXMACRO* defines,
4080 LPD3DXINCLUDE include,
4081 LPCSTR skip_constants,
4082 DWORD flags,
4083 LPD3DXEFFECTPOOL pool,
4084 LPD3DXEFFECT* effect,
4085 LPD3DXBUFFER* compilation_errors)
4087 struct ID3DXEffectImpl *object;
4088 HRESULT hr;
4090 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
4091 skip_constants, flags, pool, effect, compilation_errors);
4093 if (!device || !srcdata)
4094 return D3DERR_INVALIDCALL;
4096 if (!srcdatalen)
4097 return E_FAIL;
4099 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
4100 if (!effect)
4101 return D3D_OK;
4103 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4104 if (!object)
4106 ERR("Out of memory\n");
4107 return E_OUTOFMEMORY;
4110 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
4111 if (FAILED(hr))
4113 WARN("Failed to initialize shader reflection\n");
4114 HeapFree(GetProcessHeap(), 0, object);
4115 return hr;
4118 *effect = &object->ID3DXEffect_iface;
4120 TRACE("Created ID3DXEffect %p\n", object);
4122 return D3D_OK;
4125 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
4126 LPCVOID srcdata,
4127 UINT srcdatalen,
4128 CONST D3DXMACRO* defines,
4129 LPD3DXINCLUDE include,
4130 DWORD flags,
4131 LPD3DXEFFECTPOOL pool,
4132 LPD3DXEFFECT* effect,
4133 LPD3DXBUFFER* compilation_errors)
4135 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
4136 include, flags, pool, effect, compilation_errors);
4138 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
4141 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
4143 HRESULT hr;
4144 struct ID3DXBaseEffectImpl *object = NULL;
4146 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
4148 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
4149 compiler->ref = 1;
4151 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4152 if (!object)
4154 ERR("Out of memory\n");
4155 hr = E_OUTOFMEMORY;
4156 goto err_out;
4159 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
4160 if (hr != D3D_OK)
4162 FIXME("Failed to parse effect.\n");
4163 goto err_out;
4166 compiler->base_effect = &object->ID3DXBaseEffect_iface;
4168 return D3D_OK;
4170 err_out:
4172 HeapFree(GetProcessHeap(), 0, object);
4173 free_effect_compiler(compiler);
4175 return hr;
4178 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
4179 UINT srcdatalen,
4180 CONST D3DXMACRO *defines,
4181 LPD3DXINCLUDE include,
4182 DWORD flags,
4183 LPD3DXEFFECTCOMPILER *compiler,
4184 LPD3DXBUFFER *parse_errors)
4186 struct ID3DXEffectCompilerImpl *object;
4187 HRESULT hr;
4189 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
4190 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
4192 if (!srcdata || !compiler)
4194 WARN("Invalid arguments supplied\n");
4195 return D3DERR_INVALIDCALL;
4198 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4199 if (!object)
4201 ERR("Out of memory\n");
4202 return E_OUTOFMEMORY;
4205 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
4206 if (FAILED(hr))
4208 WARN("Failed to initialize effect compiler\n");
4209 HeapFree(GetProcessHeap(), 0, object);
4210 return hr;
4213 *compiler = &object->ID3DXEffectCompiler_iface;
4215 TRACE("Created ID3DXEffectCompiler %p\n", object);
4217 return D3D_OK;
4220 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
4222 struct ID3DXEffectPoolImpl
4224 ID3DXEffectPool ID3DXEffectPool_iface;
4225 LONG ref;
4228 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
4230 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
4233 /*** IUnknown methods ***/
4234 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
4236 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4238 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
4240 if (IsEqualGUID(riid, &IID_IUnknown) ||
4241 IsEqualGUID(riid, &IID_ID3DXEffectPool))
4243 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
4244 *object = This;
4245 return S_OK;
4248 WARN("Interface %s not found\n", debugstr_guid(riid));
4250 return E_NOINTERFACE;
4253 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
4255 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4257 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
4259 return InterlockedIncrement(&This->ref);
4262 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
4264 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
4265 ULONG ref = InterlockedDecrement(&This->ref);
4267 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
4269 if (!ref)
4270 HeapFree(GetProcessHeap(), 0, This);
4272 return ref;
4275 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
4277 /*** IUnknown methods ***/
4278 ID3DXEffectPoolImpl_QueryInterface,
4279 ID3DXEffectPoolImpl_AddRef,
4280 ID3DXEffectPoolImpl_Release
4283 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
4285 struct ID3DXEffectPoolImpl *object;
4287 TRACE("(%p)\n", pool);
4289 if (!pool)
4290 return D3DERR_INVALIDCALL;
4292 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
4293 if (!object)
4295 ERR("Out of memory\n");
4296 return E_OUTOFMEMORY;
4299 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
4300 object->ref = 1;
4302 *pool = &object->ID3DXEffectPool_iface;
4304 return S_OK;
4307 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4308 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4309 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4311 LPVOID buffer;
4312 HRESULT ret;
4313 DWORD size;
4315 TRACE("(%s): relay\n", debugstr_w(srcfile));
4317 if (!device || !srcfile || !defines)
4318 return D3DERR_INVALIDCALL;
4320 ret = map_view_of_file(srcfile, &buffer, &size);
4322 if (FAILED(ret))
4323 return D3DXERR_INVALIDDATA;
4325 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4326 UnmapViewOfFile(buffer);
4328 return ret;
4331 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4332 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4333 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4335 LPWSTR srcfileW;
4336 HRESULT ret;
4337 DWORD len;
4339 TRACE("(void): relay\n");
4341 if (!srcfile || !defines)
4342 return D3DERR_INVALIDCALL;
4344 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4345 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4346 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4348 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4349 HeapFree(GetProcessHeap(), 0, srcfileW);
4351 return ret;
4354 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
4355 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4356 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4358 TRACE("(void): relay\n");
4359 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4362 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
4363 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4364 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4366 TRACE("(void): relay\n");
4367 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
4370 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4371 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4372 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4374 HRSRC resinfo;
4376 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4378 if (!device || !defines)
4379 return D3DERR_INVALIDCALL;
4381 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4383 if (resinfo)
4385 LPVOID buffer;
4386 HRESULT ret;
4387 DWORD size;
4389 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4391 if (FAILED(ret))
4392 return D3DXERR_INVALIDDATA;
4394 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4397 return D3DXERR_INVALIDDATA;
4400 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4401 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
4402 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4404 HRSRC resinfo;
4406 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4408 if (!device || !defines)
4409 return D3DERR_INVALIDCALL;
4411 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4413 if (resinfo)
4415 LPVOID buffer;
4416 HRESULT ret;
4417 DWORD size;
4419 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4421 if (FAILED(ret))
4422 return D3DXERR_INVALIDDATA;
4424 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
4427 return D3DXERR_INVALIDDATA;
4430 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
4431 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4432 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4434 TRACE("(void): relay\n");
4435 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4438 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
4439 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
4440 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
4442 TRACE("(void): relay\n");
4443 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
4446 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4447 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4449 LPVOID buffer;
4450 HRESULT ret;
4451 DWORD size;
4453 TRACE("(%s): relay\n", debugstr_w(srcfile));
4455 if (!srcfile || !defines)
4456 return D3DERR_INVALIDCALL;
4458 ret = map_view_of_file(srcfile, &buffer, &size);
4460 if (FAILED(ret))
4461 return D3DXERR_INVALIDDATA;
4463 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4464 UnmapViewOfFile(buffer);
4466 return ret;
4469 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
4470 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4472 LPWSTR srcfileW;
4473 HRESULT ret;
4474 DWORD len;
4476 TRACE("(void): relay\n");
4478 if (!srcfile || !defines)
4479 return D3DERR_INVALIDCALL;
4481 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
4482 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
4483 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
4485 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
4486 HeapFree(GetProcessHeap(), 0, srcfileW);
4488 return ret;
4491 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
4492 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4494 HRSRC resinfo;
4496 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
4498 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
4500 if (resinfo)
4502 LPVOID buffer;
4503 HRESULT ret;
4504 DWORD size;
4506 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4508 if (FAILED(ret))
4509 return D3DXERR_INVALIDDATA;
4511 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4514 return D3DXERR_INVALIDDATA;
4517 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
4518 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
4520 HRSRC resinfo;
4522 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
4524 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
4526 if (resinfo)
4528 LPVOID buffer;
4529 HRESULT ret;
4530 DWORD size;
4532 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
4534 if (FAILED(ret))
4535 return D3DXERR_INVALIDDATA;
4537 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
4540 return D3DXERR_INVALIDDATA;