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