2 * Copyright 2010 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/port.h"
21 #include "wine/debug.h"
22 #include "wine/unicode.h"
25 #include "d3dx9_36_private.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(d3dx
);
29 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl
;
30 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl
;
31 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl
;
35 struct ID3DXBaseEffectImpl
*base
;
40 D3DXPARAMETER_CLASS
class;
41 D3DXPARAMETER_TYPE type
;
45 UINT annotation_count
;
50 D3DXHANDLE
*annotation_handles
;
51 D3DXHANDLE
*member_handles
;
56 struct ID3DXBaseEffectImpl
*base
;
60 UINT annotation_count
;
62 D3DXHANDLE
*annotation_handles
;
67 struct ID3DXBaseEffectImpl
*base
;
71 UINT annotation_count
;
73 D3DXHANDLE
*annotation_handles
;
74 D3DXHANDLE
*pass_handles
;
77 struct ID3DXBaseEffectImpl
79 ID3DXBaseEffect ID3DXBaseEffect_iface
;
82 struct ID3DXEffectImpl
*effect
;
88 D3DXHANDLE
*parameter_handles
;
89 D3DXHANDLE
*technique_handles
;
93 struct ID3DXEffectImpl
95 ID3DXEffect ID3DXEffect_iface
;
98 LPDIRECT3DDEVICE9 device
;
99 LPD3DXEFFECTPOOL pool
;
101 ID3DXBaseEffect
*base_effect
;
104 struct ID3DXEffectCompilerImpl
106 ID3DXEffectCompiler ID3DXEffectCompiler_iface
;
109 ID3DXBaseEffect
*base_effect
;
112 static struct d3dx_parameter
*get_parameter_by_name(struct ID3DXBaseEffectImpl
*base
,
113 struct d3dx_parameter
*parameter
, LPCSTR name
);
114 static struct d3dx_parameter
*get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl
*base
,
115 struct d3dx_parameter
*parameter
, LPCSTR name
);
117 static inline void read_dword(const char **ptr
, DWORD
*d
)
119 memcpy(d
, *ptr
, sizeof(*d
));
123 static void skip_dword_unknown(const char **ptr
, unsigned int count
)
128 FIXME("Skipping %u unknown DWORDs:\n", count
);
129 for (i
= 0; i
< count
; ++i
)
132 FIXME("\t0x%08x\n", d
);
136 static inline struct d3dx_parameter
*get_parameter_struct(D3DXHANDLE handle
)
138 return (struct d3dx_parameter
*) handle
;
141 static inline struct d3dx_pass
*get_pass_struct(D3DXHANDLE handle
)
143 return (struct d3dx_pass
*) handle
;
146 static inline struct d3dx_technique
*get_technique_struct(D3DXHANDLE handle
)
148 return (struct d3dx_technique
*) handle
;
151 static inline D3DXHANDLE
get_parameter_handle(struct d3dx_parameter
*parameter
)
153 return (D3DXHANDLE
) parameter
;
156 static inline D3DXHANDLE
get_technique_handle(struct d3dx_technique
*technique
)
158 return (D3DXHANDLE
) technique
;
161 static inline D3DXHANDLE
get_pass_handle(struct d3dx_pass
*pass
)
163 return (D3DXHANDLE
) pass
;
166 static struct d3dx_technique
*is_valid_technique(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE technique
)
170 for (i
= 0; i
< base
->technique_count
; ++i
)
172 if (base
->technique_handles
[i
] == technique
)
174 return get_technique_struct(technique
);
181 static struct d3dx_pass
*is_valid_pass(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE pass
)
185 for (i
= 0; i
< base
->technique_count
; ++i
)
187 struct d3dx_technique
*technique
= get_technique_struct(base
->technique_handles
[i
]);
189 for (k
= 0; k
< technique
->pass_count
; ++k
)
191 if (technique
->pass_handles
[k
] == pass
)
193 return get_pass_struct(pass
);
201 static struct d3dx_parameter
*is_valid_sub_parameter(struct d3dx_parameter
*param
, D3DXHANDLE parameter
)
203 unsigned int i
, count
;
204 struct d3dx_parameter
*p
;
206 for (i
= 0; i
< param
->annotation_count
; ++i
)
208 if (param
->annotation_handles
[i
] == parameter
)
210 return get_parameter_struct(parameter
);
213 p
= is_valid_sub_parameter(get_parameter_struct(param
->annotation_handles
[i
]), parameter
);
217 if (param
->element_count
) count
= param
->element_count
;
218 else count
= param
->member_count
;
220 for (i
= 0; i
< count
; ++i
)
222 if (param
->member_handles
[i
] == parameter
)
224 return get_parameter_struct(parameter
);
227 p
= is_valid_sub_parameter(get_parameter_struct(param
->member_handles
[i
]), parameter
);
234 static struct d3dx_parameter
*is_valid_parameter(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE parameter
)
236 unsigned int i
, k
, m
;
237 struct d3dx_parameter
*p
;
239 for (i
= 0; i
< base
->parameter_count
; ++i
)
241 if (base
->parameter_handles
[i
] == parameter
)
243 return get_parameter_struct(parameter
);
246 p
= is_valid_sub_parameter(get_parameter_struct(base
->parameter_handles
[i
]), parameter
);
250 for (i
= 0; i
< base
->technique_count
; ++i
)
252 struct d3dx_technique
*technique
= get_technique_struct(base
->technique_handles
[i
]);
254 for (k
= 0; k
< technique
->pass_count
; ++k
)
256 struct d3dx_pass
*pass
= get_pass_struct(technique
->pass_handles
[k
]);
258 for (m
= 0; m
< pass
->annotation_count
; ++m
)
260 if (pass
->annotation_handles
[i
] == parameter
)
262 return get_parameter_struct(parameter
);
265 p
= is_valid_sub_parameter(get_parameter_struct(pass
->annotation_handles
[m
]), parameter
);
270 for (k
= 0; k
< technique
->annotation_count
; ++k
)
272 if (technique
->annotation_handles
[k
] == parameter
)
274 return get_parameter_struct(parameter
);
277 p
= is_valid_sub_parameter(get_parameter_struct(technique
->annotation_handles
[k
]), parameter
);
285 static void free_parameter(D3DXHANDLE handle
, BOOL element
, BOOL child
)
288 struct d3dx_parameter
*param
= get_parameter_struct(handle
);
290 TRACE("Free parameter %p, child %s\n", param
, child
? "yes" : "no");
297 if (param
->annotation_handles
)
299 for (i
= 0; i
< param
->annotation_count
; ++i
)
301 free_parameter(param
->annotation_handles
[i
], FALSE
, FALSE
);
303 HeapFree(GetProcessHeap(), 0, param
->annotation_handles
);
306 if (param
->member_handles
)
310 if (param
->element_count
) count
= param
->element_count
;
311 else count
= param
->member_count
;
313 for (i
= 0; i
< count
; ++i
)
315 free_parameter(param
->member_handles
[i
], param
->element_count
!= 0, TRUE
);
317 HeapFree(GetProcessHeap(), 0, param
->member_handles
);
320 if (param
->class == D3DXPC_OBJECT
&& !param
->element_count
)
325 HeapFree(GetProcessHeap(), 0, *(LPSTR
*)param
->data
);
328 case D3DXPT_PIXELSHADER
:
329 case D3DXPT_VERTEXSHADER
:
330 if (*(IUnknown
**)param
->data
) IUnknown_Release(*(IUnknown
**)param
->data
);
334 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
341 HeapFree(GetProcessHeap(), 0, param
->data
);
344 /* only the parent has to release name and semantic */
347 HeapFree(GetProcessHeap(), 0, param
->name
);
348 HeapFree(GetProcessHeap(), 0, param
->semantic
);
351 HeapFree(GetProcessHeap(), 0, param
);
354 static void free_pass(D3DXHANDLE handle
)
357 struct d3dx_pass
*pass
= get_pass_struct(handle
);
359 TRACE("Free pass %p\n", pass
);
366 if (pass
->annotation_handles
)
368 for (i
= 0; i
< pass
->annotation_count
; ++i
)
370 free_parameter(pass
->annotation_handles
[i
], FALSE
, FALSE
);
372 HeapFree(GetProcessHeap(), 0, pass
->annotation_handles
);
375 HeapFree(GetProcessHeap(), 0, pass
->name
);
376 HeapFree(GetProcessHeap(), 0, pass
);
379 static void free_technique(D3DXHANDLE handle
)
382 struct d3dx_technique
*technique
= get_technique_struct(handle
);
384 TRACE("Free technique %p\n", technique
);
391 if (technique
->annotation_handles
)
393 for (i
= 0; i
< technique
->annotation_count
; ++i
)
395 free_parameter(technique
->annotation_handles
[i
], FALSE
, FALSE
);
397 HeapFree(GetProcessHeap(), 0, technique
->annotation_handles
);
400 if (technique
->pass_handles
)
402 for (i
= 0; i
< technique
->pass_count
; ++i
)
404 free_pass(technique
->pass_handles
[i
]);
406 HeapFree(GetProcessHeap(), 0, technique
->pass_handles
);
409 HeapFree(GetProcessHeap(), 0, technique
->name
);
410 HeapFree(GetProcessHeap(), 0, technique
);
413 static void free_base_effect(struct ID3DXBaseEffectImpl
*base
)
417 TRACE("Free base effect %p\n", base
);
419 if (base
->parameter_handles
)
421 for (i
= 0; i
< base
->parameter_count
; ++i
)
423 free_parameter(base
->parameter_handles
[i
], FALSE
, FALSE
);
425 HeapFree(GetProcessHeap(), 0, base
->parameter_handles
);
428 if (base
->technique_handles
)
430 for (i
= 0; i
< base
->technique_count
; ++i
)
432 free_technique(base
->technique_handles
[i
]);
434 HeapFree(GetProcessHeap(), 0, base
->technique_handles
);
438 static void free_effect(struct ID3DXEffectImpl
*effect
)
440 TRACE("Free effect %p\n", effect
);
442 if (effect
->base_effect
)
444 effect
->base_effect
->lpVtbl
->Release(effect
->base_effect
);
449 effect
->pool
->lpVtbl
->Release(effect
->pool
);
452 IDirect3DDevice9_Release(effect
->device
);
455 static void free_effect_compiler(struct ID3DXEffectCompilerImpl
*compiler
)
457 TRACE("Free effect compiler %p\n", compiler
);
459 if (compiler
->base_effect
)
461 compiler
->base_effect
->lpVtbl
->Release(compiler
->base_effect
);
465 static INT
get_int(D3DXPARAMETER_TYPE type
, void *data
)
485 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type
));
492 inline static FLOAT
get_float(D3DXPARAMETER_TYPE type
, void *data
)
512 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type
));
519 static inline BOOL
get_bool(void *data
)
521 return (*(DWORD
*)data
) ? TRUE
: FALSE
;
524 static struct d3dx_parameter
*get_parameter_element_by_name(struct ID3DXBaseEffectImpl
*base
,
525 struct d3dx_parameter
*parameter
, LPCSTR name
)
528 struct d3dx_parameter
*temp_parameter
;
531 TRACE("base %p, parameter %p, name %s\n", base
, parameter
, debugstr_a(name
));
533 if (!name
|| !*name
) return parameter
;
535 element
= atoi(name
);
536 part
= strchr(name
, ']') + 1;
538 if (parameter
->element_count
> element
)
540 temp_parameter
= get_parameter_struct(parameter
->member_handles
[element
]);
545 return get_parameter_by_name(base
, temp_parameter
, part
);
548 return get_parameter_annotation_by_name(base
, temp_parameter
, part
);
551 TRACE("Returning parameter %p\n", temp_parameter
);
552 return temp_parameter
;
555 FIXME("Unhandled case \"%c\"\n", *--part
);
560 TRACE("Parameter not found\n");
564 static struct d3dx_parameter
*get_parameter_annotation_by_name(struct ID3DXBaseEffectImpl
*base
,
565 struct d3dx_parameter
*parameter
, LPCSTR name
)
568 struct d3dx_parameter
*temp_parameter
;
571 TRACE("base %p, parameter %p, name %s\n", base
, parameter
, debugstr_a(name
));
573 if (!name
|| !*name
) return parameter
;
575 length
= strcspn( name
, "[.@" );
576 part
= name
+ length
;
578 for (i
= 0; i
< parameter
->annotation_count
; ++i
)
580 temp_parameter
= get_parameter_struct(parameter
->annotation_handles
[i
]);
582 if (!strcmp(temp_parameter
->name
, name
))
584 TRACE("Returning parameter %p\n", temp_parameter
);
585 return temp_parameter
;
587 else if (strlen(temp_parameter
->name
) == length
&& !strncmp(temp_parameter
->name
, name
, length
))
592 return get_parameter_by_name(base
, temp_parameter
, part
);
595 return get_parameter_element_by_name(base
, temp_parameter
, part
);
598 FIXME("Unhandled case \"%c\"\n", *--part
);
604 TRACE("Parameter not found\n");
608 static struct d3dx_parameter
*get_parameter_by_name(struct ID3DXBaseEffectImpl
*base
,
609 struct d3dx_parameter
*parameter
, LPCSTR name
)
611 UINT i
, count
, length
;
612 struct d3dx_parameter
*temp_parameter
;
616 TRACE("base %p, parameter %p, name %s\n", base
, parameter
, debugstr_a(name
));
618 if (!name
|| !*name
) return parameter
;
622 count
= base
->parameter_count
;
623 handles
= base
->parameter_handles
;
627 count
= parameter
->member_count
;
628 handles
= parameter
->member_handles
;
631 length
= strcspn( name
, "[.@" );
632 part
= name
+ length
;
634 for (i
= 0; i
< count
; i
++)
636 temp_parameter
= get_parameter_struct(handles
[i
]);
638 if (!strcmp(temp_parameter
->name
, name
))
640 TRACE("Returning parameter %p\n", temp_parameter
);
641 return temp_parameter
;
643 else if (strlen(temp_parameter
->name
) == length
&& !strncmp(temp_parameter
->name
, name
, length
))
648 return get_parameter_by_name(base
, temp_parameter
, part
);
651 return get_parameter_annotation_by_name(base
, temp_parameter
, part
);
654 return get_parameter_element_by_name(base
, temp_parameter
, part
);
657 FIXME("Unhandled case \"%c\"\n", *--part
);
663 TRACE("Parameter not found\n");
667 static inline DWORD
d3dx9_effect_version(DWORD major
, DWORD minor
)
669 return (0xfeff0000 | ((major
) << 8) | (minor
));
672 static inline struct ID3DXBaseEffectImpl
*impl_from_ID3DXBaseEffect(ID3DXBaseEffect
*iface
)
674 return CONTAINING_RECORD(iface
, struct ID3DXBaseEffectImpl
, ID3DXBaseEffect_iface
);
677 /*** IUnknown methods ***/
678 static HRESULT WINAPI
ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect
*iface
, REFIID riid
, void **object
)
680 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
682 TRACE("iface %p, riid %s, object %p\n", This
, debugstr_guid(riid
), object
);
684 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
685 IsEqualGUID(riid
, &IID_ID3DXBaseEffect
))
687 This
->ID3DXBaseEffect_iface
.lpVtbl
->AddRef(iface
);
692 ERR("Interface %s not found\n", debugstr_guid(riid
));
694 return E_NOINTERFACE
;
697 static ULONG WINAPI
ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect
*iface
)
699 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
701 TRACE("iface %p: AddRef from %u\n", iface
, This
->ref
);
703 return InterlockedIncrement(&This
->ref
);
706 static ULONG WINAPI
ID3DXBaseEffectImpl_Release(ID3DXBaseEffect
*iface
)
708 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
709 ULONG ref
= InterlockedDecrement(&This
->ref
);
711 TRACE("iface %p: Release from %u\n", iface
, ref
+ 1);
715 free_base_effect(This
);
716 HeapFree(GetProcessHeap(), 0, This
);
722 /*** ID3DXBaseEffect methods ***/
723 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect
*iface
, D3DXEFFECT_DESC
*desc
)
725 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
727 FIXME("iface %p, desc %p partial stub\n", This
, desc
);
731 WARN("Invalid argument specified.\n");
732 return D3DERR_INVALIDCALL
;
735 /* Todo: add creator and function count */
736 desc
->Creator
= NULL
;
738 desc
->Parameters
= This
->parameter_count
;
739 desc
->Techniques
= This
->technique_count
;
744 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXPARAMETER_DESC
*desc
)
746 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
747 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
749 TRACE("iface %p, parameter %p, desc %p\n", This
, parameter
, desc
);
751 if (!param
) param
= get_parameter_struct(iface
->lpVtbl
->GetParameterByName(iface
, NULL
, parameter
));
755 WARN("Invalid argument specified.\n");
756 return D3DERR_INVALIDCALL
;
759 desc
->Name
= param
->name
;
760 desc
->Semantic
= param
->semantic
;
761 desc
->Class
= param
->class;
762 desc
->Type
= param
->type
;
763 desc
->Rows
= param
->rows
;
764 desc
->Columns
= param
->columns
;
765 desc
->Elements
= param
->element_count
;
766 desc
->Annotations
= param
->annotation_count
;
767 desc
->StructMembers
= param
->member_count
;
768 desc
->Flags
= param
->flags
;
769 desc
->Bytes
= param
->bytes
;
774 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE technique
, D3DXTECHNIQUE_DESC
*desc
)
776 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
777 struct d3dx_technique
*tech
= technique
? is_valid_technique(This
, technique
) : get_technique_struct(This
->technique_handles
[0]);
779 TRACE("iface %p, technique %p, desc %p\n", This
, technique
, desc
);
783 WARN("Invalid argument specified.\n");
784 return D3DERR_INVALIDCALL
;
787 desc
->Name
= tech
->name
;
788 desc
->Passes
= tech
->pass_count
;
789 desc
->Annotations
= tech
->annotation_count
;
794 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE pass
, D3DXPASS_DESC
*desc
)
796 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
797 struct d3dx_pass
*p
= is_valid_pass(This
, pass
);
799 TRACE("iface %p, pass %p, desc %p\n", This
, pass
, desc
);
803 WARN("Invalid argument specified.\n");
804 return D3DERR_INVALIDCALL
;
807 desc
->Name
= p
->name
;
808 desc
->Annotations
= p
->annotation_count
;
810 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
811 desc
->pVertexShaderFunction
= NULL
;
812 desc
->pVertexShaderFunction
= NULL
;
817 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE shader
, D3DXFUNCTION_DESC
*desc
)
819 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
821 FIXME("iface %p, shader %p, desc %p stub\n", This
, shader
, desc
);
826 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
828 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
829 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
831 TRACE("iface %p, parameter %p, index %u\n", This
, parameter
, index
);
833 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
837 if (index
< This
->parameter_count
)
839 TRACE("Returning parameter %p\n", This
->parameter_handles
[index
]);
840 return This
->parameter_handles
[index
];
845 if (param
&& !param
->element_count
&& index
< param
->member_count
)
847 TRACE("Returning parameter %p\n", param
->member_handles
[index
]);
848 return param
->member_handles
[index
];
852 WARN("Invalid argument specified.\n");
857 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR name
)
859 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
860 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
863 TRACE("iface %p, parameter %p, name %s\n", This
, parameter
, debugstr_a(name
));
865 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
869 handle
= get_parameter_handle(param
);
870 TRACE("Returning parameter %p\n", handle
);
874 handle
= get_parameter_handle(get_parameter_by_name(This
, param
, name
));
875 TRACE("Returning parameter %p\n", handle
);
880 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR semantic
)
882 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
883 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
884 struct d3dx_parameter
*temp_param
;
887 TRACE("iface %p, parameter %p, semantic %s\n", This
, parameter
, debugstr_a(semantic
));
889 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
893 for (i
= 0; i
< This
->parameter_count
; ++i
)
895 temp_param
= get_parameter_struct(This
->parameter_handles
[i
]);
897 if (!temp_param
->semantic
)
901 TRACE("Returning parameter %p\n", This
->parameter_handles
[i
]);
902 return This
->parameter_handles
[i
];
907 if (!strcasecmp(temp_param
->semantic
, semantic
))
909 TRACE("Returning parameter %p\n", This
->parameter_handles
[i
]);
910 return This
->parameter_handles
[i
];
916 for (i
= 0; i
< param
->member_count
; ++i
)
918 temp_param
= get_parameter_struct(param
->member_handles
[i
]);
920 if (!temp_param
->semantic
)
924 TRACE("Returning parameter %p\n", param
->member_handles
[i
]);
925 return param
->member_handles
[i
];
930 if (!strcasecmp(temp_param
->semantic
, semantic
))
932 TRACE("Returning parameter %p\n", param
->member_handles
[i
]);
933 return param
->member_handles
[i
];
938 WARN("Invalid argument specified\n");
943 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
945 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
946 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
948 TRACE("iface %p, parameter %p, index %u\n", This
, parameter
, index
);
950 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
954 if (index
< This
->parameter_count
)
956 TRACE("Returning parameter %p\n", This
->parameter_handles
[index
]);
957 return This
->parameter_handles
[index
];
962 if (index
< param
->element_count
)
964 TRACE("Returning parameter %p\n", param
->member_handles
[index
]);
965 return param
->member_handles
[index
];
969 WARN("Invalid argument specified\n");
974 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect
*iface
, UINT index
)
976 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
978 TRACE("iface %p, index %u\n", This
, index
);
980 if (index
>= This
->technique_count
)
982 WARN("Invalid argument specified.\n");
986 TRACE("Returning technique %p\n", This
->technique_handles
[index
]);
988 return This
->technique_handles
[index
];
991 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect
*iface
, LPCSTR name
)
993 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
996 TRACE("iface %p, name %s stub\n", This
, debugstr_a(name
));
1000 WARN("Invalid argument specified.\n");
1004 for (i
= 0; i
< This
->technique_count
; ++i
)
1006 struct d3dx_technique
*tech
= get_technique_struct(This
->technique_handles
[i
]);
1008 if (!strcmp(tech
->name
, name
))
1010 TRACE("Returning technique %p\n", This
->technique_handles
[i
]);
1011 return This
->technique_handles
[i
];
1015 WARN("Invalid argument specified.\n");
1020 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect
*iface
, D3DXHANDLE technique
, UINT index
)
1022 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1023 struct d3dx_technique
*tech
= is_valid_technique(This
, technique
);
1025 TRACE("iface %p, technique %p, index %u\n", This
, technique
, index
);
1027 if (!tech
) tech
= get_technique_struct(iface
->lpVtbl
->GetTechniqueByName(iface
, technique
));
1029 if (tech
&& index
< tech
->pass_count
)
1031 TRACE("Returning pass %p\n", tech
->pass_handles
[index
]);
1032 return tech
->pass_handles
[index
];
1035 WARN("Invalid argument specified.\n");
1040 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect
*iface
, D3DXHANDLE technique
, LPCSTR name
)
1042 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1043 struct d3dx_technique
*tech
= is_valid_technique(This
, technique
);
1045 TRACE("iface %p, technique %p, name %s\n", This
, technique
, debugstr_a(name
));
1047 if (!tech
) tech
= get_technique_struct(iface
->lpVtbl
->GetTechniqueByName(iface
, technique
));
1053 for (i
= 0; i
< tech
->pass_count
; ++i
)
1055 struct d3dx_pass
*pass
= get_pass_struct(tech
->pass_handles
[i
]);
1057 if (!strcmp(pass
->name
, name
))
1059 TRACE("Returning pass %p\n", tech
->pass_handles
[i
]);
1060 return tech
->pass_handles
[i
];
1065 WARN("Invalid argument specified.\n");
1070 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect
*iface
, UINT index
)
1072 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1074 FIXME("iface %p, index %u stub\n", This
, index
);
1079 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect
*iface
, LPCSTR name
)
1081 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1083 FIXME("iface %p, name %s stub\n", This
, debugstr_a(name
));
1088 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect
*iface
, D3DXHANDLE object
, UINT index
)
1090 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1091 struct d3dx_parameter
*param
= is_valid_parameter(This
, object
);
1092 struct d3dx_pass
*pass
= is_valid_pass(This
, object
);
1093 struct d3dx_technique
*technique
= is_valid_technique(This
, object
);
1094 UINT annotation_count
= 0;
1095 D3DXHANDLE
*annotation_handles
= NULL
;
1097 FIXME("iface %p, object %p, index %u partial stub\n", This
, object
, index
);
1101 annotation_count
= pass
->annotation_count
;
1102 annotation_handles
= pass
->annotation_handles
;
1106 annotation_count
= technique
->annotation_count
;
1107 annotation_handles
= technique
->annotation_handles
;
1111 if (!param
) param
= get_parameter_by_name(This
, NULL
, object
);
1115 annotation_count
= param
->annotation_count
;
1116 annotation_handles
= param
->annotation_handles
;
1119 /* Todo: add funcs */
1121 if (index
< annotation_count
)
1123 TRACE("Returning parameter %p\n", annotation_handles
[index
]);
1124 return annotation_handles
[index
];
1127 WARN("Invalid argument specified\n");
1132 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect
*iface
, D3DXHANDLE object
, LPCSTR name
)
1134 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1135 struct d3dx_parameter
*param
= is_valid_parameter(This
, object
);
1136 struct d3dx_pass
*pass
= is_valid_pass(This
, object
);
1137 struct d3dx_technique
*technique
= is_valid_technique(This
, object
);
1138 UINT annotation_count
= 0, i
;
1139 D3DXHANDLE
*annotation_handles
= NULL
;
1141 FIXME("iface %p, object %p, name %s partial stub\n", This
, object
, debugstr_a(name
));
1145 WARN("Invalid argument specified\n");
1151 annotation_count
= pass
->annotation_count
;
1152 annotation_handles
= pass
->annotation_handles
;
1156 annotation_count
= technique
->annotation_count
;
1157 annotation_handles
= technique
->annotation_handles
;
1161 if (!param
) param
= get_parameter_by_name(This
, NULL
, object
);
1165 annotation_count
= param
->annotation_count
;
1166 annotation_handles
= param
->annotation_handles
;
1169 /* Todo: add funcs */
1171 for (i
= 0; i
< annotation_count
; i
++)
1173 struct d3dx_parameter
*anno
= get_parameter_struct(annotation_handles
[i
]);
1175 if (!strcmp(anno
->name
, name
))
1177 TRACE("Returning parameter %p\n", anno
);
1178 return get_parameter_handle(anno
);
1182 WARN("Invalid argument specified\n");
1187 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT bytes
)
1189 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1191 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This
, parameter
, data
, bytes
);
1196 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPVOID data
, UINT bytes
)
1198 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1199 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1201 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This
, parameter
, data
, bytes
);
1203 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1205 if (data
&& param
&& param
->data
&& param
->bytes
<= bytes
)
1207 if (param
->type
== D3DXPT_VERTEXSHADER
|| param
->type
== D3DXPT_PIXELSHADER
)
1211 for (i
= 0; i
< (param
->element_count
? param
->element_count
: 1); ++i
)
1213 IUnknown
*unk
= ((IUnknown
**)param
->data
)[i
];
1214 if (unk
) IUnknown_AddRef(unk
);
1215 ((IUnknown
**)data
)[i
] = unk
;
1220 TRACE("Copy %u bytes\n", param
->bytes
);
1221 memcpy(data
, param
->data
, param
->bytes
);
1226 WARN("Invalid argument specified\n");
1228 return D3DERR_INVALIDCALL
;
1231 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, BOOL b
)
1233 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1235 FIXME("iface %p, parameter %p, b %u stub\n", This
, parameter
, b
);
1240 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
)
1242 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1243 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1245 TRACE("iface %p, parameter %p, b %p\n", This
, parameter
, b
);
1247 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1249 if (b
&& param
&& !param
->element_count
&& param
->class == D3DXPC_SCALAR
)
1251 *b
= get_bool(param
->data
);
1252 TRACE("Returning %s\n", *b
? "TRUE" : "FALSE");
1256 WARN("Invalid argument specified\n");
1258 return D3DERR_INVALIDCALL
;
1261 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST BOOL
*b
, UINT count
)
1263 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1265 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This
, parameter
, b
, count
);
1270 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
, UINT count
)
1272 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1274 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This
, parameter
, b
, count
);
1279 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, INT n
)
1281 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1283 FIXME("iface %p, parameter %p, n %u stub\n", This
, parameter
, n
);
1288 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, INT
*n
)
1290 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1291 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1293 TRACE("iface %p, parameter %p, n %p\n", This
, parameter
, n
);
1295 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1297 if (n
&& param
&& !param
->element_count
&& param
->class == D3DXPC_SCALAR
)
1299 *n
= get_int(param
->type
, param
->data
);
1300 TRACE("Returning %i\n", *n
);
1304 WARN("Invalid argument specified\n");
1306 return D3DERR_INVALIDCALL
;
1309 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST INT
*n
, UINT count
)
1311 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1313 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This
, parameter
, n
, count
);
1318 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, INT
*n
, UINT count
)
1320 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1322 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This
, parameter
, n
, count
);
1327 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, FLOAT f
)
1329 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1331 FIXME("iface %p, parameter %p, f %f stub\n", This
, parameter
, f
);
1336 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
)
1338 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1339 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1341 TRACE("iface %p, parameter %p, f %p\n", This
, parameter
, f
);
1343 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1345 if (f
&& param
&& !param
->element_count
&& param
->class == D3DXPC_SCALAR
)
1348 TRACE("Returning %f\n", *f
);
1352 WARN("Invalid argument specified\n");
1354 return D3DERR_INVALIDCALL
;
1357 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST FLOAT
*f
, UINT count
)
1359 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1361 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This
, parameter
, f
, count
);
1366 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
, UINT count
)
1368 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1370 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This
, parameter
, f
, count
);
1375 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect
* iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
* vector
)
1377 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1379 FIXME("iface %p, parameter %p, vector %p stub\n", This
, parameter
, vector
);
1384 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
)
1386 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1388 FIXME("iface %p, parameter %p, vector %p stub\n", This
, parameter
, vector
);
1393 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
, UINT count
)
1395 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1397 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This
, parameter
, vector
, count
);
1402 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
, UINT count
)
1404 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1406 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This
, parameter
, vector
, count
);
1411 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
1413 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1415 FIXME("iface %p, parameter %p, matrix %p stub\n", This
, parameter
, matrix
);
1420 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
1422 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1424 FIXME("iface %p, parameter %p, matrix %p stub\n", This
, parameter
, matrix
);
1429 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
1431 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1433 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1438 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
1440 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1442 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1447 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
1449 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1451 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1456 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
1458 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1460 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1465 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
1467 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1469 FIXME("iface %p, parameter %p, matrix %p stub\n", This
, parameter
, matrix
);
1474 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
1476 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1478 FIXME("iface %p, parameter %p, matrix %p stub\n", This
, parameter
, matrix
);
1483 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
1485 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1487 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1492 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
1494 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1496 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1501 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
1503 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1505 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1510 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
1512 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1514 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
1519 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR string
)
1521 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1523 FIXME("iface %p, parameter %p, string %p stub\n", This
, parameter
, string
);
1528 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR
*string
)
1530 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1531 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1533 TRACE("iface %p, parameter %p, string %p\n", This
, parameter
, string
);
1535 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1537 if (string
&& param
&& !param
->element_count
&& param
->type
== D3DXPT_STRING
)
1539 *string
= *(LPCSTR
*)param
->data
;
1540 TRACE("Returning %s\n", debugstr_a(*string
));
1544 WARN("Invalid argument specified\n");
1546 return D3DERR_INVALIDCALL
;
1549 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9 texture
)
1551 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1553 FIXME("iface %p, parameter %p, texture %p stub\n", This
, parameter
, texture
);
1558 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9
*texture
)
1560 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1562 FIXME("iface %p, parameter %p, texture %p stub\n", This
, parameter
, texture
);
1567 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DPIXELSHADER9
*pshader
)
1569 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1570 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1572 TRACE("iface %p, parameter %p, pshader %p\n", This
, parameter
, pshader
);
1574 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1576 if (pshader
&& param
&& !param
->element_count
&& param
->type
== D3DXPT_PIXELSHADER
)
1578 *pshader
= *(LPDIRECT3DPIXELSHADER9
*)param
->data
;
1579 if (*pshader
) IDirect3DPixelShader9_AddRef(*pshader
);
1580 TRACE("Returning %p\n", *pshader
);
1584 WARN("Invalid argument specified\n");
1586 return D3DERR_INVALIDCALL
;
1589 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DVERTEXSHADER9
*vshader
)
1591 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1592 struct d3dx_parameter
*param
= is_valid_parameter(This
, parameter
);
1594 TRACE("iface %p, parameter %p, vshader %p\n", This
, parameter
, vshader
);
1596 if (!param
) param
= get_parameter_by_name(This
, NULL
, parameter
);
1598 if (vshader
&& param
&& !param
->element_count
&& param
->type
== D3DXPT_VERTEXSHADER
)
1600 *vshader
= *(LPDIRECT3DVERTEXSHADER9
*)param
->data
;
1601 if (*vshader
) IDirect3DVertexShader9_AddRef(*vshader
);
1602 TRACE("Returning %p\n", *vshader
);
1606 WARN("Invalid argument specified\n");
1608 return D3DERR_INVALIDCALL
;
1611 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, UINT start
, UINT end
)
1613 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1615 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This
, parameter
, start
, end
);
1620 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl
=
1622 /*** IUnknown methods ***/
1623 ID3DXBaseEffectImpl_QueryInterface
,
1624 ID3DXBaseEffectImpl_AddRef
,
1625 ID3DXBaseEffectImpl_Release
,
1626 /*** ID3DXBaseEffect methods ***/
1627 ID3DXBaseEffectImpl_GetDesc
,
1628 ID3DXBaseEffectImpl_GetParameterDesc
,
1629 ID3DXBaseEffectImpl_GetTechniqueDesc
,
1630 ID3DXBaseEffectImpl_GetPassDesc
,
1631 ID3DXBaseEffectImpl_GetFunctionDesc
,
1632 ID3DXBaseEffectImpl_GetParameter
,
1633 ID3DXBaseEffectImpl_GetParameterByName
,
1634 ID3DXBaseEffectImpl_GetParameterBySemantic
,
1635 ID3DXBaseEffectImpl_GetParameterElement
,
1636 ID3DXBaseEffectImpl_GetTechnique
,
1637 ID3DXBaseEffectImpl_GetTechniqueByName
,
1638 ID3DXBaseEffectImpl_GetPass
,
1639 ID3DXBaseEffectImpl_GetPassByName
,
1640 ID3DXBaseEffectImpl_GetFunction
,
1641 ID3DXBaseEffectImpl_GetFunctionByName
,
1642 ID3DXBaseEffectImpl_GetAnnotation
,
1643 ID3DXBaseEffectImpl_GetAnnotationByName
,
1644 ID3DXBaseEffectImpl_SetValue
,
1645 ID3DXBaseEffectImpl_GetValue
,
1646 ID3DXBaseEffectImpl_SetBool
,
1647 ID3DXBaseEffectImpl_GetBool
,
1648 ID3DXBaseEffectImpl_SetBoolArray
,
1649 ID3DXBaseEffectImpl_GetBoolArray
,
1650 ID3DXBaseEffectImpl_SetInt
,
1651 ID3DXBaseEffectImpl_GetInt
,
1652 ID3DXBaseEffectImpl_SetIntArray
,
1653 ID3DXBaseEffectImpl_GetIntArray
,
1654 ID3DXBaseEffectImpl_SetFloat
,
1655 ID3DXBaseEffectImpl_GetFloat
,
1656 ID3DXBaseEffectImpl_SetFloatArray
,
1657 ID3DXBaseEffectImpl_GetFloatArray
,
1658 ID3DXBaseEffectImpl_SetVector
,
1659 ID3DXBaseEffectImpl_GetVector
,
1660 ID3DXBaseEffectImpl_SetVectorArray
,
1661 ID3DXBaseEffectImpl_GetVectorArray
,
1662 ID3DXBaseEffectImpl_SetMatrix
,
1663 ID3DXBaseEffectImpl_GetMatrix
,
1664 ID3DXBaseEffectImpl_SetMatrixArray
,
1665 ID3DXBaseEffectImpl_GetMatrixArray
,
1666 ID3DXBaseEffectImpl_SetMatrixPointerArray
,
1667 ID3DXBaseEffectImpl_GetMatrixPointerArray
,
1668 ID3DXBaseEffectImpl_SetMatrixTranspose
,
1669 ID3DXBaseEffectImpl_GetMatrixTranspose
,
1670 ID3DXBaseEffectImpl_SetMatrixTransposeArray
,
1671 ID3DXBaseEffectImpl_GetMatrixTransposeArray
,
1672 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray
,
1673 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray
,
1674 ID3DXBaseEffectImpl_SetString
,
1675 ID3DXBaseEffectImpl_GetString
,
1676 ID3DXBaseEffectImpl_SetTexture
,
1677 ID3DXBaseEffectImpl_GetTexture
,
1678 ID3DXBaseEffectImpl_GetPixelShader
,
1679 ID3DXBaseEffectImpl_GetVertexShader
,
1680 ID3DXBaseEffectImpl_SetArrayRange
,
1683 static inline struct ID3DXEffectImpl
*impl_from_ID3DXEffect(ID3DXEffect
*iface
)
1685 return CONTAINING_RECORD(iface
, struct ID3DXEffectImpl
, ID3DXEffect_iface
);
1688 /*** IUnknown methods ***/
1689 static HRESULT WINAPI
ID3DXEffectImpl_QueryInterface(ID3DXEffect
*iface
, REFIID riid
, void **object
)
1691 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1693 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), object
);
1695 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
1696 IsEqualGUID(riid
, &IID_ID3DXEffect
))
1698 This
->ID3DXEffect_iface
.lpVtbl
->AddRef(iface
);
1703 ERR("Interface %s not found\n", debugstr_guid(riid
));
1705 return E_NOINTERFACE
;
1708 static ULONG WINAPI
ID3DXEffectImpl_AddRef(ID3DXEffect
*iface
)
1710 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1712 TRACE("(%p)->(): AddRef from %u\n", This
, This
->ref
);
1714 return InterlockedIncrement(&This
->ref
);
1717 static ULONG WINAPI
ID3DXEffectImpl_Release(ID3DXEffect
*iface
)
1719 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1720 ULONG ref
= InterlockedDecrement(&This
->ref
);
1722 TRACE("(%p)->(): Release from %u\n", This
, ref
+ 1);
1727 HeapFree(GetProcessHeap(), 0, This
);
1733 /*** ID3DXBaseEffect methods ***/
1734 static HRESULT WINAPI
ID3DXEffectImpl_GetDesc(ID3DXEffect
*iface
, D3DXEFFECT_DESC
*desc
)
1736 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1737 ID3DXBaseEffect
*base
= This
->base_effect
;
1739 TRACE("Forward iface %p, base %p\n", This
, base
);
1741 return ID3DXBaseEffectImpl_GetDesc(base
, desc
);
1744 static HRESULT WINAPI
ID3DXEffectImpl_GetParameterDesc(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXPARAMETER_DESC
*desc
)
1746 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1747 ID3DXBaseEffect
*base
= This
->base_effect
;
1749 TRACE("Forward iface %p, base %p\n", This
, base
);
1751 return ID3DXBaseEffectImpl_GetParameterDesc(base
, parameter
, desc
);
1754 static HRESULT WINAPI
ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect
*iface
, D3DXHANDLE technique
, D3DXTECHNIQUE_DESC
*desc
)
1756 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1757 ID3DXBaseEffect
*base
= This
->base_effect
;
1759 TRACE("Forward iface %p, base %p\n", This
, base
);
1761 return ID3DXBaseEffectImpl_GetTechniqueDesc(base
, technique
, desc
);
1764 static HRESULT WINAPI
ID3DXEffectImpl_GetPassDesc(ID3DXEffect
*iface
, D3DXHANDLE pass
, D3DXPASS_DESC
*desc
)
1766 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1767 ID3DXBaseEffect
*base
= This
->base_effect
;
1769 TRACE("Forward iface %p, base %p\n", This
, base
);
1771 return ID3DXBaseEffectImpl_GetPassDesc(base
, pass
, desc
);
1774 static HRESULT WINAPI
ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect
*iface
, D3DXHANDLE shader
, D3DXFUNCTION_DESC
*desc
)
1776 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1777 ID3DXBaseEffect
*base
= This
->base_effect
;
1779 TRACE("Forward iface %p, base %p\n", This
, base
);
1781 return ID3DXBaseEffectImpl_GetFunctionDesc(base
, shader
, desc
);
1784 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameter(ID3DXEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
1786 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1787 ID3DXBaseEffect
*base
= This
->base_effect
;
1789 TRACE("Forward iface %p, base %p\n", This
, base
);
1791 return ID3DXBaseEffectImpl_GetParameter(base
, parameter
, index
);
1794 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameterByName(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR name
)
1796 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1797 ID3DXBaseEffect
*base
= This
->base_effect
;
1799 TRACE("Forward iface %p, base %p\n", This
, base
);
1801 return ID3DXBaseEffectImpl_GetParameterByName(base
, parameter
, name
);
1804 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR semantic
)
1806 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1807 ID3DXBaseEffect
*base
= This
->base_effect
;
1809 TRACE("Forward iface %p, base %p\n", This
, base
);
1811 return ID3DXBaseEffectImpl_GetParameterBySemantic(base
, parameter
, semantic
);
1814 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameterElement(ID3DXEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
1816 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1817 ID3DXBaseEffect
*base
= This
->base_effect
;
1819 TRACE("Forward iface %p, base %p\n", This
, base
);
1821 return ID3DXBaseEffectImpl_GetParameterElement(base
, parameter
, index
);
1824 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetTechnique(ID3DXEffect
*iface
, UINT index
)
1826 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1827 ID3DXBaseEffect
*base
= This
->base_effect
;
1829 TRACE("Forward iface %p, base %p\n", This
, base
);
1831 return ID3DXBaseEffectImpl_GetTechnique(base
, index
);
1834 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect
*iface
, LPCSTR name
)
1836 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1837 ID3DXBaseEffect
*base
= This
->base_effect
;
1839 TRACE("Forward iface %p, base %p\n", This
, base
);
1841 return ID3DXBaseEffectImpl_GetTechniqueByName(base
, name
);
1844 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetPass(ID3DXEffect
*iface
, D3DXHANDLE technique
, UINT index
)
1846 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1847 ID3DXBaseEffect
*base
= This
->base_effect
;
1849 TRACE("Forward iface %p, base %p\n", This
, base
);
1851 return ID3DXBaseEffectImpl_GetPass(base
, technique
, index
);
1854 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetPassByName(ID3DXEffect
*iface
, D3DXHANDLE technique
, LPCSTR name
)
1856 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1857 ID3DXBaseEffect
*base
= This
->base_effect
;
1859 TRACE("Forward iface %p, base %p\n", This
, base
);
1861 return ID3DXBaseEffectImpl_GetPassByName(base
, technique
, name
);
1864 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetFunction(ID3DXEffect
*iface
, UINT index
)
1866 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1867 ID3DXBaseEffect
*base
= This
->base_effect
;
1869 TRACE("Forward iface %p, base %p\n", This
, base
);
1871 return ID3DXBaseEffectImpl_GetFunction(base
, index
);
1874 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetFunctionByName(ID3DXEffect
*iface
, LPCSTR name
)
1876 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1877 ID3DXBaseEffect
*base
= This
->base_effect
;
1879 TRACE("Forward iface %p, base %p\n", This
, base
);
1881 return ID3DXBaseEffectImpl_GetFunctionByName(base
, name
);
1884 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetAnnotation(ID3DXEffect
*iface
, D3DXHANDLE object
, UINT index
)
1886 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1887 ID3DXBaseEffect
*base
= This
->base_effect
;
1889 TRACE("Forward iface %p, base %p\n", This
, base
);
1891 return ID3DXBaseEffectImpl_GetAnnotation(base
, object
, index
);
1894 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect
*iface
, D3DXHANDLE object
, LPCSTR name
)
1896 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1897 ID3DXBaseEffect
*base
= This
->base_effect
;
1899 TRACE("Forward iface %p, base %p\n", This
, base
);
1901 return ID3DXBaseEffectImpl_GetAnnotationByName(base
, object
, name
);
1904 static HRESULT WINAPI
ID3DXEffectImpl_SetValue(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT bytes
)
1906 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1907 ID3DXBaseEffect
*base
= This
->base_effect
;
1909 TRACE("Forward iface %p, base %p\n", This
, base
);
1911 return ID3DXBaseEffectImpl_SetValue(base
, parameter
, data
, bytes
);
1914 static HRESULT WINAPI
ID3DXEffectImpl_GetValue(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPVOID data
, UINT bytes
)
1916 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1917 ID3DXBaseEffect
*base
= This
->base_effect
;
1919 TRACE("Forward iface %p, base %p\n", This
, base
);
1921 return ID3DXBaseEffectImpl_GetValue(base
, parameter
, data
, bytes
);
1924 static HRESULT WINAPI
ID3DXEffectImpl_SetBool(ID3DXEffect
*iface
, D3DXHANDLE parameter
, BOOL b
)
1926 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1927 ID3DXBaseEffect
*base
= This
->base_effect
;
1929 TRACE("Forward iface %p, base %p\n", This
, base
);
1931 return ID3DXBaseEffectImpl_SetBool(base
, parameter
, b
);
1934 static HRESULT WINAPI
ID3DXEffectImpl_GetBool(ID3DXEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
)
1936 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1937 ID3DXBaseEffect
*base
= This
->base_effect
;
1939 TRACE("Forward iface %p, base %p\n", This
, base
);
1941 return ID3DXBaseEffectImpl_GetBool(base
, parameter
, b
);
1944 static HRESULT WINAPI
ID3DXEffectImpl_SetBoolArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST BOOL
*b
, UINT count
)
1946 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1947 ID3DXBaseEffect
*base
= This
->base_effect
;
1949 TRACE("Forward iface %p, base %p\n", This
, base
);
1951 return ID3DXBaseEffectImpl_SetBoolArray(base
, parameter
, b
, count
);
1954 static HRESULT WINAPI
ID3DXEffectImpl_GetBoolArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
, UINT count
)
1956 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1957 ID3DXBaseEffect
*base
= This
->base_effect
;
1959 TRACE("Forward iface %p, base %p\n", This
, base
);
1961 return ID3DXBaseEffectImpl_GetBoolArray(base
, parameter
, b
, count
);
1964 static HRESULT WINAPI
ID3DXEffectImpl_SetInt(ID3DXEffect
*iface
, D3DXHANDLE parameter
, INT n
)
1966 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1967 ID3DXBaseEffect
*base
= This
->base_effect
;
1969 TRACE("Forward iface %p, base %p\n", This
, base
);
1971 return ID3DXBaseEffectImpl_SetInt(base
, parameter
, n
);
1974 static HRESULT WINAPI
ID3DXEffectImpl_GetInt(ID3DXEffect
*iface
, D3DXHANDLE parameter
, INT
*n
)
1976 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1977 ID3DXBaseEffect
*base
= This
->base_effect
;
1979 TRACE("Forward iface %p, base %p\n", This
, base
);
1981 return ID3DXBaseEffectImpl_GetInt(base
, parameter
, n
);
1984 static HRESULT WINAPI
ID3DXEffectImpl_SetIntArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST INT
*n
, UINT count
)
1986 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1987 ID3DXBaseEffect
*base
= This
->base_effect
;
1989 TRACE("Forward iface %p, base %p\n", This
, base
);
1991 return ID3DXBaseEffectImpl_SetIntArray(base
, parameter
, n
, count
);
1994 static HRESULT WINAPI
ID3DXEffectImpl_GetIntArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, INT
*n
, UINT count
)
1996 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
1997 ID3DXBaseEffect
*base
= This
->base_effect
;
1999 TRACE("Forward iface %p, base %p\n", This
, base
);
2001 return ID3DXBaseEffectImpl_GetIntArray(base
, parameter
, n
, count
);
2004 static HRESULT WINAPI
ID3DXEffectImpl_SetFloat(ID3DXEffect
*iface
, D3DXHANDLE parameter
, FLOAT f
)
2006 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2007 ID3DXBaseEffect
*base
= This
->base_effect
;
2009 TRACE("Forward iface %p, base %p\n", This
, base
);
2011 return ID3DXBaseEffectImpl_SetFloat(base
, parameter
, f
);
2014 static HRESULT WINAPI
ID3DXEffectImpl_GetFloat(ID3DXEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
)
2016 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2017 ID3DXBaseEffect
*base
= This
->base_effect
;
2019 TRACE("Forward iface %p, base %p\n", This
, base
);
2021 return ID3DXBaseEffectImpl_GetFloat(base
, parameter
, f
);
2024 static HRESULT WINAPI
ID3DXEffectImpl_SetFloatArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST FLOAT
*f
, UINT count
)
2026 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2027 ID3DXBaseEffect
*base
= This
->base_effect
;
2029 TRACE("Forward iface %p, base %p\n", This
, base
);
2031 return ID3DXBaseEffectImpl_SetFloatArray(base
, parameter
, f
, count
);
2034 static HRESULT WINAPI
ID3DXEffectImpl_GetFloatArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
, UINT count
)
2036 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2037 ID3DXBaseEffect
*base
= This
->base_effect
;
2039 TRACE("Forward iface %p, base %p\n", This
, base
);
2041 return ID3DXBaseEffectImpl_GetFloatArray(base
, parameter
, f
, count
);
2044 static HRESULT WINAPI
ID3DXEffectImpl_SetVector(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
)
2046 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2047 ID3DXBaseEffect
*base
= This
->base_effect
;
2049 TRACE("Forward iface %p, base %p\n", This
, base
);
2051 return ID3DXBaseEffectImpl_SetVector(base
, parameter
, vector
);
2054 static HRESULT WINAPI
ID3DXEffectImpl_GetVector(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
)
2056 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2057 ID3DXBaseEffect
*base
= This
->base_effect
;
2059 TRACE("Forward iface %p, base %p\n", This
, base
);
2061 return ID3DXBaseEffectImpl_GetVector(base
, parameter
, vector
);
2064 static HRESULT WINAPI
ID3DXEffectImpl_SetVectorArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
, UINT count
)
2066 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2067 ID3DXBaseEffect
*base
= This
->base_effect
;
2069 TRACE("Forward iface %p, base %p\n", This
, base
);
2071 return ID3DXBaseEffectImpl_SetVectorArray(base
, parameter
, vector
, count
);
2074 static HRESULT WINAPI
ID3DXEffectImpl_GetVectorArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
, UINT count
)
2076 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2077 ID3DXBaseEffect
*base
= This
->base_effect
;
2079 TRACE("Forward iface %p, base %p\n", This
, base
);
2081 return ID3DXBaseEffectImpl_GetVectorArray(base
, parameter
, vector
, count
);
2084 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrix(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
2086 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2087 ID3DXBaseEffect
*base
= This
->base_effect
;
2089 TRACE("Forward iface %p, base %p\n", This
, base
);
2091 return ID3DXBaseEffectImpl_SetMatrix(base
, parameter
, matrix
);
2094 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrix(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
2096 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2097 ID3DXBaseEffect
*base
= This
->base_effect
;
2099 TRACE("Forward iface %p, base %p\n", This
, base
);
2101 return ID3DXBaseEffectImpl_GetMatrix(base
, parameter
, matrix
);
2104 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
2106 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2107 ID3DXBaseEffect
*base
= This
->base_effect
;
2109 TRACE("Forward iface %p, base %p\n", This
, base
);
2111 return ID3DXBaseEffectImpl_SetMatrixArray(base
, parameter
, matrix
, count
);
2114 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
2116 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2117 ID3DXBaseEffect
*base
= This
->base_effect
;
2119 TRACE("Forward iface %p, base %p\n", This
, base
);
2121 return ID3DXBaseEffectImpl_GetMatrixArray(base
, parameter
, matrix
, count
);
2124 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
2126 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2127 ID3DXBaseEffect
*base
= This
->base_effect
;
2129 TRACE("Forward iface %p, base %p\n", This
, base
);
2131 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base
, parameter
, matrix
, count
);
2134 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
2136 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2137 ID3DXBaseEffect
*base
= This
->base_effect
;
2139 TRACE("Forward iface %p, base %p\n", This
, base
);
2141 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base
, parameter
, matrix
, count
);
2144 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
2146 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2147 ID3DXBaseEffect
*base
= This
->base_effect
;
2149 TRACE("Forward iface %p, base %p\n", This
, base
);
2151 return ID3DXBaseEffectImpl_SetMatrixTranspose(base
, parameter
, matrix
);
2154 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
2156 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2157 ID3DXBaseEffect
*base
= This
->base_effect
;
2159 TRACE("Forward iface %p, base %p\n", This
, base
);
2161 return ID3DXBaseEffectImpl_GetMatrixTranspose(base
, parameter
, matrix
);
2164 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
2166 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2167 ID3DXBaseEffect
*base
= This
->base_effect
;
2169 TRACE("Forward iface %p, base %p\n", This
, base
);
2171 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base
, parameter
, matrix
, count
);
2174 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
2176 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2177 ID3DXBaseEffect
*base
= This
->base_effect
;
2179 TRACE("Forward iface %p, base %p\n", This
, base
);
2181 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base
, parameter
, matrix
, count
);
2184 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
2186 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2187 ID3DXBaseEffect
*base
= This
->base_effect
;
2189 TRACE("Forward iface %p, base %p\n", This
, base
);
2191 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
2194 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
2196 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2197 ID3DXBaseEffect
*base
= This
->base_effect
;
2199 TRACE("Forward iface %p, base %p\n", This
, base
);
2201 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
2204 static HRESULT WINAPI
ID3DXEffectImpl_SetString(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR string
)
2206 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2207 ID3DXBaseEffect
*base
= This
->base_effect
;
2209 TRACE("Forward iface %p, base %p\n", This
, base
);
2211 return ID3DXBaseEffectImpl_SetString(base
, parameter
, string
);
2214 static HRESULT WINAPI
ID3DXEffectImpl_GetString(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR
*string
)
2216 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2217 ID3DXBaseEffect
*base
= This
->base_effect
;
2219 TRACE("Forward iface %p, base %p\n", This
, base
);
2221 return ID3DXBaseEffectImpl_GetString(base
, parameter
, string
);
2224 static HRESULT WINAPI
ID3DXEffectImpl_SetTexture(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9 texture
)
2226 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2227 ID3DXBaseEffect
*base
= This
->base_effect
;
2229 TRACE("Forward iface %p, base %p\n", This
, base
);
2231 return ID3DXBaseEffectImpl_SetTexture(base
, parameter
, texture
);
2234 static HRESULT WINAPI
ID3DXEffectImpl_GetTexture(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9
*texture
)
2236 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2237 ID3DXBaseEffect
*base
= This
->base_effect
;
2239 TRACE("Forward iface %p, base %p\n", This
, base
);
2241 return ID3DXBaseEffectImpl_GetTexture(base
, parameter
, texture
);
2244 static HRESULT WINAPI
ID3DXEffectImpl_GetPixelShader(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DPIXELSHADER9
*pshader
)
2246 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2247 ID3DXBaseEffect
*base
= This
->base_effect
;
2249 TRACE("Forward iface %p, base %p\n", This
, base
);
2251 return ID3DXBaseEffectImpl_GetPixelShader(base
, parameter
, pshader
);
2254 static HRESULT WINAPI
ID3DXEffectImpl_GetVertexShader(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DVERTEXSHADER9
*vshader
)
2256 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2257 ID3DXBaseEffect
*base
= This
->base_effect
;
2259 TRACE("Forward iface %p, base %p\n", This
, base
);
2261 return ID3DXBaseEffectImpl_GetVertexShader(base
, parameter
, vshader
);
2264 static HRESULT WINAPI
ID3DXEffectImpl_SetArrayRange(ID3DXEffect
*iface
, D3DXHANDLE parameter
, UINT start
, UINT end
)
2266 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2267 ID3DXBaseEffect
*base
= This
->base_effect
;
2269 TRACE("Forward iface %p, base %p\n", This
, base
);
2271 return ID3DXBaseEffectImpl_SetArrayRange(base
, parameter
, start
, end
);
2274 /*** ID3DXEffect methods ***/
2275 static HRESULT WINAPI
ID3DXEffectImpl_GetPool(ID3DXEffect
*iface
, LPD3DXEFFECTPOOL
*pool
)
2277 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2279 TRACE("iface %p, pool %p\n", This
, pool
);
2283 WARN("Invalid argument supplied.\n");
2284 return D3DERR_INVALIDCALL
;
2289 This
->pool
->lpVtbl
->AddRef(This
->pool
);
2294 TRACE("Returning pool %p\n", *pool
);
2299 static HRESULT WINAPI
ID3DXEffectImpl_SetTechnique(ID3DXEffect
* iface
, D3DXHANDLE technique
)
2301 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2303 FIXME("(%p)->(%p): stub\n", This
, technique
);
2308 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect
* iface
)
2310 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2312 FIXME("(%p)->(): stub\n", This
);
2317 static HRESULT WINAPI
ID3DXEffectImpl_ValidateTechnique(ID3DXEffect
* iface
, D3DXHANDLE technique
)
2319 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2321 FIXME("(%p)->(%p): stub\n", This
, technique
);
2326 static HRESULT WINAPI
ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect
* iface
, D3DXHANDLE technique
, D3DXHANDLE
* next_technique
)
2328 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2330 FIXME("(%p)->(%p, %p): stub\n", This
, technique
, next_technique
);
2335 static BOOL WINAPI
ID3DXEffectImpl_IsParameterUsed(ID3DXEffect
* iface
, D3DXHANDLE parameter
, D3DXHANDLE technique
)
2337 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2339 FIXME("(%p)->(%p, %p): stub\n", This
, parameter
, technique
);
2344 static HRESULT WINAPI
ID3DXEffectImpl_Begin(ID3DXEffect
* iface
, UINT
*passes
, DWORD flags
)
2346 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2348 FIXME("(%p)->(%p, %#x): stub\n", This
, passes
, flags
);
2353 static HRESULT WINAPI
ID3DXEffectImpl_BeginPass(ID3DXEffect
* iface
, UINT pass
)
2355 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2357 FIXME("(%p)->(%u): stub\n", This
, pass
);
2362 static HRESULT WINAPI
ID3DXEffectImpl_CommitChanges(ID3DXEffect
* iface
)
2364 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2366 FIXME("(%p)->(): stub\n", This
);
2371 static HRESULT WINAPI
ID3DXEffectImpl_EndPass(ID3DXEffect
* iface
)
2373 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2375 FIXME("(%p)->(): stub\n", This
);
2380 static HRESULT WINAPI
ID3DXEffectImpl_End(ID3DXEffect
* iface
)
2382 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2384 FIXME("(%p)->(): stub\n", This
);
2389 static HRESULT WINAPI
ID3DXEffectImpl_GetDevice(ID3DXEffect
*iface
, LPDIRECT3DDEVICE9
*device
)
2391 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2393 TRACE("iface %p, device %p\n", This
, device
);
2397 WARN("Invalid argument supplied.\n");
2398 return D3DERR_INVALIDCALL
;
2401 IDirect3DDevice9_AddRef(This
->device
);
2403 *device
= This
->device
;
2405 TRACE("Returning device %p\n", *device
);
2410 static HRESULT WINAPI
ID3DXEffectImpl_OnLostDevice(ID3DXEffect
* iface
)
2412 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2414 FIXME("(%p)->(): stub\n", This
);
2419 static HRESULT WINAPI
ID3DXEffectImpl_OnResetDevice(ID3DXEffect
* iface
)
2421 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2423 FIXME("(%p)->(): stub\n", This
);
2428 static HRESULT WINAPI
ID3DXEffectImpl_SetStateManager(ID3DXEffect
* iface
, LPD3DXEFFECTSTATEMANAGER manager
)
2430 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2432 FIXME("(%p)->(%p): stub\n", This
, manager
);
2437 static HRESULT WINAPI
ID3DXEffectImpl_GetStateManager(ID3DXEffect
* iface
, LPD3DXEFFECTSTATEMANAGER
* manager
)
2439 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2441 FIXME("(%p)->(%p): stub\n", This
, manager
);
2446 static HRESULT WINAPI
ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect
* iface
)
2448 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2450 FIXME("(%p)->(): stub\n", This
);
2455 static D3DXHANDLE WINAPI
ID3DXEffectImpl_EndParameterBlock(ID3DXEffect
* iface
)
2457 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2459 FIXME("(%p)->(): stub\n", This
);
2464 static HRESULT WINAPI
ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect
* iface
, D3DXHANDLE parameter_block
)
2466 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2468 FIXME("(%p)->(%p): stub\n", This
, parameter_block
);
2473 static HRESULT WINAPI
ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect
* iface
, D3DXHANDLE parameter_block
)
2475 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2477 FIXME("(%p)->(%p): stub\n", This
, parameter_block
);
2482 static HRESULT WINAPI
ID3DXEffectImpl_CloneEffect(ID3DXEffect
* iface
, LPDIRECT3DDEVICE9 device
, LPD3DXEFFECT
* effect
)
2484 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2486 FIXME("(%p)->(%p, %p): stub\n", This
, device
, effect
);
2491 static HRESULT WINAPI
ID3DXEffectImpl_SetRawValue(ID3DXEffect
* iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT byte_offset
, UINT bytes
)
2493 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2495 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This
, parameter
, data
, byte_offset
, bytes
);
2500 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl
=
2502 /*** IUnknown methods ***/
2503 ID3DXEffectImpl_QueryInterface
,
2504 ID3DXEffectImpl_AddRef
,
2505 ID3DXEffectImpl_Release
,
2506 /*** ID3DXBaseEffect methods ***/
2507 ID3DXEffectImpl_GetDesc
,
2508 ID3DXEffectImpl_GetParameterDesc
,
2509 ID3DXEffectImpl_GetTechniqueDesc
,
2510 ID3DXEffectImpl_GetPassDesc
,
2511 ID3DXEffectImpl_GetFunctionDesc
,
2512 ID3DXEffectImpl_GetParameter
,
2513 ID3DXEffectImpl_GetParameterByName
,
2514 ID3DXEffectImpl_GetParameterBySemantic
,
2515 ID3DXEffectImpl_GetParameterElement
,
2516 ID3DXEffectImpl_GetTechnique
,
2517 ID3DXEffectImpl_GetTechniqueByName
,
2518 ID3DXEffectImpl_GetPass
,
2519 ID3DXEffectImpl_GetPassByName
,
2520 ID3DXEffectImpl_GetFunction
,
2521 ID3DXEffectImpl_GetFunctionByName
,
2522 ID3DXEffectImpl_GetAnnotation
,
2523 ID3DXEffectImpl_GetAnnotationByName
,
2524 ID3DXEffectImpl_SetValue
,
2525 ID3DXEffectImpl_GetValue
,
2526 ID3DXEffectImpl_SetBool
,
2527 ID3DXEffectImpl_GetBool
,
2528 ID3DXEffectImpl_SetBoolArray
,
2529 ID3DXEffectImpl_GetBoolArray
,
2530 ID3DXEffectImpl_SetInt
,
2531 ID3DXEffectImpl_GetInt
,
2532 ID3DXEffectImpl_SetIntArray
,
2533 ID3DXEffectImpl_GetIntArray
,
2534 ID3DXEffectImpl_SetFloat
,
2535 ID3DXEffectImpl_GetFloat
,
2536 ID3DXEffectImpl_SetFloatArray
,
2537 ID3DXEffectImpl_GetFloatArray
,
2538 ID3DXEffectImpl_SetVector
,
2539 ID3DXEffectImpl_GetVector
,
2540 ID3DXEffectImpl_SetVectorArray
,
2541 ID3DXEffectImpl_GetVectorArray
,
2542 ID3DXEffectImpl_SetMatrix
,
2543 ID3DXEffectImpl_GetMatrix
,
2544 ID3DXEffectImpl_SetMatrixArray
,
2545 ID3DXEffectImpl_GetMatrixArray
,
2546 ID3DXEffectImpl_SetMatrixPointerArray
,
2547 ID3DXEffectImpl_GetMatrixPointerArray
,
2548 ID3DXEffectImpl_SetMatrixTranspose
,
2549 ID3DXEffectImpl_GetMatrixTranspose
,
2550 ID3DXEffectImpl_SetMatrixTransposeArray
,
2551 ID3DXEffectImpl_GetMatrixTransposeArray
,
2552 ID3DXEffectImpl_SetMatrixTransposePointerArray
,
2553 ID3DXEffectImpl_GetMatrixTransposePointerArray
,
2554 ID3DXEffectImpl_SetString
,
2555 ID3DXEffectImpl_GetString
,
2556 ID3DXEffectImpl_SetTexture
,
2557 ID3DXEffectImpl_GetTexture
,
2558 ID3DXEffectImpl_GetPixelShader
,
2559 ID3DXEffectImpl_GetVertexShader
,
2560 ID3DXEffectImpl_SetArrayRange
,
2561 /*** ID3DXEffect methods ***/
2562 ID3DXEffectImpl_GetPool
,
2563 ID3DXEffectImpl_SetTechnique
,
2564 ID3DXEffectImpl_GetCurrentTechnique
,
2565 ID3DXEffectImpl_ValidateTechnique
,
2566 ID3DXEffectImpl_FindNextValidTechnique
,
2567 ID3DXEffectImpl_IsParameterUsed
,
2568 ID3DXEffectImpl_Begin
,
2569 ID3DXEffectImpl_BeginPass
,
2570 ID3DXEffectImpl_CommitChanges
,
2571 ID3DXEffectImpl_EndPass
,
2572 ID3DXEffectImpl_End
,
2573 ID3DXEffectImpl_GetDevice
,
2574 ID3DXEffectImpl_OnLostDevice
,
2575 ID3DXEffectImpl_OnResetDevice
,
2576 ID3DXEffectImpl_SetStateManager
,
2577 ID3DXEffectImpl_GetStateManager
,
2578 ID3DXEffectImpl_BeginParameterBlock
,
2579 ID3DXEffectImpl_EndParameterBlock
,
2580 ID3DXEffectImpl_ApplyParameterBlock
,
2581 ID3DXEffectImpl_DeleteParameterBlock
,
2582 ID3DXEffectImpl_CloneEffect
,
2583 ID3DXEffectImpl_SetRawValue
2586 static inline struct ID3DXEffectCompilerImpl
*impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler
*iface
)
2588 return CONTAINING_RECORD(iface
, struct ID3DXEffectCompilerImpl
, ID3DXEffectCompiler_iface
);
2591 /*** IUnknown methods ***/
2592 static HRESULT WINAPI
ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler
*iface
, REFIID riid
, void **object
)
2594 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2596 TRACE("iface %p, riid %s, object %p\n", This
, debugstr_guid(riid
), object
);
2598 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
2599 IsEqualGUID(riid
, &IID_ID3DXEffectCompiler
))
2601 This
->ID3DXEffectCompiler_iface
.lpVtbl
->AddRef(iface
);
2606 ERR("Interface %s not found\n", debugstr_guid(riid
));
2608 return E_NOINTERFACE
;
2611 static ULONG WINAPI
ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler
*iface
)
2613 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2615 TRACE("iface %p: AddRef from %u\n", iface
, This
->ref
);
2617 return InterlockedIncrement(&This
->ref
);
2620 static ULONG WINAPI
ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler
*iface
)
2622 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2623 ULONG ref
= InterlockedDecrement(&This
->ref
);
2625 TRACE("iface %p: Release from %u\n", iface
, ref
+ 1);
2629 free_effect_compiler(This
);
2630 HeapFree(GetProcessHeap(), 0, This
);
2636 /*** ID3DXBaseEffect methods ***/
2637 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler
*iface
, D3DXEFFECT_DESC
*desc
)
2639 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2640 ID3DXBaseEffect
*base
= This
->base_effect
;
2642 TRACE("Forward iface %p, base %p\n", This
, base
);
2644 return ID3DXBaseEffectImpl_GetDesc(base
, desc
);
2647 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXPARAMETER_DESC
*desc
)
2649 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2650 ID3DXBaseEffect
*base
= This
->base_effect
;
2652 TRACE("Forward iface %p, base %p\n", This
, base
);
2654 return ID3DXBaseEffectImpl_GetParameterDesc(base
, parameter
, desc
);
2657 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE technique
, D3DXTECHNIQUE_DESC
*desc
)
2659 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2660 ID3DXBaseEffect
*base
= This
->base_effect
;
2662 TRACE("Forward iface %p, base %p\n", This
, base
);
2664 return ID3DXBaseEffectImpl_GetTechniqueDesc(base
, technique
, desc
);
2667 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE pass
, D3DXPASS_DESC
*desc
)
2669 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2670 ID3DXBaseEffect
*base
= This
->base_effect
;
2672 TRACE("Forward iface %p, base %p\n", This
, base
);
2674 return ID3DXBaseEffectImpl_GetPassDesc(base
, pass
, desc
);
2677 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE shader
, D3DXFUNCTION_DESC
*desc
)
2679 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2680 ID3DXBaseEffect
*base
= This
->base_effect
;
2682 TRACE("Forward iface %p, base %p\n", This
, base
);
2684 return ID3DXBaseEffectImpl_GetFunctionDesc(base
, shader
, desc
);
2687 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, UINT index
)
2689 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2690 ID3DXBaseEffect
*base
= This
->base_effect
;
2692 TRACE("Forward iface %p, base %p\n", This
, base
);
2694 return ID3DXBaseEffectImpl_GetParameter(base
, parameter
, index
);
2697 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR name
)
2699 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2700 ID3DXBaseEffect
*base
= This
->base_effect
;
2702 TRACE("Forward iface %p, base %p\n", This
, base
);
2704 return ID3DXBaseEffectImpl_GetParameterByName(base
, parameter
, name
);
2707 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR semantic
)
2709 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2710 ID3DXBaseEffect
*base
= This
->base_effect
;
2712 TRACE("Forward iface %p, base %p\n", This
, base
);
2714 return ID3DXBaseEffectImpl_GetParameterBySemantic(base
, parameter
, semantic
);
2717 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, UINT index
)
2719 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2720 ID3DXBaseEffect
*base
= This
->base_effect
;
2722 TRACE("Forward iface %p, base %p\n", This
, base
);
2724 return ID3DXBaseEffectImpl_GetParameterElement(base
, parameter
, index
);
2727 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler
*iface
, UINT index
)
2729 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2730 ID3DXBaseEffect
*base
= This
->base_effect
;
2732 TRACE("Forward iface %p, base %p\n", This
, base
);
2734 return ID3DXBaseEffectImpl_GetTechnique(base
, index
);
2737 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler
*iface
, LPCSTR name
)
2739 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2740 ID3DXBaseEffect
*base
= This
->base_effect
;
2742 TRACE("Forward iface %p, base %p\n", This
, base
);
2744 return ID3DXBaseEffectImpl_GetTechniqueByName(base
, name
);
2747 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler
*iface
, D3DXHANDLE technique
, UINT index
)
2749 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2750 ID3DXBaseEffect
*base
= This
->base_effect
;
2752 TRACE("Forward iface %p, base %p\n", This
, base
);
2754 return ID3DXBaseEffectImpl_GetPass(base
, technique
, index
);
2757 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler
*iface
, D3DXHANDLE technique
, LPCSTR name
)
2759 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2760 ID3DXBaseEffect
*base
= This
->base_effect
;
2762 TRACE("Forward iface %p, base %p\n", This
, base
);
2764 return ID3DXBaseEffectImpl_GetPassByName(base
, technique
, name
);
2767 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler
*iface
, UINT index
)
2769 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2770 ID3DXBaseEffect
*base
= This
->base_effect
;
2772 TRACE("Forward iface %p, base %p\n", This
, base
);
2774 return ID3DXBaseEffectImpl_GetFunction(base
, index
);
2777 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler
*iface
, LPCSTR name
)
2779 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2780 ID3DXBaseEffect
*base
= This
->base_effect
;
2782 TRACE("Forward iface %p, base %p\n", This
, base
);
2784 return ID3DXBaseEffectImpl_GetFunctionByName(base
, name
);
2787 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler
*iface
, D3DXHANDLE object
, UINT index
)
2789 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2790 ID3DXBaseEffect
*base
= This
->base_effect
;
2792 TRACE("Forward iface %p, base %p\n", This
, base
);
2794 return ID3DXBaseEffectImpl_GetAnnotation(base
, object
, index
);
2797 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler
*iface
, D3DXHANDLE object
, LPCSTR name
)
2799 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2800 ID3DXBaseEffect
*base
= This
->base_effect
;
2802 TRACE("Forward iface %p, base %p\n", This
, base
);
2804 return ID3DXBaseEffectImpl_GetAnnotationByName(base
, object
, name
);
2807 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT bytes
)
2809 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2810 ID3DXBaseEffect
*base
= This
->base_effect
;
2812 TRACE("Forward iface %p, base %p\n", This
, base
);
2814 return ID3DXBaseEffectImpl_SetValue(base
, parameter
, data
, bytes
);
2817 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPVOID data
, UINT bytes
)
2819 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2820 ID3DXBaseEffect
*base
= This
->base_effect
;
2822 TRACE("Forward iface %p, base %p\n", This
, base
);
2824 return ID3DXBaseEffectImpl_GetValue(base
, parameter
, data
, bytes
);
2827 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL b
)
2829 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2830 ID3DXBaseEffect
*base
= This
->base_effect
;
2832 TRACE("Forward iface %p, base %p\n", This
, base
);
2834 return ID3DXBaseEffectImpl_SetBool(base
, parameter
, b
);
2837 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL
*b
)
2839 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2840 ID3DXBaseEffect
*base
= This
->base_effect
;
2842 TRACE("Forward iface %p, base %p\n", This
, base
);
2844 return ID3DXBaseEffectImpl_GetBool(base
, parameter
, b
);
2847 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST BOOL
*b
, UINT count
)
2849 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2850 ID3DXBaseEffect
*base
= This
->base_effect
;
2852 TRACE("Forward iface %p, base %p\n", This
, base
);
2854 return ID3DXBaseEffectImpl_SetBoolArray(base
, parameter
, b
, count
);
2857 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL
*b
, UINT count
)
2859 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2860 ID3DXBaseEffect
*base
= This
->base_effect
;
2862 TRACE("Forward iface %p, base %p\n", This
, base
);
2864 return ID3DXBaseEffectImpl_GetBoolArray(base
, parameter
, b
, count
);
2867 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, INT n
)
2869 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2870 ID3DXBaseEffect
*base
= This
->base_effect
;
2872 TRACE("Forward iface %p, base %p\n", This
, base
);
2874 return ID3DXBaseEffectImpl_SetInt(base
, parameter
, n
);
2877 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, INT
*n
)
2879 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2880 ID3DXBaseEffect
*base
= This
->base_effect
;
2882 TRACE("Forward iface %p, base %p\n", This
, base
);
2884 return ID3DXBaseEffectImpl_GetInt(base
, parameter
, n
);
2887 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST INT
*n
, UINT count
)
2889 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2890 ID3DXBaseEffect
*base
= This
->base_effect
;
2892 TRACE("Forward iface %p, base %p\n", This
, base
);
2894 return ID3DXBaseEffectImpl_SetIntArray(base
, parameter
, n
, count
);
2897 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, INT
*n
, UINT count
)
2899 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2900 ID3DXBaseEffect
*base
= This
->base_effect
;
2902 TRACE("Forward iface %p, base %p\n", This
, base
);
2904 return ID3DXBaseEffectImpl_GetIntArray(base
, parameter
, n
, count
);
2907 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, FLOAT f
)
2909 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2910 ID3DXBaseEffect
*base
= This
->base_effect
;
2912 TRACE("Forward iface %p, base %p\n", This
, base
);
2914 return ID3DXBaseEffectImpl_SetFloat(base
, parameter
, f
);
2917 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, FLOAT
*f
)
2919 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2920 ID3DXBaseEffect
*base
= This
->base_effect
;
2922 TRACE("Forward iface %p, base %p\n", This
, base
);
2924 return ID3DXBaseEffectImpl_GetFloat(base
, parameter
, f
);
2927 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST FLOAT
*f
, UINT count
)
2929 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2930 ID3DXBaseEffect
*base
= This
->base_effect
;
2932 TRACE("Forward iface %p, base %p\n", This
, base
);
2934 return ID3DXBaseEffectImpl_SetFloatArray(base
, parameter
, f
, count
);
2937 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, FLOAT
*f
, UINT count
)
2939 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2940 ID3DXBaseEffect
*base
= This
->base_effect
;
2942 TRACE("Forward iface %p, base %p\n", This
, base
);
2944 return ID3DXBaseEffectImpl_GetFloatArray(base
, parameter
, f
, count
);
2947 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
)
2949 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2950 ID3DXBaseEffect
*base
= This
->base_effect
;
2952 TRACE("Forward iface %p, base %p\n", This
, base
);
2954 return ID3DXBaseEffectImpl_SetVector(base
, parameter
, vector
);
2957 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
)
2959 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2960 ID3DXBaseEffect
*base
= This
->base_effect
;
2962 TRACE("Forward iface %p, base %p\n", This
, base
);
2964 return ID3DXBaseEffectImpl_GetVector(base
, parameter
, vector
);
2967 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
, UINT count
)
2969 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2970 ID3DXBaseEffect
*base
= This
->base_effect
;
2972 TRACE("Forward iface %p, base %p\n", This
, base
);
2974 return ID3DXBaseEffectImpl_SetVectorArray(base
, parameter
, vector
, count
);
2977 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
, UINT count
)
2979 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2980 ID3DXBaseEffect
*base
= This
->base_effect
;
2982 TRACE("Forward iface %p, base %p\n", This
, base
);
2984 return ID3DXBaseEffectImpl_GetVectorArray(base
, parameter
, vector
, count
);
2987 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
2989 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
2990 ID3DXBaseEffect
*base
= This
->base_effect
;
2992 TRACE("Forward iface %p, base %p\n", This
, base
);
2994 return ID3DXBaseEffectImpl_SetMatrix(base
, parameter
, matrix
);
2997 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
2999 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3000 ID3DXBaseEffect
*base
= This
->base_effect
;
3002 TRACE("Forward iface %p, base %p\n", This
, base
);
3004 return ID3DXBaseEffectImpl_GetMatrix(base
, parameter
, matrix
);
3007 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
3009 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3010 ID3DXBaseEffect
*base
= This
->base_effect
;
3012 TRACE("Forward iface %p, base %p\n", This
, base
);
3014 return ID3DXBaseEffectImpl_SetMatrixArray(base
, parameter
, matrix
, count
);
3017 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
3019 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3020 ID3DXBaseEffect
*base
= This
->base_effect
;
3022 TRACE("Forward iface %p, base %p\n", This
, base
);
3024 return ID3DXBaseEffectImpl_GetMatrixArray(base
, parameter
, matrix
, count
);
3027 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
3029 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3030 ID3DXBaseEffect
*base
= This
->base_effect
;
3032 TRACE("Forward iface %p, base %p\n", This
, base
);
3034 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base
, parameter
, matrix
, count
);
3037 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
3039 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3040 ID3DXBaseEffect
*base
= This
->base_effect
;
3042 TRACE("Forward iface %p, base %p\n", This
, base
);
3044 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base
, parameter
, matrix
, count
);
3047 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
3049 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3050 ID3DXBaseEffect
*base
= This
->base_effect
;
3052 TRACE("Forward iface %p, base %p\n", This
, base
);
3054 return ID3DXBaseEffectImpl_SetMatrixTranspose(base
, parameter
, matrix
);
3057 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
3059 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3060 ID3DXBaseEffect
*base
= This
->base_effect
;
3062 TRACE("Forward iface %p, base %p\n", This
, base
);
3064 return ID3DXBaseEffectImpl_GetMatrixTranspose(base
, parameter
, matrix
);
3067 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
3069 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3070 ID3DXBaseEffect
*base
= This
->base_effect
;
3072 TRACE("Forward iface %p, base %p\n", This
, base
);
3074 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base
, parameter
, matrix
, count
);
3077 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
3079 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3080 ID3DXBaseEffect
*base
= This
->base_effect
;
3082 TRACE("Forward iface %p, base %p\n", This
, base
);
3084 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base
, parameter
, matrix
, count
);
3087 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
3089 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3090 ID3DXBaseEffect
*base
= This
->base_effect
;
3092 TRACE("Forward iface %p, base %p\n", This
, base
);
3094 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
3097 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
3099 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3100 ID3DXBaseEffect
*base
= This
->base_effect
;
3102 TRACE("Forward iface %p, base %p\n", This
, base
);
3104 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
3107 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR string
)
3109 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3110 ID3DXBaseEffect
*base
= This
->base_effect
;
3112 TRACE("Forward iface %p, base %p\n", This
, base
);
3114 return ID3DXBaseEffectImpl_SetString(base
, parameter
, string
);
3117 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR
*string
)
3119 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3120 ID3DXBaseEffect
*base
= This
->base_effect
;
3122 TRACE("Forward iface %p, base %p\n", This
, base
);
3124 return ID3DXBaseEffectImpl_GetString(base
, parameter
, string
);
3127 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9 texture
)
3129 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3130 ID3DXBaseEffect
*base
= This
->base_effect
;
3132 TRACE("Forward iface %p, base %p\n", This
, base
);
3134 return ID3DXBaseEffectImpl_SetTexture(base
, parameter
, texture
);
3137 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9
*texture
)
3139 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3140 ID3DXBaseEffect
*base
= This
->base_effect
;
3142 TRACE("Forward iface %p, base %p\n", This
, base
);
3144 return ID3DXBaseEffectImpl_GetTexture(base
, parameter
, texture
);
3147 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DPIXELSHADER9
*pshader
)
3149 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3150 ID3DXBaseEffect
*base
= This
->base_effect
;
3152 TRACE("Forward iface %p, base %p\n", This
, base
);
3154 return ID3DXBaseEffectImpl_GetPixelShader(base
, parameter
, pshader
);
3157 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DVERTEXSHADER9
*vshader
)
3159 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3160 ID3DXBaseEffect
*base
= This
->base_effect
;
3162 TRACE("Forward iface %p, base %p\n", This
, base
);
3164 return ID3DXBaseEffectImpl_GetVertexShader(base
, parameter
, vshader
);
3167 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, UINT start
, UINT end
)
3169 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3170 ID3DXBaseEffect
*base
= This
->base_effect
;
3172 TRACE("Forward iface %p, base %p\n", This
, base
);
3174 return ID3DXBaseEffectImpl_SetArrayRange(base
, parameter
, start
, end
);
3177 /*** ID3DXEffectCompiler methods ***/
3178 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL literal
)
3180 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3182 FIXME("iface %p, parameter %p, literal %u\n", This
, parameter
, literal
);
3187 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL
*literal
)
3189 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3191 FIXME("iface %p, parameter %p, literal %p\n", This
, parameter
, literal
);
3196 static HRESULT WINAPI
ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler
*iface
, DWORD flags
,
3197 LPD3DXBUFFER
*effect
, LPD3DXBUFFER
*error_msgs
)
3199 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3201 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This
, flags
, effect
, error_msgs
);
3206 static HRESULT WINAPI
ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler
*iface
, D3DXHANDLE function
,
3207 LPCSTR target
, DWORD flags
, LPD3DXBUFFER
*shader
, LPD3DXBUFFER
*error_msgs
, LPD3DXCONSTANTTABLE
*constant_table
)
3209 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3211 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3212 This
, function
, target
, flags
, shader
, error_msgs
, constant_table
);
3217 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl
=
3219 /*** IUnknown methods ***/
3220 ID3DXEffectCompilerImpl_QueryInterface
,
3221 ID3DXEffectCompilerImpl_AddRef
,
3222 ID3DXEffectCompilerImpl_Release
,
3223 /*** ID3DXBaseEffect methods ***/
3224 ID3DXEffectCompilerImpl_GetDesc
,
3225 ID3DXEffectCompilerImpl_GetParameterDesc
,
3226 ID3DXEffectCompilerImpl_GetTechniqueDesc
,
3227 ID3DXEffectCompilerImpl_GetPassDesc
,
3228 ID3DXEffectCompilerImpl_GetFunctionDesc
,
3229 ID3DXEffectCompilerImpl_GetParameter
,
3230 ID3DXEffectCompilerImpl_GetParameterByName
,
3231 ID3DXEffectCompilerImpl_GetParameterBySemantic
,
3232 ID3DXEffectCompilerImpl_GetParameterElement
,
3233 ID3DXEffectCompilerImpl_GetTechnique
,
3234 ID3DXEffectCompilerImpl_GetTechniqueByName
,
3235 ID3DXEffectCompilerImpl_GetPass
,
3236 ID3DXEffectCompilerImpl_GetPassByName
,
3237 ID3DXEffectCompilerImpl_GetFunction
,
3238 ID3DXEffectCompilerImpl_GetFunctionByName
,
3239 ID3DXEffectCompilerImpl_GetAnnotation
,
3240 ID3DXEffectCompilerImpl_GetAnnotationByName
,
3241 ID3DXEffectCompilerImpl_SetValue
,
3242 ID3DXEffectCompilerImpl_GetValue
,
3243 ID3DXEffectCompilerImpl_SetBool
,
3244 ID3DXEffectCompilerImpl_GetBool
,
3245 ID3DXEffectCompilerImpl_SetBoolArray
,
3246 ID3DXEffectCompilerImpl_GetBoolArray
,
3247 ID3DXEffectCompilerImpl_SetInt
,
3248 ID3DXEffectCompilerImpl_GetInt
,
3249 ID3DXEffectCompilerImpl_SetIntArray
,
3250 ID3DXEffectCompilerImpl_GetIntArray
,
3251 ID3DXEffectCompilerImpl_SetFloat
,
3252 ID3DXEffectCompilerImpl_GetFloat
,
3253 ID3DXEffectCompilerImpl_SetFloatArray
,
3254 ID3DXEffectCompilerImpl_GetFloatArray
,
3255 ID3DXEffectCompilerImpl_SetVector
,
3256 ID3DXEffectCompilerImpl_GetVector
,
3257 ID3DXEffectCompilerImpl_SetVectorArray
,
3258 ID3DXEffectCompilerImpl_GetVectorArray
,
3259 ID3DXEffectCompilerImpl_SetMatrix
,
3260 ID3DXEffectCompilerImpl_GetMatrix
,
3261 ID3DXEffectCompilerImpl_SetMatrixArray
,
3262 ID3DXEffectCompilerImpl_GetMatrixArray
,
3263 ID3DXEffectCompilerImpl_SetMatrixPointerArray
,
3264 ID3DXEffectCompilerImpl_GetMatrixPointerArray
,
3265 ID3DXEffectCompilerImpl_SetMatrixTranspose
,
3266 ID3DXEffectCompilerImpl_GetMatrixTranspose
,
3267 ID3DXEffectCompilerImpl_SetMatrixTransposeArray
,
3268 ID3DXEffectCompilerImpl_GetMatrixTransposeArray
,
3269 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray
,
3270 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray
,
3271 ID3DXEffectCompilerImpl_SetString
,
3272 ID3DXEffectCompilerImpl_GetString
,
3273 ID3DXEffectCompilerImpl_SetTexture
,
3274 ID3DXEffectCompilerImpl_GetTexture
,
3275 ID3DXEffectCompilerImpl_GetPixelShader
,
3276 ID3DXEffectCompilerImpl_GetVertexShader
,
3277 ID3DXEffectCompilerImpl_SetArrayRange
,
3278 /*** ID3DXEffectCompiler methods ***/
3279 ID3DXEffectCompilerImpl_SetLiteral
,
3280 ID3DXEffectCompilerImpl_GetLiteral
,
3281 ID3DXEffectCompilerImpl_CompileEffect
,
3282 ID3DXEffectCompilerImpl_CompileShader
,
3285 static HRESULT
d3dx9_parse_value(struct d3dx_parameter
*param
, void *value
, const char **ptr
)
3292 if (param
->element_count
)
3294 param
->data
= value
;
3296 for (i
= 0; i
< param
->element_count
; ++i
)
3298 struct d3dx_parameter
*member
= get_parameter_struct(param
->member_handles
[i
]);
3300 hr
= d3dx9_parse_value(member
, (char *)value
+ old_size
, ptr
);
3303 WARN("Failed to parse value\n");
3307 old_size
+= member
->bytes
;
3313 switch(param
->class)
3317 case D3DXPC_MATRIX_ROWS
:
3318 case D3DXPC_MATRIX_COLUMNS
:
3319 param
->data
= value
;
3323 param
->data
= value
;
3325 for (i
= 0; i
< param
->member_count
; ++i
)
3327 struct d3dx_parameter
*member
= get_parameter_struct(param
->member_handles
[i
]);
3329 hr
= d3dx9_parse_value(member
, (char *)value
+ old_size
, ptr
);
3332 WARN("Failed to parse value\n");
3336 old_size
+= member
->bytes
;
3341 switch (param
->type
)
3344 case D3DXPT_PIXELSHADER
:
3345 case D3DXPT_VERTEXSHADER
:
3346 read_dword(ptr
, &id
);
3347 TRACE("Id: %u\n", id
);
3348 param
->base
->objects
[id
] = get_parameter_handle(param
);
3349 param
->data
= value
;
3353 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
3359 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
3366 static HRESULT
d3dx9_parse_init_value(struct d3dx_parameter
*param
, const char *ptr
)
3368 UINT size
= param
->bytes
;
3372 TRACE("param size: %u\n", size
);
3374 value
= HeapAlloc(GetProcessHeap(), 0, size
);
3377 ERR("Failed to allocate data memory.\n");
3378 return E_OUTOFMEMORY
;
3381 TRACE("Data: %s.\n", debugstr_an(ptr
, size
));
3382 memcpy(value
, ptr
, size
);
3384 hr
= d3dx9_parse_value(param
, value
, &ptr
);
3387 WARN("Failed to parse value\n");
3388 HeapFree(GetProcessHeap(), 0, value
);
3392 param
->data
= value
;
3397 static HRESULT
d3dx9_parse_name(char **name
, const char *ptr
)
3401 read_dword(&ptr
, &size
);
3402 TRACE("Name size: %#x\n", size
);
3409 *name
= HeapAlloc(GetProcessHeap(), 0, size
);
3412 ERR("Failed to allocate name memory.\n");
3413 return E_OUTOFMEMORY
;
3416 TRACE("Name: %s.\n", debugstr_an(ptr
, size
));
3417 memcpy(*name
, ptr
, size
);
3422 static HRESULT
d3dx9_parse_data(struct d3dx_parameter
*param
, const char **ptr
)
3427 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param
->name
), debug_d3dxparameter_type(param
->type
));
3429 read_dword(ptr
, &size
);
3430 TRACE("Data size: %#x\n", size
);
3434 TRACE("Size is 0\n");
3435 *(void **)param
->data
= NULL
;
3439 switch (param
->type
)
3442 /* re-read with size (sizeof(DWORD) = 4) */
3443 hr
= d3dx9_parse_name((LPSTR
*)param
->data
, *ptr
- 4);
3446 WARN("Failed to parse string data\n");
3451 case D3DXPT_VERTEXSHADER
:
3452 hr
= IDirect3DDevice9_CreateVertexShader(param
->base
->effect
->device
, (DWORD
*)*ptr
, (LPDIRECT3DVERTEXSHADER9
*)param
->data
);
3455 WARN("Failed to create vertex shader\n");
3460 case D3DXPT_PIXELSHADER
:
3461 hr
= IDirect3DDevice9_CreatePixelShader(param
->base
->effect
->device
, (DWORD
*)*ptr
, (LPDIRECT3DPIXELSHADER9
*)param
->data
);
3464 WARN("Failed to create pixel shader\n");
3470 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
3475 *ptr
+= ((size
+ 3) & ~3);
3480 static HRESULT
d3dx9_parse_effect_typedef(struct d3dx_parameter
*param
, const char *data
, const char **ptr
,
3481 struct d3dx_parameter
*parent
, UINT flags
)
3485 D3DXHANDLE
*member_handles
= NULL
;
3488 param
->flags
= flags
;
3492 read_dword(ptr
, ¶m
->type
);
3493 TRACE("Type: %s\n", debug_d3dxparameter_type(param
->type
));
3495 read_dword(ptr
, ¶m
->class);
3496 TRACE("Class: %s\n", debug_d3dxparameter_class(param
->class));
3498 read_dword(ptr
, &offset
);
3499 TRACE("Type name offset: %#x\n", offset
);
3500 hr
= d3dx9_parse_name(¶m
->name
, data
+ offset
);
3503 WARN("Failed to parse name\n");
3507 read_dword(ptr
, &offset
);
3508 TRACE("Type semantic offset: %#x\n", offset
);
3509 hr
= d3dx9_parse_name(¶m
->semantic
, data
+ offset
);
3512 WARN("Failed to parse semantic\n");
3516 read_dword(ptr
, ¶m
->element_count
);
3517 TRACE("Elements: %u\n", param
->element_count
);
3519 switch (param
->class)
3522 read_dword(ptr
, ¶m
->columns
);
3523 TRACE("Columns: %u\n", param
->columns
);
3525 read_dword(ptr
, ¶m
->rows
);
3526 TRACE("Rows: %u\n", param
->rows
);
3528 /* sizeof(DWORD) * rows * columns */
3529 param
->bytes
= 4 * param
->rows
* param
->columns
;
3533 case D3DXPC_MATRIX_ROWS
:
3534 case D3DXPC_MATRIX_COLUMNS
:
3535 read_dword(ptr
, ¶m
->rows
);
3536 TRACE("Rows: %u\n", param
->rows
);
3538 read_dword(ptr
, ¶m
->columns
);
3539 TRACE("Columns: %u\n", param
->columns
);
3541 /* sizeof(DWORD) * rows * columns */
3542 param
->bytes
= 4 * param
->rows
* param
->columns
;
3546 read_dword(ptr
, ¶m
->member_count
);
3547 TRACE("Members: %u\n", param
->member_count
);
3551 switch (param
->type
)
3554 param
->bytes
= sizeof(LPCSTR
);
3557 case D3DXPT_PIXELSHADER
:
3558 param
->bytes
= sizeof(LPDIRECT3DPIXELSHADER9
);
3561 case D3DXPT_VERTEXSHADER
:
3562 param
->bytes
= sizeof(LPDIRECT3DVERTEXSHADER9
);
3566 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
3572 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
3579 param
->type
= parent
->type
;
3580 param
->class = parent
->class;
3581 param
->name
= parent
->name
;
3582 param
->semantic
= parent
->semantic
;
3583 param
->element_count
= 0;
3584 param
->annotation_count
= 0;
3585 param
->member_count
= parent
->member_count
;
3586 param
->bytes
= parent
->bytes
;
3587 param
->rows
= parent
->rows
;
3588 param
->columns
= parent
->columns
;
3591 if (param
->element_count
)
3593 unsigned int param_bytes
= 0;
3594 const char *save_ptr
= *ptr
;
3596 member_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member_handles
) * param
->element_count
);
3597 if (!member_handles
)
3599 ERR("Out of memory\n");
3604 for (i
= 0; i
< param
->element_count
; ++i
)
3606 struct d3dx_parameter
*member
;
3609 member
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member
));
3612 ERR("Out of memory\n");
3617 member_handles
[i
] = get_parameter_handle(member
);
3618 member
->base
= param
->base
;
3620 hr
= d3dx9_parse_effect_typedef(member
, data
, ptr
, param
, flags
);
3623 WARN("Failed to parse member\n");
3627 param_bytes
+= member
->bytes
;
3630 param
->bytes
= param_bytes
;
3632 else if (param
->member_count
)
3634 member_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member_handles
) * param
->member_count
);
3635 if (!member_handles
)
3637 ERR("Out of memory\n");
3642 for (i
= 0; i
< param
->member_count
; ++i
)
3644 struct d3dx_parameter
*member
;
3646 member
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member
));
3649 ERR("Out of memory\n");
3654 member_handles
[i
] = get_parameter_handle(member
);
3655 member
->base
= param
->base
;
3657 hr
= d3dx9_parse_effect_typedef(member
, data
, ptr
, NULL
, flags
);
3660 WARN("Failed to parse member\n");
3664 param
->bytes
+= member
->bytes
;
3668 param
->member_handles
= member_handles
;
3678 if (param
->element_count
) count
= param
->element_count
;
3679 else count
= param
->member_count
;
3681 for (i
= 0; i
< count
; ++i
)
3683 free_parameter(member_handles
[i
], param
->element_count
!= 0, TRUE
);
3685 HeapFree(GetProcessHeap(), 0, member_handles
);
3690 HeapFree(GetProcessHeap(), 0, param
->name
);
3691 HeapFree(GetProcessHeap(), 0, param
->semantic
);
3694 param
->semantic
= NULL
;
3699 static HRESULT
d3dx9_parse_effect_annotation(struct d3dx_parameter
*anno
, const char *data
, const char **ptr
)
3705 anno
->flags
= D3DX_PARAMETER_ANNOTATION
;
3707 read_dword(ptr
, &offset
);
3708 TRACE("Typedef offset: %#x\n", offset
);
3709 ptr2
= data
+ offset
;
3710 hr
= d3dx9_parse_effect_typedef(anno
, data
, &ptr2
, NULL
, D3DX_PARAMETER_ANNOTATION
);
3713 WARN("Failed to parse type definition\n");
3717 read_dword(ptr
, &offset
);
3718 TRACE("Value offset: %#x\n", offset
);
3719 hr
= d3dx9_parse_init_value(anno
, data
+ offset
);
3722 WARN("Failed to parse value\n");
3729 static HRESULT
d3dx9_parse_effect_parameter(struct d3dx_parameter
*param
, const char *data
, const char **ptr
)
3734 D3DXHANDLE
*annotation_handles
= NULL
;
3737 read_dword(ptr
, &offset
);
3738 TRACE("Typedef offset: %#x\n", offset
);
3739 ptr2
= data
+ offset
;
3741 read_dword(ptr
, &offset
);
3742 TRACE("Value offset: %#x\n", offset
);
3744 read_dword(ptr
, ¶m
->flags
);
3745 TRACE("Flags: %#x\n", param
->flags
);
3747 read_dword(ptr
, ¶m
->annotation_count
);
3748 TRACE("Annotation count: %u\n", param
->annotation_count
);
3750 hr
= d3dx9_parse_effect_typedef(param
, data
, &ptr2
, NULL
, param
->flags
);
3753 WARN("Failed to parse type definition\n");
3757 hr
= d3dx9_parse_init_value(param
, data
+ offset
);
3760 WARN("Failed to parse value\n");
3764 if (param
->annotation_count
)
3766 annotation_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation_handles
) * param
->annotation_count
);
3767 if (!annotation_handles
)
3769 ERR("Out of memory\n");
3774 for (i
= 0; i
< param
->annotation_count
; ++i
)
3776 struct d3dx_parameter
*annotation
;
3778 annotation
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation
));
3781 ERR("Out of memory\n");
3786 annotation_handles
[i
] = get_parameter_handle(annotation
);
3787 annotation
->base
= param
->base
;
3789 hr
= d3dx9_parse_effect_annotation(annotation
, data
, ptr
);
3792 WARN("Failed to parse annotation\n");
3798 param
->annotation_handles
= annotation_handles
;
3804 if (annotation_handles
)
3806 for (i
= 0; i
< param
->annotation_count
; ++i
)
3808 free_parameter(annotation_handles
[i
], FALSE
, FALSE
);
3810 HeapFree(GetProcessHeap(), 0, annotation_handles
);
3816 static HRESULT
d3dx9_parse_effect_pass(struct d3dx_pass
*pass
, const char *data
, const char **ptr
)
3821 D3DXHANDLE
*annotation_handles
= NULL
;
3824 read_dword(ptr
, &offset
);
3825 TRACE("Pass name offset: %#x\n", offset
);
3826 hr
= d3dx9_parse_name(&name
, data
+ offset
);
3829 WARN("Failed to parse name\n");
3833 read_dword(ptr
, &pass
->annotation_count
);
3834 TRACE("Annotation count: %u\n", pass
->annotation_count
);
3836 read_dword(ptr
, &pass
->state_count
);
3837 TRACE("State count: %u\n", pass
->state_count
);
3839 if (pass
->annotation_count
)
3841 annotation_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation_handles
) * pass
->annotation_count
);
3842 if (!annotation_handles
)
3844 ERR("Out of memory\n");
3849 for (i
= 0; i
< pass
->annotation_count
; ++i
)
3851 struct d3dx_parameter
*annotation
;
3853 annotation
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation
));
3856 ERR("Out of memory\n");
3861 annotation_handles
[i
] = get_parameter_handle(annotation
);
3862 annotation
->base
= pass
->base
;
3864 hr
= d3dx9_parse_effect_annotation(annotation
, data
, ptr
);
3867 WARN("Failed to parse annotations\n");
3873 if (pass
->state_count
)
3875 for (i
= 0; i
< pass
->state_count
; ++i
)
3877 skip_dword_unknown(ptr
, 4);
3882 pass
->annotation_handles
= annotation_handles
;
3888 if (annotation_handles
)
3890 for (i
= 0; i
< pass
->annotation_count
; ++i
)
3892 free_parameter(annotation_handles
[i
], FALSE
, FALSE
);
3894 HeapFree(GetProcessHeap(), 0, annotation_handles
);
3897 HeapFree(GetProcessHeap(), 0, name
);
3902 static HRESULT
d3dx9_parse_effect_technique(struct d3dx_technique
*technique
, const char *data
, const char **ptr
)
3907 D3DXHANDLE
*annotation_handles
= NULL
;
3908 D3DXHANDLE
*pass_handles
= NULL
;
3911 read_dword(ptr
, &offset
);
3912 TRACE("Technique name offset: %#x\n", offset
);
3913 hr
= d3dx9_parse_name(&name
, data
+ offset
);
3916 WARN("Failed to parse name\n");
3920 read_dword(ptr
, &technique
->annotation_count
);
3921 TRACE("Annotation count: %u\n", technique
->annotation_count
);
3923 read_dword(ptr
, &technique
->pass_count
);
3924 TRACE("Pass count: %u\n", technique
->pass_count
);
3926 if (technique
->annotation_count
)
3928 annotation_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation_handles
) * technique
->annotation_count
);
3929 if (!annotation_handles
)
3931 ERR("Out of memory\n");
3936 for (i
= 0; i
< technique
->annotation_count
; ++i
)
3938 struct d3dx_parameter
*annotation
;
3940 annotation
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation
));
3943 ERR("Out of memory\n");
3948 annotation_handles
[i
] = get_parameter_handle(annotation
);
3949 annotation
->base
= technique
->base
;
3951 hr
= d3dx9_parse_effect_annotation(annotation
, data
, ptr
);
3954 WARN("Failed to parse annotations\n");
3960 if (technique
->pass_count
)
3962 pass_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*pass_handles
) * technique
->pass_count
);
3965 ERR("Out of memory\n");
3970 for (i
= 0; i
< technique
->pass_count
; ++i
)
3972 struct d3dx_pass
*pass
;
3974 pass
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*pass
));
3977 ERR("Out of memory\n");
3982 pass_handles
[i
] = get_pass_handle(pass
);
3983 pass
->base
= technique
->base
;
3985 hr
= d3dx9_parse_effect_pass(pass
, data
, ptr
);
3988 WARN("Failed to parse passes\n");
3994 technique
->name
= name
;
3995 technique
->pass_handles
= pass_handles
;
3996 technique
->annotation_handles
= annotation_handles
;
4004 for (i
= 0; i
< technique
->pass_count
; ++i
)
4006 free_pass(pass_handles
[i
]);
4008 HeapFree(GetProcessHeap(), 0, pass_handles
);
4011 if (annotation_handles
)
4013 for (i
= 0; i
< technique
->annotation_count
; ++i
)
4015 free_parameter(annotation_handles
[i
], FALSE
, FALSE
);
4017 HeapFree(GetProcessHeap(), 0, annotation_handles
);
4020 HeapFree(GetProcessHeap(), 0, name
);
4025 static HRESULT
d3dx9_parse_effect(struct ID3DXBaseEffectImpl
*base
, const char *data
, UINT data_size
, DWORD start
)
4027 const char *ptr
= data
+ start
;
4028 D3DXHANDLE
*parameter_handles
= NULL
;
4029 D3DXHANDLE
*technique_handles
= NULL
;
4030 D3DXHANDLE
*objects
= NULL
;
4031 unsigned int stringcount
;
4035 read_dword(&ptr
, &base
->parameter_count
);
4036 TRACE("Parameter count: %u\n", base
->parameter_count
);
4038 read_dword(&ptr
, &base
->technique_count
);
4039 TRACE("Technique count: %u\n", base
->technique_count
);
4041 skip_dword_unknown(&ptr
, 1);
4043 read_dword(&ptr
, &base
->object_count
);
4044 TRACE("Object count: %u\n", base
->object_count
);
4046 objects
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*objects
) * base
->object_count
);
4049 ERR("Out of memory\n");
4054 base
->objects
= objects
;
4056 if (base
->parameter_count
)
4058 parameter_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*parameter_handles
) * base
->parameter_count
);
4059 if (!parameter_handles
)
4061 ERR("Out of memory\n");
4066 for (i
= 0; i
< base
->parameter_count
; ++i
)
4068 struct d3dx_parameter
*parameter
;
4070 parameter
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*parameter
));
4073 ERR("Out of memory\n");
4078 parameter_handles
[i
] = get_parameter_handle(parameter
);
4079 parameter
->base
= base
;
4081 hr
= d3dx9_parse_effect_parameter(parameter
, data
, &ptr
);
4084 WARN("Failed to parse parameter\n");
4090 if (base
->technique_count
)
4092 technique_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*technique_handles
) * base
->technique_count
);
4093 if (!technique_handles
)
4095 ERR("Out of memory\n");
4100 for (i
= 0; i
< base
->technique_count
; ++i
)
4102 struct d3dx_technique
*technique
;
4104 technique
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*technique
));
4107 ERR("Out of memory\n");
4112 technique_handles
[i
] = get_technique_handle(technique
);
4113 technique
->base
= base
;
4115 hr
= d3dx9_parse_effect_technique(technique
, data
, &ptr
);
4118 WARN("Failed to parse technique\n");
4124 read_dword(&ptr
, &stringcount
);
4125 TRACE("String count: %u\n", stringcount
);
4127 skip_dword_unknown(&ptr
, 1);
4129 for (i
= 0; i
< stringcount
; ++i
)
4132 struct d3dx_parameter
*param
;
4134 read_dword(&ptr
, &id
);
4135 TRACE("Id: %u\n", id
);
4137 param
= get_parameter_struct(base
->objects
[id
]);
4139 hr
= d3dx9_parse_data(param
, &ptr
);
4142 WARN("Failed to parse data\n");
4147 HeapFree(GetProcessHeap(), 0, objects
);
4148 base
->objects
= NULL
;
4150 base
->technique_handles
= technique_handles
;
4151 base
->parameter_handles
= parameter_handles
;
4157 if (technique_handles
)
4159 for (i
= 0; i
< base
->technique_count
; ++i
)
4161 free_technique(technique_handles
[i
]);
4163 HeapFree(GetProcessHeap(), 0, technique_handles
);
4166 if (parameter_handles
)
4168 for (i
= 0; i
< base
->parameter_count
; ++i
)
4170 free_parameter(parameter_handles
[i
], FALSE
, FALSE
);
4172 HeapFree(GetProcessHeap(), 0, parameter_handles
);
4175 HeapFree(GetProcessHeap(), 0, objects
);
4180 static HRESULT
d3dx9_base_effect_init(struct ID3DXBaseEffectImpl
*base
,
4181 const char *data
, SIZE_T data_size
, struct ID3DXEffectImpl
*effect
)
4184 const char *ptr
= data
;
4187 TRACE("base %p, data %p, data_size %lu, effect %p\n", base
, data
, data_size
, effect
);
4189 base
->ID3DXBaseEffect_iface
.lpVtbl
= &ID3DXBaseEffect_Vtbl
;
4191 base
->effect
= effect
;
4193 read_dword(&ptr
, &tag
);
4194 TRACE("Tag: %x\n", tag
);
4196 if (tag
!= d3dx9_effect_version(9, 1))
4198 /* todo: compile hlsl ascii code */
4199 FIXME("HLSL ascii effects not supported, yet\n");
4201 /* Show the start of the shader for debugging info. */
4202 TRACE("effect:\n%s\n", debugstr_an(data
, data_size
> 40 ? 40 : data_size
));
4206 read_dword(&ptr
, &offset
);
4207 TRACE("Offset: %x\n", offset
);
4209 hr
= d3dx9_parse_effect(base
, ptr
, data_size
, offset
);
4212 FIXME("Failed to parse effect.\n");
4220 static HRESULT
d3dx9_effect_init(struct ID3DXEffectImpl
*effect
, LPDIRECT3DDEVICE9 device
,
4221 const char *data
, SIZE_T data_size
, LPD3DXEFFECTPOOL pool
)
4224 struct ID3DXBaseEffectImpl
*object
= NULL
;
4226 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect
, device
, data
, data_size
, pool
);
4228 effect
->ID3DXEffect_iface
.lpVtbl
= &ID3DXEffect_Vtbl
;
4231 if (pool
) pool
->lpVtbl
->AddRef(pool
);
4232 effect
->pool
= pool
;
4234 IDirect3DDevice9_AddRef(device
);
4235 effect
->device
= device
;
4237 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
4240 ERR("Out of memory\n");
4245 hr
= d3dx9_base_effect_init(object
, data
, data_size
, effect
);
4248 FIXME("Failed to parse effect.\n");
4252 effect
->base_effect
= &object
->ID3DXBaseEffect_iface
;
4258 HeapFree(GetProcessHeap(), 0, object
);
4259 free_effect(effect
);
4264 HRESULT WINAPI
D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device
,
4267 CONST D3DXMACRO
* defines
,
4268 LPD3DXINCLUDE include
,
4269 LPCSTR skip_constants
,
4271 LPD3DXEFFECTPOOL pool
,
4272 LPD3DXEFFECT
* effect
,
4273 LPD3DXBUFFER
* compilation_errors
)
4275 struct ID3DXEffectImpl
*object
;
4278 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device
, srcdata
, srcdatalen
, defines
, include
,
4279 skip_constants
, flags
, pool
, effect
, compilation_errors
);
4281 if (!device
|| !srcdata
)
4282 return D3DERR_INVALIDCALL
;
4287 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
4291 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
4294 ERR("Out of memory\n");
4295 return E_OUTOFMEMORY
;
4298 hr
= d3dx9_effect_init(object
, device
, srcdata
, srcdatalen
, pool
);
4301 WARN("Failed to initialize shader reflection\n");
4302 HeapFree(GetProcessHeap(), 0, object
);
4306 *effect
= &object
->ID3DXEffect_iface
;
4308 TRACE("Created ID3DXEffect %p\n", object
);
4313 HRESULT WINAPI
D3DXCreateEffect(LPDIRECT3DDEVICE9 device
,
4316 CONST D3DXMACRO
* defines
,
4317 LPD3DXINCLUDE include
,
4319 LPD3DXEFFECTPOOL pool
,
4320 LPD3DXEFFECT
* effect
,
4321 LPD3DXBUFFER
* compilation_errors
)
4323 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device
, srcdata
, srcdatalen
, defines
,
4324 include
, flags
, pool
, effect
, compilation_errors
);
4326 return D3DXCreateEffectEx(device
, srcdata
, srcdatalen
, defines
, include
, NULL
, flags
, pool
, effect
, compilation_errors
);
4329 static HRESULT
d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl
*compiler
, const char *data
, SIZE_T data_size
)
4332 struct ID3DXBaseEffectImpl
*object
= NULL
;
4334 TRACE("effect %p, data %p, data_size %lu\n", compiler
, data
, data_size
);
4336 compiler
->ID3DXEffectCompiler_iface
.lpVtbl
= &ID3DXEffectCompiler_Vtbl
;
4339 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
4342 ERR("Out of memory\n");
4347 hr
= d3dx9_base_effect_init(object
, data
, data_size
, NULL
);
4350 FIXME("Failed to parse effect.\n");
4354 compiler
->base_effect
= &object
->ID3DXBaseEffect_iface
;
4360 HeapFree(GetProcessHeap(), 0, object
);
4361 free_effect_compiler(compiler
);
4366 HRESULT WINAPI
D3DXCreateEffectCompiler(LPCSTR srcdata
,
4368 CONST D3DXMACRO
*defines
,
4369 LPD3DXINCLUDE include
,
4371 LPD3DXEFFECTCOMPILER
*compiler
,
4372 LPD3DXBUFFER
*parse_errors
)
4374 struct ID3DXEffectCompilerImpl
*object
;
4377 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
4378 srcdata
, srcdatalen
, defines
, include
, flags
, compiler
, parse_errors
);
4380 if (!srcdata
|| !compiler
)
4382 WARN("Invalid arguments supplied\n");
4383 return D3DERR_INVALIDCALL
;
4386 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
4389 ERR("Out of memory\n");
4390 return E_OUTOFMEMORY
;
4393 hr
= d3dx9_effect_compiler_init(object
, srcdata
, srcdatalen
);
4396 WARN("Failed to initialize effect compiler\n");
4397 HeapFree(GetProcessHeap(), 0, object
);
4401 *compiler
= &object
->ID3DXEffectCompiler_iface
;
4403 TRACE("Created ID3DXEffectCompiler %p\n", object
);
4408 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl
;
4410 struct ID3DXEffectPoolImpl
4412 ID3DXEffectPool ID3DXEffectPool_iface
;
4416 static inline struct ID3DXEffectPoolImpl
*impl_from_ID3DXEffectPool(ID3DXEffectPool
*iface
)
4418 return CONTAINING_RECORD(iface
, struct ID3DXEffectPoolImpl
, ID3DXEffectPool_iface
);
4421 /*** IUnknown methods ***/
4422 static HRESULT WINAPI
ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool
*iface
, REFIID riid
, void **object
)
4424 struct ID3DXEffectPoolImpl
*This
= impl_from_ID3DXEffectPool(iface
);
4426 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), object
);
4428 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
4429 IsEqualGUID(riid
, &IID_ID3DXEffectPool
))
4431 This
->ID3DXEffectPool_iface
.lpVtbl
->AddRef(iface
);
4436 WARN("Interface %s not found\n", debugstr_guid(riid
));
4438 return E_NOINTERFACE
;
4441 static ULONG WINAPI
ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool
*iface
)
4443 struct ID3DXEffectPoolImpl
*This
= impl_from_ID3DXEffectPool(iface
);
4445 TRACE("(%p)->(): AddRef from %u\n", This
, This
->ref
);
4447 return InterlockedIncrement(&This
->ref
);
4450 static ULONG WINAPI
ID3DXEffectPoolImpl_Release(ID3DXEffectPool
*iface
)
4452 struct ID3DXEffectPoolImpl
*This
= impl_from_ID3DXEffectPool(iface
);
4453 ULONG ref
= InterlockedDecrement(&This
->ref
);
4455 TRACE("(%p)->(): Release from %u\n", This
, ref
+ 1);
4458 HeapFree(GetProcessHeap(), 0, This
);
4463 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl
=
4465 /*** IUnknown methods ***/
4466 ID3DXEffectPoolImpl_QueryInterface
,
4467 ID3DXEffectPoolImpl_AddRef
,
4468 ID3DXEffectPoolImpl_Release
4471 HRESULT WINAPI
D3DXCreateEffectPool(LPD3DXEFFECTPOOL
*pool
)
4473 struct ID3DXEffectPoolImpl
*object
;
4475 TRACE("(%p)\n", pool
);
4478 return D3DERR_INVALIDCALL
;
4480 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
4483 ERR("Out of memory\n");
4484 return E_OUTOFMEMORY
;
4487 object
->ID3DXEffectPool_iface
.lpVtbl
= &ID3DXEffectPool_Vtbl
;
4490 *pool
= &object
->ID3DXEffectPool_iface
;
4495 HRESULT WINAPI
D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device
, LPCWSTR srcfile
,
4496 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
4497 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4503 TRACE("(%s): relay\n", debugstr_w(srcfile
));
4505 if (!device
|| !srcfile
|| !defines
)
4506 return D3DERR_INVALIDCALL
;
4508 ret
= map_view_of_file(srcfile
, &buffer
, &size
);
4511 return D3DXERR_INVALIDDATA
;
4513 ret
= D3DXCreateEffectEx(device
, buffer
, size
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
4514 UnmapViewOfFile(buffer
);
4519 HRESULT WINAPI
D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device
, LPCSTR srcfile
,
4520 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
4521 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4527 TRACE("(void): relay\n");
4529 if (!srcfile
|| !defines
)
4530 return D3DERR_INVALIDCALL
;
4532 len
= MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, NULL
, 0);
4533 srcfileW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(*srcfileW
));
4534 MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, srcfileW
, len
);
4536 ret
= D3DXCreateEffectFromFileExW(device
, srcfileW
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
4537 HeapFree(GetProcessHeap(), 0, srcfileW
);
4542 HRESULT WINAPI
D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device
, LPCWSTR srcfile
,
4543 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
4544 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4546 TRACE("(void): relay\n");
4547 return D3DXCreateEffectFromFileExW(device
, srcfile
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
4550 HRESULT WINAPI
D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device
, LPCSTR srcfile
,
4551 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
4552 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4554 TRACE("(void): relay\n");
4555 return D3DXCreateEffectFromFileExA(device
, srcfile
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
4558 HRESULT WINAPI
D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCWSTR srcresource
,
4559 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
4560 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4564 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_w(srcresource
));
4566 if (!device
|| !defines
)
4567 return D3DERR_INVALIDCALL
;
4569 resinfo
= FindResourceW(srcmodule
, srcresource
, (LPCWSTR
) RT_RCDATA
);
4577 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
4580 return D3DXERR_INVALIDDATA
;
4582 return D3DXCreateEffectEx(device
, buffer
, size
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
4585 return D3DXERR_INVALIDDATA
;
4588 HRESULT WINAPI
D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCSTR srcresource
,
4589 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
4590 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4594 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_a(srcresource
));
4596 if (!device
|| !defines
)
4597 return D3DERR_INVALIDCALL
;
4599 resinfo
= FindResourceA(srcmodule
, srcresource
, (LPCSTR
) RT_RCDATA
);
4607 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
4610 return D3DXERR_INVALIDDATA
;
4612 return D3DXCreateEffectEx(device
, buffer
, size
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
4615 return D3DXERR_INVALIDDATA
;
4618 HRESULT WINAPI
D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCWSTR srcresource
,
4619 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
4620 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4622 TRACE("(void): relay\n");
4623 return D3DXCreateEffectFromResourceExW(device
, srcmodule
, srcresource
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
4626 HRESULT WINAPI
D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCSTR srcresource
,
4627 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
4628 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
4630 TRACE("(void): relay\n");
4631 return D3DXCreateEffectFromResourceExA(device
, srcmodule
, srcresource
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
4634 HRESULT WINAPI
D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile
, const D3DXMACRO
*defines
, LPD3DXINCLUDE include
,
4635 DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
4641 TRACE("(%s): relay\n", debugstr_w(srcfile
));
4643 if (!srcfile
|| !defines
)
4644 return D3DERR_INVALIDCALL
;
4646 ret
= map_view_of_file(srcfile
, &buffer
, &size
);
4649 return D3DXERR_INVALIDDATA
;
4651 ret
= D3DXCreateEffectCompiler(buffer
, size
, defines
, include
, flags
, effectcompiler
, parseerrors
);
4652 UnmapViewOfFile(buffer
);
4657 HRESULT WINAPI
D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile
, const D3DXMACRO
*defines
, LPD3DXINCLUDE include
,
4658 DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
4664 TRACE("(void): relay\n");
4666 if (!srcfile
|| !defines
)
4667 return D3DERR_INVALIDCALL
;
4669 len
= MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, NULL
, 0);
4670 srcfileW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(*srcfileW
));
4671 MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, srcfileW
, len
);
4673 ret
= D3DXCreateEffectCompilerFromFileW(srcfileW
, defines
, include
, flags
, effectcompiler
, parseerrors
);
4674 HeapFree(GetProcessHeap(), 0, srcfileW
);
4679 HRESULT WINAPI
D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule
, LPCSTR srcresource
, const D3DXMACRO
*defines
,
4680 LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
4684 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_a(srcresource
));
4686 resinfo
= FindResourceA(srcmodule
, srcresource
, (LPCSTR
) RT_RCDATA
);
4694 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
4697 return D3DXERR_INVALIDDATA
;
4699 return D3DXCreateEffectCompiler(buffer
, size
, defines
, include
, flags
, effectcompiler
, parseerrors
);
4702 return D3DXERR_INVALIDDATA
;
4705 HRESULT WINAPI
D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule
, LPCWSTR srcresource
, const D3DXMACRO
*defines
,
4706 LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
4710 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_w(srcresource
));
4712 resinfo
= FindResourceW(srcmodule
, srcresource
, (LPCWSTR
) RT_RCDATA
);
4720 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
4723 return D3DXERR_INVALIDDATA
;
4725 return D3DXCreateEffectCompiler(buffer
, size
, defines
, include
, flags
, effectcompiler
, parseerrors
);
4728 return D3DXERR_INVALIDDATA
;