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;
78 enum SHADER_CONSTANT_TYPE
98 D3DXPARAMETER_CLASS class;
99 D3DXPARAMETER_TYPE type;
103 UINT annotation_count;
108 D3DXHANDLE *annotation_handles;
109 D3DXHANDLE *member_handles;
116 enum STATE_TYPE type;
117 D3DXHANDLE parameter;
123 struct d3dx_state *states;
130 UINT annotation_count;
132 struct d3dx_state *states;
133 D3DXHANDLE *annotation_handles;
136 struct d3dx_technique
140 UINT annotation_count;
142 D3DXHANDLE *annotation_handles;
143 D3DXHANDLE *pass_handles;
146 struct ID3DXBaseEffectImpl
148 ID3DXBaseEffect ID3DXBaseEffect_iface;
151 struct ID3DXEffectImpl *effect;
153 UINT parameter_count;
154 UINT technique_count;
156 D3DXHANDLE *parameter_handles;
157 D3DXHANDLE *technique_handles;
160 struct ID3DXEffectImpl
162 ID3DXEffect ID3DXEffect_iface;
165 LPD3DXEFFECTSTATEMANAGER manager;
166 LPDIRECT3DDEVICE9 device;
167 LPD3DXEFFECTPOOL pool;
168 D3DXHANDLE active_technique;
169 D3DXHANDLE active_pass;
171 ID3DXBaseEffect *base_effect;
174 struct ID3DXEffectCompilerImpl
176 ID3DXEffectCompiler ID3DXEffectCompiler_iface;
179 ID3DXBaseEffect *base_effect;
182 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
183 struct d3dx_parameter *parameter, LPCSTR name);
184 static struct d3dx_parameter *get_parameter_annotation_by_name(struct d3dx_parameter *parameter, LPCSTR name);
185 static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, D3DXHANDLE *objects);
186 static void free_parameter_state(D3DXHANDLE handle, BOOL element, BOOL child, enum STATE_TYPE st);
190 enum STATE_CLASS class;
197 {SC_RENDERSTATE, D3DRS_ZENABLE, "D3DRS_ZENABLE"}, /* 0x0 */
198 {SC_RENDERSTATE, D3DRS_FILLMODE, "D3DRS_FILLMODE"},
199 {SC_RENDERSTATE, D3DRS_SHADEMODE, "D3DRS_SHADEMODE"},
200 {SC_RENDERSTATE, D3DRS_ZWRITEENABLE, "D3DRS_ZWRITEENABLE"},
201 {SC_RENDERSTATE, D3DRS_ALPHATESTENABLE, "D3DRS_ALPHATESTENABLE"},
202 {SC_RENDERSTATE, D3DRS_LASTPIXEL, "D3DRS_LASTPIXEL"},
203 {SC_RENDERSTATE, D3DRS_SRCBLEND, "D3DRS_SRCBLEND"},
204 {SC_RENDERSTATE, D3DRS_DESTBLEND, "D3DRS_DESTBLEND"},
205 {SC_RENDERSTATE, D3DRS_CULLMODE, "D3DRS_CULLMODE"},
206 {SC_RENDERSTATE, D3DRS_ZFUNC, "D3DRS_ZFUNC"},
207 {SC_RENDERSTATE, D3DRS_ALPHAREF, "D3DRS_ALPHAREF"},
208 {SC_RENDERSTATE, D3DRS_ALPHAFUNC, "D3DRS_ALPHAFUNC"},
209 {SC_RENDERSTATE, D3DRS_DITHERENABLE, "D3DRS_DITHERENABLE"},
210 {SC_RENDERSTATE, D3DRS_ALPHABLENDENABLE, "D3DRS_ALPHABLENDENABLE"},
211 {SC_RENDERSTATE, D3DRS_FOGENABLE, "D3DRS_FOGENABLE"},
212 {SC_RENDERSTATE, D3DRS_SPECULARENABLE, "D3DRS_SPECULARENABLE"},
213 {SC_RENDERSTATE, D3DRS_FOGCOLOR, "D3DRS_FOGCOLOR"}, /* 0x10 */
214 {SC_RENDERSTATE, D3DRS_FOGTABLEMODE, "D3DRS_FOGTABLEMODE"},
215 {SC_RENDERSTATE, D3DRS_FOGSTART, "D3DRS_FOGSTART"},
216 {SC_RENDERSTATE, D3DRS_FOGEND, "D3DRS_FOGEND"},
217 {SC_RENDERSTATE, D3DRS_FOGDENSITY, "D3DRS_FOGDENSITY"},
218 {SC_RENDERSTATE, D3DRS_RANGEFOGENABLE, "D3DRS_RANGEFOGENABLE"},
219 {SC_RENDERSTATE, D3DRS_STENCILENABLE, "D3DRS_STENCILENABLE"},
220 {SC_RENDERSTATE, D3DRS_STENCILFAIL, "D3DRS_STENCILFAIL"},
221 {SC_RENDERSTATE, D3DRS_STENCILZFAIL, "D3DRS_STENCILZFAIL"},
222 {SC_RENDERSTATE, D3DRS_STENCILPASS, "D3DRS_STENCILPASS"},
223 {SC_RENDERSTATE, D3DRS_STENCILFUNC, "D3DRS_STENCILFUNC"},
224 {SC_RENDERSTATE, D3DRS_STENCILREF, "D3DRS_STENCILREF"},
225 {SC_RENDERSTATE, D3DRS_STENCILMASK, "D3DRS_STENCILMASK"},
226 {SC_RENDERSTATE, D3DRS_STENCILWRITEMASK, "D3DRS_STENCILWRITEMASK"},
227 {SC_RENDERSTATE, D3DRS_TEXTUREFACTOR, "D3DRS_TEXTUREFACTOR"},
228 {SC_RENDERSTATE, D3DRS_WRAP0, "D3DRS_WRAP0"},
229 {SC_RENDERSTATE, D3DRS_WRAP1, "D3DRS_WRAP1"}, /* 0x20 */
230 {SC_RENDERSTATE, D3DRS_WRAP2, "D3DRS_WRAP2"},
231 {SC_RENDERSTATE, D3DRS_WRAP3, "D3DRS_WRAP3"},
232 {SC_RENDERSTATE, D3DRS_WRAP4, "D3DRS_WRAP4"},
233 {SC_RENDERSTATE, D3DRS_WRAP5, "D3DRS_WRAP5"},
234 {SC_RENDERSTATE, D3DRS_WRAP6, "D3DRS_WRAP6"},
235 {SC_RENDERSTATE, D3DRS_WRAP7, "D3DRS_WRAP7"},
236 {SC_RENDERSTATE, D3DRS_WRAP8, "D3DRS_WRAP8"},
237 {SC_RENDERSTATE, D3DRS_WRAP9, "D3DRS_WRAP9"},
238 {SC_RENDERSTATE, D3DRS_WRAP10, "D3DRS_WRAP10"},
239 {SC_RENDERSTATE, D3DRS_WRAP11, "D3DRS_WRAP11"},
240 {SC_RENDERSTATE, D3DRS_WRAP12, "D3DRS_WRAP12"},
241 {SC_RENDERSTATE, D3DRS_WRAP13, "D3DRS_WRAP13"},
242 {SC_RENDERSTATE, D3DRS_WRAP14, "D3DRS_WRAP14"},
243 {SC_RENDERSTATE, D3DRS_WRAP15, "D3DRS_WRAP15"},
244 {SC_RENDERSTATE, D3DRS_CLIPPING, "D3DRS_CLIPPING"},
245 {SC_RENDERSTATE, D3DRS_LIGHTING, "D3DRS_LIGHTING"}, /* 0x30 */
246 {SC_RENDERSTATE, D3DRS_AMBIENT, "D3DRS_AMBIENT"},
247 {SC_RENDERSTATE, D3DRS_FOGVERTEXMODE, "D3DRS_FOGVERTEXMODE"},
248 {SC_RENDERSTATE, D3DRS_COLORVERTEX, "D3DRS_COLORVERTEX"},
249 {SC_RENDERSTATE, D3DRS_LOCALVIEWER, "D3DRS_LOCALVIEWER"},
250 {SC_RENDERSTATE, D3DRS_NORMALIZENORMALS, "D3DRS_NORMALIZENORMALS"},
251 {SC_RENDERSTATE, D3DRS_DIFFUSEMATERIALSOURCE, "D3DRS_DIFFUSEMATERIALSOURCE"},
252 {SC_RENDERSTATE, D3DRS_SPECULARMATERIALSOURCE, "D3DRS_SPECULARMATERIALSOURCE"},
253 {SC_RENDERSTATE, D3DRS_AMBIENTMATERIALSOURCE, "D3DRS_AMBIENTMATERIALSOURCE"},
254 {SC_RENDERSTATE, D3DRS_EMISSIVEMATERIALSOURCE, "D3DRS_EMISSIVEMATERIALSOURCE"},
255 {SC_RENDERSTATE, D3DRS_VERTEXBLEND, "D3DRS_VERTEXBLEND"},
256 {SC_RENDERSTATE, D3DRS_CLIPPLANEENABLE, "D3DRS_CLIPPLANEENABLE"},
257 {SC_RENDERSTATE, D3DRS_POINTSIZE, "D3DRS_POINTSIZE"},
258 {SC_RENDERSTATE, D3DRS_POINTSIZE_MIN, "D3DRS_POINTSIZE_MIN"},
259 {SC_RENDERSTATE, D3DRS_POINTSIZE_MAX, "D3DRS_POINTSIZE_MAX"},
260 {SC_RENDERSTATE, D3DRS_POINTSPRITEENABLE, "D3DRS_POINTSPRITEENABLE"},
261 {SC_RENDERSTATE, D3DRS_POINTSCALEENABLE, "D3DRS_POINTSCALEENABLE"}, /* 0x40 */
262 {SC_RENDERSTATE, D3DRS_POINTSCALE_A, "D3DRS_POINTSCALE_A"},
263 {SC_RENDERSTATE, D3DRS_POINTSCALE_B, "D3DRS_POINTSCALE_B"},
264 {SC_RENDERSTATE, D3DRS_POINTSCALE_C, "D3DRS_POINTSCALE_C"},
265 {SC_RENDERSTATE, D3DRS_MULTISAMPLEANTIALIAS, "D3DRS_MULTISAMPLEANTIALIAS"},
266 {SC_RENDERSTATE, D3DRS_MULTISAMPLEMASK, "D3DRS_MULTISAMPLEMASK"},
267 {SC_RENDERSTATE, D3DRS_PATCHEDGESTYLE, "D3DRS_PATCHEDGESTYLE"},
268 {SC_RENDERSTATE, D3DRS_DEBUGMONITORTOKEN, "D3DRS_DEBUGMONITORTOKEN"},
269 {SC_RENDERSTATE, D3DRS_INDEXEDVERTEXBLENDENABLE, "D3DRS_INDEXEDVERTEXBLENDENABLE"},
270 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE, "D3DRS_COLORWRITEENABLE"},
271 {SC_RENDERSTATE, D3DRS_TWEENFACTOR, "D3DRS_TWEENFACTOR"},
272 {SC_RENDERSTATE, D3DRS_BLENDOP, "D3DRS_BLENDOP"},
273 {SC_RENDERSTATE, D3DRS_POSITIONDEGREE, "D3DRS_POSITIONDEGREE"},
274 {SC_RENDERSTATE, D3DRS_NORMALDEGREE, "D3DRS_NORMALDEGREE"},
275 {SC_RENDERSTATE, D3DRS_SCISSORTESTENABLE, "D3DRS_SCISSORTESTENABLE"},
276 {SC_RENDERSTATE, D3DRS_SLOPESCALEDEPTHBIAS, "D3DRS_SLOPESCALEDEPTHBIAS"},
277 {SC_RENDERSTATE, D3DRS_ANTIALIASEDLINEENABLE, "D3DRS_ANTIALIASEDLINEENABLE"}, /* 0x50 */
278 {SC_RENDERSTATE, D3DRS_MINTESSELLATIONLEVEL, "D3DRS_MINTESSELLATIONLEVEL"},
279 {SC_RENDERSTATE, D3DRS_MAXTESSELLATIONLEVEL, "D3DRS_MAXTESSELLATIONLEVEL"},
280 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_X, "D3DRS_ADAPTIVETESS_X"},
281 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_Y, "D3DRS_ADAPTIVETESS_Y"},
282 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_Z, "D3DRS_ADAPTIVETESS_Z"},
283 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_W, "D3DRS_ADAPTIVETESS_W"},
284 {SC_RENDERSTATE, D3DRS_ENABLEADAPTIVETESSELLATION, "D3DRS_ENABLEADAPTIVETESSELLATION"},
285 {SC_RENDERSTATE, D3DRS_TWOSIDEDSTENCILMODE, "D3DRS_TWOSIDEDSTENCILMODE"},
286 {SC_RENDERSTATE, D3DRS_CCW_STENCILFAIL, "D3DRS_CCW_STENCILFAIL"},
287 {SC_RENDERSTATE, D3DRS_CCW_STENCILZFAIL, "D3DRS_CCW_STENCILZFAIL"},
288 {SC_RENDERSTATE, D3DRS_CCW_STENCILPASS, "D3DRS_CCW_STENCILPASS"},
289 {SC_RENDERSTATE, D3DRS_CCW_STENCILFUNC, "D3DRS_CCW_STENCILFUNC"},
290 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE1, "D3DRS_COLORWRITEENABLE1"},
291 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE2, "D3DRS_COLORWRITEENABLE2"},
292 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE3, "D3DRS_COLORWRITEENABLE3"},
293 {SC_RENDERSTATE, D3DRS_BLENDFACTOR, "D3DRS_BLENDFACTOR"}, /* 0x60 */
294 {SC_RENDERSTATE, D3DRS_SRGBWRITEENABLE, "D3DRS_SRGBWRITEENABLE"},
295 {SC_RENDERSTATE, D3DRS_DEPTHBIAS, "D3DRS_DEPTHBIAS"},
296 {SC_RENDERSTATE, D3DRS_SEPARATEALPHABLENDENABLE, "D3DRS_SEPARATEALPHABLENDENABLE"},
297 {SC_RENDERSTATE, D3DRS_SRCBLENDALPHA, "D3DRS_SRCBLENDALPHA"},
298 {SC_RENDERSTATE, D3DRS_DESTBLENDALPHA, "D3DRS_DESTBLENDALPHA"},
299 {SC_RENDERSTATE, D3DRS_BLENDOPALPHA, "D3DRS_BLENDOPALPHA"},
301 {SC_TEXTURESTAGE, D3DTSS_COLOROP, "D3DTSS_COLOROP"},
302 {SC_TEXTURESTAGE, D3DTSS_COLORARG0, "D3DTSS_COLORARG0"},
303 {SC_TEXTURESTAGE, D3DTSS_COLORARG1, "D3DTSS_COLORARG1"},
304 {SC_TEXTURESTAGE, D3DTSS_COLORARG2, "D3DTSS_COLORARG2"},
305 {SC_TEXTURESTAGE, D3DTSS_ALPHAOP, "D3DTSS_ALPHAOP"},
306 {SC_TEXTURESTAGE, D3DTSS_ALPHAARG0, "D3DTSS_ALPHAARG0"},
307 {SC_TEXTURESTAGE, D3DTSS_ALPHAARG1, "D3DTSS_ALPHAARG1"},
308 {SC_TEXTURESTAGE, D3DTSS_ALPHAARG2, "D3DTSS_ALPHAARG2"},
309 {SC_TEXTURESTAGE, D3DTSS_RESULTARG, "D3DTSS_RESULTARG"},
310 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT00, "D3DTSS_BUMPENVMAT00"}, /* 0x70 */
311 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT01, "D3DTSS_BUMPENVMAT01"},
312 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT10, "D3DTSS_BUMPENVMAT10"},
313 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT11, "D3DTSS_BUMPENVMAT11"},
314 {SC_TEXTURESTAGE, D3DTSS_TEXCOORDINDEX, "D3DTSS_TEXCOORDINDEX"},
315 {SC_TEXTURESTAGE, D3DTSS_BUMPENVLSCALE, "D3DTSS_BUMPENVLSCALE"},
316 {SC_TEXTURESTAGE, D3DTSS_BUMPENVLOFFSET, "D3DTSS_BUMPENVLOFFSET"},
317 {SC_TEXTURESTAGE, D3DTSS_TEXTURETRANSFORMFLAGS, "D3DTSS_TEXTURETRANSFORMFLAGS"},
319 {SC_UNKNOWN, 0, "UNKNOWN"},
321 {SC_NPATCHMODE, 0, "NPatchMode"},
323 {SC_UNKNOWN, 0, "UNKNOWN"},
325 {SC_TRANSFORM, D3DTS_PROJECTION, "D3DTS_PROJECTION"},
326 {SC_TRANSFORM, D3DTS_VIEW, "D3DTS_VIEW"},
327 {SC_TRANSFORM, D3DTS_WORLD, "D3DTS_WORLD"},
328 {SC_TRANSFORM, D3DTS_TEXTURE0, "D3DTS_TEXTURE0"},
330 {SC_MATERIAL, MT_DIFFUSE, "MaterialDiffuse"},
331 {SC_MATERIAL, MT_AMBIENT, "MaterialAmbient"}, /* 0x80 */
332 {SC_MATERIAL, MT_SPECULAR, "MaterialSpecular"},
333 {SC_MATERIAL, MT_EMISSIVE, "MaterialEmissive"},
334 {SC_MATERIAL, MT_POWER, "MaterialPower"},
336 {SC_LIGHT, LT_TYPE, "LightType"},
337 {SC_LIGHT, LT_DIFFUSE, "LightDiffuse"},
338 {SC_LIGHT, LT_SPECULAR, "LightSpecular"},
339 {SC_LIGHT, LT_AMBIENT, "LightAmbient"},
340 {SC_LIGHT, LT_POSITION, "LightPosition"},
341 {SC_LIGHT, LT_DIRECTION, "LightDirection"},
342 {SC_LIGHT, LT_RANGE, "LightRange"},
343 {SC_LIGHT, LT_FALLOFF, "LightFallOff"},
344 {SC_LIGHT, LT_ATTENUATION0, "LightAttenuation0"},
345 {SC_LIGHT, LT_ATTENUATION1, "LightAttenuation1"},
346 {SC_LIGHT, LT_ATTENUATION2, "LightAttenuation2"},
347 {SC_LIGHT, LT_THETA, "LightTheta"},
348 {SC_LIGHT, LT_PHI, "LightPhi"}, /* 0x90 */
350 {SC_LIGHTENABLE, 0, "LightEnable"},
352 {SC_VERTEXSHADER, 0, "Vertexshader"},
354 {SC_PIXELSHADER, 0, "Pixelshader"},
355 /* Shader constants */
356 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstantF"},
357 {SC_SHADERCONST, SCT_VSBOOL, "VertexShaderConstantB"},
358 {SC_SHADERCONST, SCT_VSINT, "VertexShaderConstantI"},
359 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant"},
360 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant1"},
361 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant2"},
362 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant3"},
363 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant4"},
364 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstantF"},
365 {SC_SHADERCONST, SCT_PSBOOL, "PixelShaderConstantB"},
366 {SC_SHADERCONST, SCT_PSINT, "PixelShaderConstantI"},
367 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant"},
368 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant1"}, /* 0xa0 */
369 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant2"},
370 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant3"},
371 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant4"},
373 {SC_TEXTURE, 0, "Texture"},
375 {SC_SAMPLERSTATE, D3DSAMP_ADDRESSU, "AddressU"},
376 {SC_SAMPLERSTATE, D3DSAMP_ADDRESSV, "AddressV"},
377 {SC_SAMPLERSTATE, D3DSAMP_ADDRESSW, "AddressW"},
378 {SC_SAMPLERSTATE, D3DSAMP_BORDERCOLOR, "BorderColor"},
379 {SC_SAMPLERSTATE, D3DSAMP_MAGFILTER, "MagFilter"},
380 {SC_SAMPLERSTATE, D3DSAMP_MINFILTER, "MinFilter"},
381 {SC_SAMPLERSTATE, D3DSAMP_MIPFILTER, "MipFilter"},
382 {SC_SAMPLERSTATE, D3DSAMP_MIPMAPLODBIAS, "MipMapLodBias"},
383 {SC_SAMPLERSTATE, D3DSAMP_MAXMIPLEVEL, "MaxMipLevel"},
384 {SC_SAMPLERSTATE, D3DSAMP_MAXANISOTROPY, "MaxAnisotropy"},
385 {SC_SAMPLERSTATE, D3DSAMP_SRGBTEXTURE, "SRGBTexture"},
386 {SC_SAMPLERSTATE, D3DSAMP_ELEMENTINDEX, "ElementIndex"}, /* 0xb0 */
387 {SC_SAMPLERSTATE, D3DSAMP_DMAPOFFSET, "DMAPOffset"},
389 {SC_SETSAMPLER, 0, "Sampler"},
392 static inline void read_dword(const char **ptr, DWORD *d)
394 memcpy(d, *ptr, sizeof(*d));
398 static void skip_dword_unknown(const char **ptr, unsigned int count)
403 FIXME("Skipping %u unknown DWORDs:\n", count);
404 for (i = 0; i < count; ++i)
407 FIXME("\t0x%08x\n", d);
411 static inline struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle)
413 return (struct d3dx_parameter *) handle;
416 static inline struct d3dx_pass *get_pass_struct(D3DXHANDLE handle)
418 return (struct d3dx_pass *) handle;
421 static inline struct d3dx_technique *get_technique_struct(D3DXHANDLE handle)
423 return (struct d3dx_technique *) handle;
426 static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
428 return (D3DXHANDLE) parameter;
431 static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique)
433 return (D3DXHANDLE) technique;
436 static inline D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
438 return (D3DXHANDLE) pass;
441 static struct d3dx_technique *is_valid_technique(struct ID3DXBaseEffectImpl *base, D3DXHANDLE technique)
445 for (i = 0; i < base->technique_count; ++i)
447 if (base->technique_handles[i] == technique)
449 return get_technique_struct(technique);
456 static struct d3dx_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
460 for (i = 0; i < base->technique_count; ++i)
462 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
464 for (k = 0; k < technique->pass_count; ++k)
466 if (technique->pass_handles[k] == pass)
468 return get_pass_struct(pass);
476 static struct d3dx_parameter *is_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter)
478 unsigned int i, count;
479 struct d3dx_parameter *p;
481 for (i = 0; i < param->annotation_count; ++i)
483 if (param->annotation_handles[i] == parameter)
485 return get_parameter_struct(parameter);
488 p = is_valid_sub_parameter(get_parameter_struct(param->annotation_handles[i]), parameter);
492 if (param->element_count) count = param->element_count;
493 else count = param->member_count;
495 for (i = 0; i < count; ++i)
497 if (param->member_handles[i] == parameter)
499 return get_parameter_struct(parameter);
502 p = is_valid_sub_parameter(get_parameter_struct(param->member_handles[i]), parameter);
509 static struct d3dx_parameter *is_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
511 unsigned int i, k, m;
512 struct d3dx_parameter *p;
514 for (i = 0; i < base->parameter_count; ++i)
516 if (base->parameter_handles[i] == parameter)
518 return get_parameter_struct(parameter);
521 p = is_valid_sub_parameter(get_parameter_struct(base->parameter_handles[i]), parameter);
525 for (i = 0; i < base->technique_count; ++i)
527 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
529 for (k = 0; k < technique->pass_count; ++k)
531 struct d3dx_pass *pass = get_pass_struct(technique->pass_handles[k]);
533 for (m = 0; m < pass->annotation_count; ++m)
535 if (pass->annotation_handles[i] == parameter)
537 return get_parameter_struct(parameter);
540 p = is_valid_sub_parameter(get_parameter_struct(pass->annotation_handles[m]), parameter);
545 for (k = 0; k < technique->annotation_count; ++k)
547 if (technique->annotation_handles[k] == parameter)
549 return get_parameter_struct(parameter);
552 p = is_valid_sub_parameter(get_parameter_struct(technique->annotation_handles[k]), parameter);
560 static void free_state(struct d3dx_state *state)
562 free_parameter_state(state->parameter, FALSE, FALSE, state->type);
565 static void free_sampler(struct d3dx_sampler *sampler)
569 for (i = 0; i < sampler->state_count; ++i)
571 free_state(&sampler->states[i]);
573 HeapFree(GetProcessHeap(), 0, sampler->states);
576 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
578 free_parameter_state(handle, element, child, ST_CONSTANT);
581 static void free_parameter_state(D3DXHANDLE handle, BOOL element, BOOL child, enum STATE_TYPE st)
584 struct d3dx_parameter *param = get_parameter_struct(handle);
586 TRACE("Free parameter %p, name %s, type %s, child %s, state_type %x\n", param, param->name,
587 debug_d3dxparameter_type(param->type), child ? "yes" : "no", st);
594 if (param->annotation_handles)
596 for (i = 0; i < param->annotation_count; ++i)
598 free_parameter(param->annotation_handles[i], FALSE, FALSE);
600 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
603 if (param->member_handles)
607 if (param->element_count) count = param->element_count;
608 else count = param->member_count;
610 for (i = 0; i < count; ++i)
612 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
614 HeapFree(GetProcessHeap(), 0, param->member_handles);
617 if (param->class == D3DXPC_OBJECT && !param->element_count)
622 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
623 if (!child) HeapFree(GetProcessHeap(), 0, param->data);
627 case D3DXPT_TEXTURE1D:
628 case D3DXPT_TEXTURE2D:
629 case D3DXPT_TEXTURE3D:
630 case D3DXPT_TEXTURECUBE:
631 case D3DXPT_PIXELSHADER:
632 case D3DXPT_VERTEXSHADER:
633 if (st == ST_CONSTANT)
635 if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data);
639 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
641 if (!child) HeapFree(GetProcessHeap(), 0, param->data);
645 case D3DXPT_SAMPLER1D:
646 case D3DXPT_SAMPLER2D:
647 case D3DXPT_SAMPLER3D:
648 case D3DXPT_SAMPLERCUBE:
649 if (st == ST_CONSTANT)
651 free_sampler((struct d3dx_sampler *)param->data);
655 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
657 /* samplers have always own data, so free that */
658 HeapFree(GetProcessHeap(), 0, param->data);
662 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
670 if (st != ST_CONSTANT)
672 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
674 HeapFree(GetProcessHeap(), 0, param->data);
678 /* only the parent has to release name and semantic */
681 HeapFree(GetProcessHeap(), 0, param->name);
682 HeapFree(GetProcessHeap(), 0, param->semantic);
685 HeapFree(GetProcessHeap(), 0, param);
688 static void free_pass(D3DXHANDLE handle)
691 struct d3dx_pass *pass = get_pass_struct(handle);
693 TRACE("Free pass %p\n", pass);
700 if (pass->annotation_handles)
702 for (i = 0; i < pass->annotation_count; ++i)
704 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
706 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
711 for (i = 0; i < pass->state_count; ++i)
713 free_state(&pass->states[i]);
715 HeapFree(GetProcessHeap(), 0, pass->states);
718 HeapFree(GetProcessHeap(), 0, pass->name);
719 HeapFree(GetProcessHeap(), 0, pass);
722 static void free_technique(D3DXHANDLE handle)
725 struct d3dx_technique *technique = get_technique_struct(handle);
727 TRACE("Free technique %p\n", technique);
734 if (technique->annotation_handles)
736 for (i = 0; i < technique->annotation_count; ++i)
738 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
740 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
743 if (technique->pass_handles)
745 for (i = 0; i < technique->pass_count; ++i)
747 free_pass(technique->pass_handles[i]);
749 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
752 HeapFree(GetProcessHeap(), 0, technique->name);
753 HeapFree(GetProcessHeap(), 0, technique);
756 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
760 TRACE("Free base effect %p\n", base);
762 if (base->parameter_handles)
764 for (i = 0; i < base->parameter_count; ++i)
766 free_parameter(base->parameter_handles[i], FALSE, FALSE);
768 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
771 if (base->technique_handles)
773 for (i = 0; i < base->technique_count; ++i)
775 free_technique(base->technique_handles[i]);
777 HeapFree(GetProcessHeap(), 0, base->technique_handles);
781 static void free_effect(struct ID3DXEffectImpl *effect)
783 TRACE("Free effect %p\n", effect);
785 if (effect->base_effect)
787 effect->base_effect->lpVtbl->Release(effect->base_effect);
792 effect->pool->lpVtbl->Release(effect->pool);
797 IUnknown_Release(effect->manager);
800 IDirect3DDevice9_Release(effect->device);
803 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
805 TRACE("Free effect compiler %p\n", compiler);
807 if (compiler->base_effect)
809 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
813 static INT get_int(D3DXPARAMETER_TYPE type, void *data)
833 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type));
840 inline static FLOAT get_float(D3DXPARAMETER_TYPE type, void *data)
860 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type));
867 static inline BOOL get_bool(void *data)
869 return (*(DWORD *)data) ? TRUE : FALSE;
872 static struct d3dx_parameter *get_parameter_element_by_name(struct d3dx_parameter *parameter, LPCSTR name)
875 struct d3dx_parameter *temp_parameter;
878 TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
880 if (!name || !*name) return parameter;
882 element = atoi(name);
883 part = strchr(name, ']') + 1;
885 if (parameter->element_count > element)
887 temp_parameter = get_parameter_struct(parameter->member_handles[element]);
892 return get_parameter_by_name(NULL, temp_parameter, part);
895 return get_parameter_annotation_by_name(temp_parameter, part);
898 TRACE("Returning parameter %p\n", temp_parameter);
899 return temp_parameter;
902 FIXME("Unhandled case \"%c\"\n", *--part);
907 TRACE("Parameter not found\n");
911 static struct d3dx_parameter *get_parameter_annotation_by_name(struct d3dx_parameter *parameter, LPCSTR name)
914 struct d3dx_parameter *temp_parameter;
917 TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
919 if (!name || !*name) return parameter;
921 length = strcspn( name, "[.@" );
922 part = name + length;
924 for (i = 0; i < parameter->annotation_count; ++i)
926 temp_parameter = get_parameter_struct(parameter->annotation_handles[i]);
928 if (!strcmp(temp_parameter->name, name))
930 TRACE("Returning parameter %p\n", temp_parameter);
931 return temp_parameter;
933 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
938 return get_parameter_by_name(NULL, temp_parameter, part);
941 return get_parameter_element_by_name(temp_parameter, part);
944 FIXME("Unhandled case \"%c\"\n", *--part);
950 TRACE("Parameter not found\n");
954 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
955 struct d3dx_parameter *parameter, LPCSTR name)
957 UINT i, count, length;
958 struct d3dx_parameter *temp_parameter;
962 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
964 if (!name || !*name) return parameter;
968 count = base->parameter_count;
969 handles = base->parameter_handles;
973 count = parameter->member_count;
974 handles = parameter->member_handles;
977 length = strcspn( name, "[.@" );
978 part = name + length;
980 for (i = 0; i < count; i++)
982 temp_parameter = get_parameter_struct(handles[i]);
984 if (!strcmp(temp_parameter->name, name))
986 TRACE("Returning parameter %p\n", temp_parameter);
987 return temp_parameter;
989 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
994 return get_parameter_by_name(NULL, temp_parameter, part);
997 return get_parameter_annotation_by_name(temp_parameter, part);
1000 return get_parameter_element_by_name(temp_parameter, part);
1003 FIXME("Unhandled case \"%c\"\n", *--part);
1009 TRACE("Parameter not found\n");
1013 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
1015 return (0xfeff0000 | ((major) << 8) | (minor));
1018 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
1020 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
1023 /*** IUnknown methods ***/
1024 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
1026 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1028 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
1030 if (IsEqualGUID(riid, &IID_IUnknown) ||
1031 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
1033 This->ID3DXBaseEffect_iface.lpVtbl->AddRef(iface);
1038 ERR("Interface %s not found\n", debugstr_guid(riid));
1040 return E_NOINTERFACE;
1043 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
1045 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1047 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
1049 return InterlockedIncrement(&This->ref);
1052 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
1054 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1055 ULONG ref = InterlockedDecrement(&This->ref);
1057 TRACE("iface %p: Release from %u\n", iface, ref + 1);
1061 free_base_effect(This);
1062 HeapFree(GetProcessHeap(), 0, This);
1068 /*** ID3DXBaseEffect methods ***/
1069 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
1071 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1073 FIXME("iface %p, desc %p partial stub\n", This, desc);
1077 WARN("Invalid argument specified.\n");
1078 return D3DERR_INVALIDCALL;
1081 /* Todo: add creator and function count */
1082 desc->Creator = NULL;
1083 desc->Functions = 0;
1084 desc->Parameters = This->parameter_count;
1085 desc->Techniques = This->technique_count;
1090 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1092 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1093 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1095 TRACE("iface %p, parameter %p, desc %p\n", This, parameter, desc);
1097 if (!param) param = get_parameter_struct(iface->lpVtbl->GetParameterByName(iface, NULL, parameter));
1099 if (!desc || !param)
1101 WARN("Invalid argument specified.\n");
1102 return D3DERR_INVALIDCALL;
1105 desc->Name = param->name;
1106 desc->Semantic = param->semantic;
1107 desc->Class = param->class;
1108 desc->Type = param->type;
1109 desc->Rows = param->rows;
1110 desc->Columns = param->columns;
1111 desc->Elements = param->element_count;
1112 desc->Annotations = param->annotation_count;
1113 desc->StructMembers = param->member_count;
1114 desc->Flags = param->flags;
1115 desc->Bytes = param->bytes;
1120 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1122 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1123 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
1125 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
1129 WARN("Invalid argument specified.\n");
1130 return D3DERR_INVALIDCALL;
1133 desc->Name = tech->name;
1134 desc->Passes = tech->pass_count;
1135 desc->Annotations = tech->annotation_count;
1140 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1142 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1143 struct d3dx_pass *p = is_valid_pass(This, pass);
1145 TRACE("iface %p, pass %p, desc %p\n", This, pass, desc);
1149 WARN("Invalid argument specified.\n");
1150 return D3DERR_INVALIDCALL;
1153 desc->Name = p->name;
1154 desc->Annotations = p->annotation_count;
1156 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
1157 desc->pVertexShaderFunction = NULL;
1158 desc->pPixelShaderFunction = NULL;
1163 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1165 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1167 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
1172 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
1174 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1175 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1177 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
1179 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1183 if (index < This->parameter_count)
1185 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
1186 return This->parameter_handles[index];
1191 if (param && !param->element_count && index < param->member_count)
1193 TRACE("Returning parameter %p\n", param->member_handles[index]);
1194 return param->member_handles[index];
1198 WARN("Invalid argument specified.\n");
1203 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1205 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1206 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1209 TRACE("iface %p, parameter %p, name %s\n", This, parameter, debugstr_a(name));
1211 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1215 handle = get_parameter_handle(param);
1216 TRACE("Returning parameter %p\n", handle);
1220 handle = get_parameter_handle(get_parameter_by_name(This, param, name));
1221 TRACE("Returning parameter %p\n", handle);
1226 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1228 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1229 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1230 struct d3dx_parameter *temp_param;
1233 TRACE("iface %p, parameter %p, semantic %s\n", This, parameter, debugstr_a(semantic));
1235 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1239 for (i = 0; i < This->parameter_count; ++i)
1241 temp_param = get_parameter_struct(This->parameter_handles[i]);
1243 if (!temp_param->semantic)
1247 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
1248 return This->parameter_handles[i];
1253 if (!strcasecmp(temp_param->semantic, semantic))
1255 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
1256 return This->parameter_handles[i];
1262 for (i = 0; i < param->member_count; ++i)
1264 temp_param = get_parameter_struct(param->member_handles[i]);
1266 if (!temp_param->semantic)
1270 TRACE("Returning parameter %p\n", param->member_handles[i]);
1271 return param->member_handles[i];
1276 if (!strcasecmp(temp_param->semantic, semantic))
1278 TRACE("Returning parameter %p\n", param->member_handles[i]);
1279 return param->member_handles[i];
1284 WARN("Invalid argument specified\n");
1289 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
1291 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1292 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1294 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
1296 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1300 if (index < This->parameter_count)
1302 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
1303 return This->parameter_handles[index];
1308 if (index < param->element_count)
1310 TRACE("Returning parameter %p\n", param->member_handles[index]);
1311 return param->member_handles[index];
1315 WARN("Invalid argument specified\n");
1320 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
1322 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1324 TRACE("iface %p, index %u\n", This, index);
1326 if (index >= This->technique_count)
1328 WARN("Invalid argument specified.\n");
1332 TRACE("Returning technique %p\n", This->technique_handles[index]);
1334 return This->technique_handles[index];
1337 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
1339 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1342 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
1346 WARN("Invalid argument specified.\n");
1350 for (i = 0; i < This->technique_count; ++i)
1352 struct d3dx_technique *tech = get_technique_struct(This->technique_handles[i]);
1354 if (!strcmp(tech->name, name))
1356 TRACE("Returning technique %p\n", This->technique_handles[i]);
1357 return This->technique_handles[i];
1361 WARN("Invalid argument specified.\n");
1366 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
1368 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1369 struct d3dx_technique *tech = is_valid_technique(This, technique);
1371 TRACE("iface %p, technique %p, index %u\n", This, technique, index);
1373 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
1375 if (tech && index < tech->pass_count)
1377 TRACE("Returning pass %p\n", tech->pass_handles[index]);
1378 return tech->pass_handles[index];
1381 WARN("Invalid argument specified.\n");
1386 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
1388 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1389 struct d3dx_technique *tech = is_valid_technique(This, technique);
1391 TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
1393 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
1399 for (i = 0; i < tech->pass_count; ++i)
1401 struct d3dx_pass *pass = get_pass_struct(tech->pass_handles[i]);
1403 if (!strcmp(pass->name, name))
1405 TRACE("Returning pass %p\n", tech->pass_handles[i]);
1406 return tech->pass_handles[i];
1411 WARN("Invalid argument specified.\n");
1416 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
1418 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1420 FIXME("iface %p, index %u stub\n", This, index);
1425 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
1427 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1429 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
1434 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
1436 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1437 struct d3dx_parameter *param = is_valid_parameter(This, object);
1438 struct d3dx_pass *pass = is_valid_pass(This, object);
1439 struct d3dx_technique *technique = is_valid_technique(This, object);
1440 UINT annotation_count = 0;
1441 D3DXHANDLE *annotation_handles = NULL;
1443 FIXME("iface %p, object %p, index %u partial stub\n", This, object, index);
1447 annotation_count = pass->annotation_count;
1448 annotation_handles = pass->annotation_handles;
1452 annotation_count = technique->annotation_count;
1453 annotation_handles = technique->annotation_handles;
1457 if (!param) param = get_parameter_by_name(This, NULL, object);
1461 annotation_count = param->annotation_count;
1462 annotation_handles = param->annotation_handles;
1465 /* Todo: add funcs */
1467 if (index < annotation_count)
1469 TRACE("Returning parameter %p\n", annotation_handles[index]);
1470 return annotation_handles[index];
1473 WARN("Invalid argument specified\n");
1478 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
1480 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1481 struct d3dx_parameter *param = is_valid_parameter(This, object);
1482 struct d3dx_pass *pass = is_valid_pass(This, object);
1483 struct d3dx_technique *technique = is_valid_technique(This, object);
1484 UINT annotation_count = 0, i;
1485 D3DXHANDLE *annotation_handles = NULL;
1487 FIXME("iface %p, object %p, name %s partial stub\n", This, object, debugstr_a(name));
1491 WARN("Invalid argument specified\n");
1497 annotation_count = pass->annotation_count;
1498 annotation_handles = pass->annotation_handles;
1502 annotation_count = technique->annotation_count;
1503 annotation_handles = technique->annotation_handles;
1507 if (!param) param = get_parameter_by_name(This, NULL, object);
1511 annotation_count = param->annotation_count;
1512 annotation_handles = param->annotation_handles;
1515 /* Todo: add funcs */
1517 for (i = 0; i < annotation_count; i++)
1519 struct d3dx_parameter *anno = get_parameter_struct(annotation_handles[i]);
1521 if (!strcmp(anno->name, name))
1523 TRACE("Returning parameter %p\n", anno);
1524 return get_parameter_handle(anno);
1528 WARN("Invalid argument specified\n");
1533 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1535 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1537 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This, parameter, data, bytes);
1542 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1544 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1545 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1547 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1549 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1552 WARN("Invalid parameter %p specified\n", parameter);
1553 return D3DERR_INVALIDCALL;
1556 /* samplers don't touch data */
1557 if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
1558 || param->type == D3DXPT_SAMPLER1D || param->type == D3DXPT_SAMPLER2D
1559 || param->type == D3DXPT_SAMPLER3D || param->type == D3DXPT_SAMPLERCUBE))
1561 TRACE("Sampler: returning E_FAIL\n");
1565 if (data && param->bytes <= bytes)
1567 TRACE("Type %s\n", debug_d3dxparameter_type(param->type));
1569 switch (param->type)
1578 case D3DXPT_VERTEXSHADER:
1579 case D3DXPT_PIXELSHADER:
1580 case D3DXPT_TEXTURE:
1581 case D3DXPT_TEXTURE1D:
1582 case D3DXPT_TEXTURE2D:
1583 case D3DXPT_TEXTURE3D:
1584 case D3DXPT_TEXTURECUBE:
1588 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
1590 IUnknown *unk = ((IUnknown **)param->data)[i];
1591 if (unk) IUnknown_AddRef(unk);
1597 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
1601 TRACE("Copy %u bytes\n", param->bytes);
1602 memcpy(data, param->data, param->bytes);
1606 WARN("Invalid argument specified\n");
1608 return D3DERR_INVALIDCALL;
1611 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
1613 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1615 FIXME("iface %p, parameter %p, b %u stub\n", This, parameter, b);
1620 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
1622 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1623 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1625 TRACE("iface %p, parameter %p, b %p\n", This, parameter, b);
1627 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1629 if (b && param && !param->element_count && param->class == D3DXPC_SCALAR)
1631 *b = get_bool(param->data);
1632 TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
1636 WARN("Invalid argument specified\n");
1638 return D3DERR_INVALIDCALL;
1641 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1643 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1645 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This, parameter, b, count);
1650 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1652 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1653 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1655 TRACE("iface %p, parameter %p, b %p, count %u\n", This, parameter, b, count);
1657 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1659 if (b && param && (param->class == D3DXPC_SCALAR
1660 || param->class == D3DXPC_VECTOR
1661 || param->class == D3DXPC_MATRIX_ROWS
1662 || param->class == D3DXPC_MATRIX_COLUMNS))
1664 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1666 for (i = 0; i < size; ++i)
1668 b[i] = get_bool((DWORD *)param->data + i);
1673 WARN("Invalid argument specified\n");
1675 return D3DERR_INVALIDCALL;
1678 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
1680 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1682 FIXME("iface %p, parameter %p, n %u stub\n", This, parameter, n);
1687 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1689 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1690 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1692 TRACE("iface %p, parameter %p, n %p\n", This, parameter, n);
1694 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1696 if (n && param && !param->element_count && param->class == D3DXPC_SCALAR)
1698 *n = get_int(param->type, param->data);
1699 TRACE("Returning %i\n", *n);
1703 WARN("Invalid argument specified\n");
1705 return D3DERR_INVALIDCALL;
1708 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1710 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1712 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This, parameter, n, count);
1717 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1719 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1720 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1722 TRACE("iface %p, parameter %p, n %p, count %u\n", This, parameter, n, count);
1724 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1726 if (n && param && (param->class == D3DXPC_SCALAR
1727 || param->class == D3DXPC_VECTOR
1728 || param->class == D3DXPC_MATRIX_ROWS
1729 || param->class == D3DXPC_MATRIX_COLUMNS))
1731 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1733 for (i = 0; i < size; ++i)
1735 n[i] = get_int(param->type, (DWORD *)param->data + i);
1740 WARN("Invalid argument specified\n");
1742 return D3DERR_INVALIDCALL;
1745 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1747 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1749 FIXME("iface %p, parameter %p, f %f stub\n", This, parameter, f);
1754 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1756 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1757 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1759 TRACE("iface %p, parameter %p, f %p\n", This, parameter, f);
1761 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1763 if (f && param && !param->element_count && param->class == D3DXPC_SCALAR)
1766 TRACE("Returning %f\n", *f);
1770 WARN("Invalid argument specified\n");
1772 return D3DERR_INVALIDCALL;
1775 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1777 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1779 FIXME("iface %p, parameter %p, f %p, count %u stub\n", This, parameter, f, count);
1784 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1786 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1787 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1789 TRACE("iface %p, parameter %p, f %p, count %u\n", This, parameter, f, count);
1791 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1793 if (f && param && (param->class == D3DXPC_SCALAR
1794 || param->class == D3DXPC_VECTOR
1795 || param->class == D3DXPC_MATRIX_ROWS
1796 || param->class == D3DXPC_MATRIX_COLUMNS))
1798 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1800 for (i = 0; i < size; ++i)
1802 f[i] = get_float(param->type, (DWORD *)param->data + i);
1807 WARN("Invalid argument specified\n");
1809 return D3DERR_INVALIDCALL;
1812 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect* iface, D3DXHANDLE parameter, CONST D3DXVECTOR4* vector)
1814 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1816 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1821 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
1823 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1825 FIXME("iface %p, parameter %p, vector %p stub\n", This, parameter, vector);
1830 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
1832 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1834 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1839 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
1841 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1843 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
1848 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1850 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1852 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1857 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1859 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1861 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1866 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1868 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1870 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1875 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1877 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1879 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1884 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1886 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1888 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1893 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1895 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1897 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1902 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
1904 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1906 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1911 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
1913 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1915 FIXME("iface %p, parameter %p, matrix %p stub\n", This, parameter, matrix);
1920 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
1922 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1924 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1929 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
1931 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1933 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1938 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
1940 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1942 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1947 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
1949 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1951 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This, parameter, matrix, count);
1956 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
1958 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1960 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
1965 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
1967 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1968 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
1970 TRACE("iface %p, parameter %p, string %p\n", This, parameter, string);
1972 if (!param) param = get_parameter_by_name(This, NULL, parameter);
1974 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
1976 *string = *(LPCSTR *)param->data;
1977 TRACE("Returning %s\n", debugstr_a(*string));
1981 WARN("Invalid argument specified\n");
1983 return D3DERR_INVALIDCALL;
1986 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
1988 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1990 FIXME("iface %p, parameter %p, texture %p stub\n", This, parameter, texture);
1995 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
1997 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1998 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
2000 TRACE("iface %p, parameter %p, texture %p\n", This, parameter, texture);
2002 if (texture && param && !param->element_count &&
2003 (param->type == D3DXPT_TEXTURE || param->type == D3DXPT_TEXTURE1D
2004 || param->type == D3DXPT_TEXTURE2D || param->type == D3DXPT_TEXTURE3D
2005 || param->type == D3DXPT_TEXTURECUBE))
2007 *texture = *(LPDIRECT3DBASETEXTURE9 *)param->data;
2008 if (*texture) IDirect3DBaseTexture9_AddRef(*texture);
2009 TRACE("Returning %p\n", *texture);
2013 WARN("Invalid argument specified\n");
2015 return D3DERR_INVALIDCALL;
2018 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2020 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2021 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
2023 TRACE("iface %p, parameter %p, pshader %p\n", This, parameter, pshader);
2025 if (!param) param = get_parameter_by_name(This, NULL, parameter);
2027 if (pshader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
2029 *pshader = *(LPDIRECT3DPIXELSHADER9 *)param->data;
2030 if (*pshader) IDirect3DPixelShader9_AddRef(*pshader);
2031 TRACE("Returning %p\n", *pshader);
2035 WARN("Invalid argument specified\n");
2037 return D3DERR_INVALIDCALL;
2040 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2042 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2043 struct d3dx_parameter *param = is_valid_parameter(This, parameter);
2045 TRACE("iface %p, parameter %p, vshader %p\n", This, parameter, vshader);
2047 if (!param) param = get_parameter_by_name(This, NULL, parameter);
2049 if (vshader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
2051 *vshader = *(LPDIRECT3DVERTEXSHADER9 *)param->data;
2052 if (*vshader) IDirect3DVertexShader9_AddRef(*vshader);
2053 TRACE("Returning %p\n", *vshader);
2057 WARN("Invalid argument specified\n");
2059 return D3DERR_INVALIDCALL;
2062 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2064 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2066 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
2071 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
2073 /*** IUnknown methods ***/
2074 ID3DXBaseEffectImpl_QueryInterface,
2075 ID3DXBaseEffectImpl_AddRef,
2076 ID3DXBaseEffectImpl_Release,
2077 /*** ID3DXBaseEffect methods ***/
2078 ID3DXBaseEffectImpl_GetDesc,
2079 ID3DXBaseEffectImpl_GetParameterDesc,
2080 ID3DXBaseEffectImpl_GetTechniqueDesc,
2081 ID3DXBaseEffectImpl_GetPassDesc,
2082 ID3DXBaseEffectImpl_GetFunctionDesc,
2083 ID3DXBaseEffectImpl_GetParameter,
2084 ID3DXBaseEffectImpl_GetParameterByName,
2085 ID3DXBaseEffectImpl_GetParameterBySemantic,
2086 ID3DXBaseEffectImpl_GetParameterElement,
2087 ID3DXBaseEffectImpl_GetTechnique,
2088 ID3DXBaseEffectImpl_GetTechniqueByName,
2089 ID3DXBaseEffectImpl_GetPass,
2090 ID3DXBaseEffectImpl_GetPassByName,
2091 ID3DXBaseEffectImpl_GetFunction,
2092 ID3DXBaseEffectImpl_GetFunctionByName,
2093 ID3DXBaseEffectImpl_GetAnnotation,
2094 ID3DXBaseEffectImpl_GetAnnotationByName,
2095 ID3DXBaseEffectImpl_SetValue,
2096 ID3DXBaseEffectImpl_GetValue,
2097 ID3DXBaseEffectImpl_SetBool,
2098 ID3DXBaseEffectImpl_GetBool,
2099 ID3DXBaseEffectImpl_SetBoolArray,
2100 ID3DXBaseEffectImpl_GetBoolArray,
2101 ID3DXBaseEffectImpl_SetInt,
2102 ID3DXBaseEffectImpl_GetInt,
2103 ID3DXBaseEffectImpl_SetIntArray,
2104 ID3DXBaseEffectImpl_GetIntArray,
2105 ID3DXBaseEffectImpl_SetFloat,
2106 ID3DXBaseEffectImpl_GetFloat,
2107 ID3DXBaseEffectImpl_SetFloatArray,
2108 ID3DXBaseEffectImpl_GetFloatArray,
2109 ID3DXBaseEffectImpl_SetVector,
2110 ID3DXBaseEffectImpl_GetVector,
2111 ID3DXBaseEffectImpl_SetVectorArray,
2112 ID3DXBaseEffectImpl_GetVectorArray,
2113 ID3DXBaseEffectImpl_SetMatrix,
2114 ID3DXBaseEffectImpl_GetMatrix,
2115 ID3DXBaseEffectImpl_SetMatrixArray,
2116 ID3DXBaseEffectImpl_GetMatrixArray,
2117 ID3DXBaseEffectImpl_SetMatrixPointerArray,
2118 ID3DXBaseEffectImpl_GetMatrixPointerArray,
2119 ID3DXBaseEffectImpl_SetMatrixTranspose,
2120 ID3DXBaseEffectImpl_GetMatrixTranspose,
2121 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
2122 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
2123 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
2124 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
2125 ID3DXBaseEffectImpl_SetString,
2126 ID3DXBaseEffectImpl_GetString,
2127 ID3DXBaseEffectImpl_SetTexture,
2128 ID3DXBaseEffectImpl_GetTexture,
2129 ID3DXBaseEffectImpl_GetPixelShader,
2130 ID3DXBaseEffectImpl_GetVertexShader,
2131 ID3DXBaseEffectImpl_SetArrayRange,
2134 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
2136 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
2139 /*** IUnknown methods ***/
2140 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
2142 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2144 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
2146 if (IsEqualGUID(riid, &IID_IUnknown) ||
2147 IsEqualGUID(riid, &IID_ID3DXEffect))
2149 This->ID3DXEffect_iface.lpVtbl->AddRef(iface);
2154 ERR("Interface %s not found\n", debugstr_guid(riid));
2156 return E_NOINTERFACE;
2159 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
2161 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2163 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
2165 return InterlockedIncrement(&This->ref);
2168 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
2170 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2171 ULONG ref = InterlockedDecrement(&This->ref);
2173 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
2178 HeapFree(GetProcessHeap(), 0, This);
2184 /*** ID3DXBaseEffect methods ***/
2185 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
2187 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2188 ID3DXBaseEffect *base = This->base_effect;
2190 TRACE("Forward iface %p, base %p\n", This, base);
2192 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2195 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2197 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2198 ID3DXBaseEffect *base = This->base_effect;
2200 TRACE("Forward iface %p, base %p\n", This, base);
2202 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2205 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2207 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2208 ID3DXBaseEffect *base = This->base_effect;
2210 TRACE("Forward iface %p, base %p\n", This, base);
2212 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2215 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2217 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2218 ID3DXBaseEffect *base = This->base_effect;
2220 TRACE("Forward iface %p, base %p\n", This, base);
2222 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2225 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2227 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2228 ID3DXBaseEffect *base = This->base_effect;
2230 TRACE("Forward iface %p, base %p\n", This, base);
2232 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2235 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
2237 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2238 ID3DXBaseEffect *base = This->base_effect;
2240 TRACE("Forward iface %p, base %p\n", This, base);
2242 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2245 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
2247 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2248 ID3DXBaseEffect *base = This->base_effect;
2250 TRACE("Forward iface %p, base %p\n", This, base);
2252 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2255 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
2257 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2258 ID3DXBaseEffect *base = This->base_effect;
2260 TRACE("Forward iface %p, base %p\n", This, base);
2262 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2265 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
2267 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2268 ID3DXBaseEffect *base = This->base_effect;
2270 TRACE("Forward iface %p, base %p\n", This, base);
2272 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2275 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
2277 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2278 ID3DXBaseEffect *base = This->base_effect;
2280 TRACE("Forward iface %p, base %p\n", This, base);
2282 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2285 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
2287 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2288 ID3DXBaseEffect *base = This->base_effect;
2290 TRACE("Forward iface %p, base %p\n", This, base);
2292 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2295 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
2297 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2298 ID3DXBaseEffect *base = This->base_effect;
2300 TRACE("Forward iface %p, base %p\n", This, base);
2302 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2305 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
2307 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2308 ID3DXBaseEffect *base = This->base_effect;
2310 TRACE("Forward iface %p, base %p\n", This, base);
2312 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2315 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
2317 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2318 ID3DXBaseEffect *base = This->base_effect;
2320 TRACE("Forward iface %p, base %p\n", This, base);
2322 return ID3DXBaseEffectImpl_GetFunction(base, index);
2325 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
2327 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2328 ID3DXBaseEffect *base = This->base_effect;
2330 TRACE("Forward iface %p, base %p\n", This, base);
2332 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
2335 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
2337 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2338 ID3DXBaseEffect *base = This->base_effect;
2340 TRACE("Forward iface %p, base %p\n", This, base);
2342 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
2345 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
2347 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2348 ID3DXBaseEffect *base = This->base_effect;
2350 TRACE("Forward iface %p, base %p\n", This, base);
2352 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
2355 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
2357 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2358 ID3DXBaseEffect *base = This->base_effect;
2360 TRACE("Forward iface %p, base %p\n", This, base);
2362 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
2365 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
2367 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2368 ID3DXBaseEffect *base = This->base_effect;
2370 TRACE("Forward iface %p, base %p\n", This, base);
2372 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
2375 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
2377 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2378 ID3DXBaseEffect *base = This->base_effect;
2380 TRACE("Forward iface %p, base %p\n", This, base);
2382 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
2385 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
2387 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2388 ID3DXBaseEffect *base = This->base_effect;
2390 TRACE("Forward iface %p, base %p\n", This, base);
2392 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
2395 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
2397 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2398 ID3DXBaseEffect *base = This->base_effect;
2400 TRACE("Forward iface %p, base %p\n", This, base);
2402 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
2405 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
2407 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2408 ID3DXBaseEffect *base = This->base_effect;
2410 TRACE("Forward iface %p, base %p\n", This, base);
2412 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
2415 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
2417 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2418 ID3DXBaseEffect *base = This->base_effect;
2420 TRACE("Forward iface %p, base %p\n", This, base);
2422 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
2425 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
2427 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2428 ID3DXBaseEffect *base = This->base_effect;
2430 TRACE("Forward iface %p, base %p\n", This, base);
2432 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
2435 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
2437 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2438 ID3DXBaseEffect *base = This->base_effect;
2440 TRACE("Forward iface %p, base %p\n", This, base);
2442 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
2445 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
2447 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2448 ID3DXBaseEffect *base = This->base_effect;
2450 TRACE("Forward iface %p, base %p\n", This, base);
2452 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
2455 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
2457 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2458 ID3DXBaseEffect *base = This->base_effect;
2460 TRACE("Forward iface %p, base %p\n", This, base);
2462 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
2465 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
2467 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2468 ID3DXBaseEffect *base = This->base_effect;
2470 TRACE("Forward iface %p, base %p\n", This, base);
2472 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
2475 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
2477 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2478 ID3DXBaseEffect *base = This->base_effect;
2480 TRACE("Forward iface %p, base %p\n", This, base);
2482 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
2485 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
2487 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2488 ID3DXBaseEffect *base = This->base_effect;
2490 TRACE("Forward iface %p, base %p\n", This, base);
2492 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
2495 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2497 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2498 ID3DXBaseEffect *base = This->base_effect;
2500 TRACE("Forward iface %p, base %p\n", This, base);
2502 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
2505 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2507 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2508 ID3DXBaseEffect *base = This->base_effect;
2510 TRACE("Forward iface %p, base %p\n", This, base);
2512 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
2515 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2517 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2518 ID3DXBaseEffect *base = This->base_effect;
2520 TRACE("Forward iface %p, base %p\n", This, base);
2522 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
2525 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2527 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2528 ID3DXBaseEffect *base = This->base_effect;
2530 TRACE("Forward iface %p, base %p\n", This, base);
2532 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
2535 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2537 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2538 ID3DXBaseEffect *base = This->base_effect;
2540 TRACE("Forward iface %p, base %p\n", This, base);
2542 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
2545 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2547 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2548 ID3DXBaseEffect *base = This->base_effect;
2550 TRACE("Forward iface %p, base %p\n", This, base);
2552 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
2555 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2557 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2558 ID3DXBaseEffect *base = This->base_effect;
2560 TRACE("Forward iface %p, base %p\n", This, base);
2562 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
2565 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2567 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2568 ID3DXBaseEffect *base = This->base_effect;
2570 TRACE("Forward iface %p, base %p\n", This, base);
2572 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
2575 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2577 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2578 ID3DXBaseEffect *base = This->base_effect;
2580 TRACE("Forward iface %p, base %p\n", This, base);
2582 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
2585 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2587 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2588 ID3DXBaseEffect *base = This->base_effect;
2590 TRACE("Forward iface %p, base %p\n", This, base);
2592 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
2595 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2597 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2598 ID3DXBaseEffect *base = This->base_effect;
2600 TRACE("Forward iface %p, base %p\n", This, base);
2602 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
2605 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2607 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2608 ID3DXBaseEffect *base = This->base_effect;
2610 TRACE("Forward iface %p, base %p\n", This, base);
2612 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
2615 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2617 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2618 ID3DXBaseEffect *base = This->base_effect;
2620 TRACE("Forward iface %p, base %p\n", This, base);
2622 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
2625 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2627 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2628 ID3DXBaseEffect *base = This->base_effect;
2630 TRACE("Forward iface %p, base %p\n", This, base);
2632 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
2635 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2637 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2638 ID3DXBaseEffect *base = This->base_effect;
2640 TRACE("Forward iface %p, base %p\n", This, base);
2642 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
2645 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2647 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2648 ID3DXBaseEffect *base = This->base_effect;
2650 TRACE("Forward iface %p, base %p\n", This, base);
2652 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
2655 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
2657 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2658 ID3DXBaseEffect *base = This->base_effect;
2660 TRACE("Forward iface %p, base %p\n", This, base);
2662 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
2665 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
2667 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2668 ID3DXBaseEffect *base = This->base_effect;
2670 TRACE("Forward iface %p, base %p\n", This, base);
2672 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
2675 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
2677 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2678 ID3DXBaseEffect *base = This->base_effect;
2680 TRACE("Forward iface %p, base %p\n", This, base);
2682 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
2685 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
2687 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2688 ID3DXBaseEffect *base = This->base_effect;
2690 TRACE("Forward iface %p, base %p\n", This, base);
2692 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
2695 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
2697 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2698 ID3DXBaseEffect *base = This->base_effect;
2700 TRACE("Forward iface %p, base %p\n", This, base);
2702 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
2705 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(ID3DXEffect *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
2707 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2708 ID3DXBaseEffect *base = This->base_effect;
2710 TRACE("Forward iface %p, base %p\n", This, base);
2712 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
2715 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2717 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2718 ID3DXBaseEffect *base = This->base_effect;
2720 TRACE("Forward iface %p, base %p\n", This, base);
2722 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
2725 /*** ID3DXEffect methods ***/
2726 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, LPD3DXEFFECTPOOL *pool)
2728 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2730 TRACE("iface %p, pool %p\n", This, pool);
2734 WARN("Invalid argument supplied.\n");
2735 return D3DERR_INVALIDCALL;
2740 This->pool->lpVtbl->AddRef(This->pool);
2745 TRACE("Returning pool %p\n", *pool);
2750 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect *iface, D3DXHANDLE technique)
2752 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2753 struct ID3DXBaseEffectImpl *base = impl_from_ID3DXBaseEffect(This->base_effect);
2754 struct d3dx_technique *tech = is_valid_technique(base, technique);
2756 TRACE("iface %p, technique %p\n", This, technique);
2758 if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
2764 for (i = 0; i < base->technique_count; ++i)
2766 struct d3dx_technique *t = get_technique_struct(base->technique_handles[i]);
2770 This->active_technique = get_technique_handle(t);
2771 TRACE("Technique %u (%p)\n", i, tech);
2777 WARN("Invalid argument supplied.\n");
2779 return D3DERR_INVALIDCALL;
2782 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect *iface)
2784 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2786 TRACE("iface %p\n", This);
2788 return This->active_technique;
2791 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
2793 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2795 FIXME("(%p)->(%p): stub\n", This, technique);
2800 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
2802 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2804 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
2809 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
2811 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2813 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
2818 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DWORD flags)
2820 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2821 struct d3dx_technique *technique = get_technique_struct(This->active_technique);
2823 FIXME("iface %p, passes %p, flags %#x partial stub\n", This, passes, flags);
2825 if (passes && technique)
2827 if (This->manager || flags & D3DXFX_DONOTSAVESTATE)
2829 TRACE("State capturing disabled.\n");
2833 FIXME("State capturing not supported, yet!\n");
2836 *passes = technique->pass_count;
2841 WARN("Invalid argument supplied.\n");
2843 return D3DERR_INVALIDCALL;
2846 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect *iface, UINT pass)
2848 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2849 struct d3dx_technique *technique = get_technique_struct(This->active_technique);
2851 TRACE("iface %p, pass %u\n", This, pass);
2853 if (technique && pass < technique->pass_count && !This->active_pass)
2855 This->active_pass = technique->pass_handles[pass];
2857 FIXME("No states applied, yet!\n");
2862 WARN("Invalid argument supplied.\n");
2864 return D3DERR_INVALIDCALL;
2867 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
2869 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2871 FIXME("(%p)->(): stub\n", This);
2876 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect *iface)
2878 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2880 TRACE("iface %p\n", This);
2882 if (This->active_pass)
2884 This->active_pass = NULL;
2888 WARN("Invalid call.\n");
2890 return D3DERR_INVALIDCALL;
2893 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
2895 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2897 FIXME("(%p)->(): stub\n", This);
2902 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, LPDIRECT3DDEVICE9 *device)
2904 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2906 TRACE("iface %p, device %p\n", This, device);
2910 WARN("Invalid argument supplied.\n");
2911 return D3DERR_INVALIDCALL;
2914 IDirect3DDevice9_AddRef(This->device);
2916 *device = This->device;
2918 TRACE("Returning device %p\n", *device);
2923 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
2925 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2927 FIXME("(%p)->(): stub\n", This);
2932 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
2934 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2936 FIXME("(%p)->(): stub\n", This);
2941 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect *iface, LPD3DXEFFECTSTATEMANAGER manager)
2943 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2945 TRACE("iface %p, manager %p\n", This, manager);
2947 if (This->manager) IUnknown_Release(This->manager);
2948 if (manager) IUnknown_AddRef(manager);
2950 This->manager = manager;
2955 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect *iface, LPD3DXEFFECTSTATEMANAGER *manager)
2957 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2959 TRACE("iface %p, manager %p\n", This, manager);
2963 WARN("Invalid argument supplied.\n");
2964 return D3DERR_INVALIDCALL;
2967 if (This->manager) IUnknown_AddRef(This->manager);
2968 *manager = This->manager;
2973 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
2975 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2977 FIXME("(%p)->(): stub\n", This);
2982 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
2984 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2986 FIXME("(%p)->(): stub\n", This);
2991 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
2993 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2995 FIXME("(%p)->(%p): stub\n", This, parameter_block);
3000 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
3002 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3004 FIXME("(%p)->(%p): stub\n", This, parameter_block);
3009 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect* iface, LPDIRECT3DDEVICE9 device, LPD3DXEFFECT* effect)
3011 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3013 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
3018 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
3020 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3022 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
3027 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
3029 /*** IUnknown methods ***/
3030 ID3DXEffectImpl_QueryInterface,
3031 ID3DXEffectImpl_AddRef,
3032 ID3DXEffectImpl_Release,
3033 /*** ID3DXBaseEffect methods ***/
3034 ID3DXEffectImpl_GetDesc,
3035 ID3DXEffectImpl_GetParameterDesc,
3036 ID3DXEffectImpl_GetTechniqueDesc,
3037 ID3DXEffectImpl_GetPassDesc,
3038 ID3DXEffectImpl_GetFunctionDesc,
3039 ID3DXEffectImpl_GetParameter,
3040 ID3DXEffectImpl_GetParameterByName,
3041 ID3DXEffectImpl_GetParameterBySemantic,
3042 ID3DXEffectImpl_GetParameterElement,
3043 ID3DXEffectImpl_GetTechnique,
3044 ID3DXEffectImpl_GetTechniqueByName,
3045 ID3DXEffectImpl_GetPass,
3046 ID3DXEffectImpl_GetPassByName,
3047 ID3DXEffectImpl_GetFunction,
3048 ID3DXEffectImpl_GetFunctionByName,
3049 ID3DXEffectImpl_GetAnnotation,
3050 ID3DXEffectImpl_GetAnnotationByName,
3051 ID3DXEffectImpl_SetValue,
3052 ID3DXEffectImpl_GetValue,
3053 ID3DXEffectImpl_SetBool,
3054 ID3DXEffectImpl_GetBool,
3055 ID3DXEffectImpl_SetBoolArray,
3056 ID3DXEffectImpl_GetBoolArray,
3057 ID3DXEffectImpl_SetInt,
3058 ID3DXEffectImpl_GetInt,
3059 ID3DXEffectImpl_SetIntArray,
3060 ID3DXEffectImpl_GetIntArray,
3061 ID3DXEffectImpl_SetFloat,
3062 ID3DXEffectImpl_GetFloat,
3063 ID3DXEffectImpl_SetFloatArray,
3064 ID3DXEffectImpl_GetFloatArray,
3065 ID3DXEffectImpl_SetVector,
3066 ID3DXEffectImpl_GetVector,
3067 ID3DXEffectImpl_SetVectorArray,
3068 ID3DXEffectImpl_GetVectorArray,
3069 ID3DXEffectImpl_SetMatrix,
3070 ID3DXEffectImpl_GetMatrix,
3071 ID3DXEffectImpl_SetMatrixArray,
3072 ID3DXEffectImpl_GetMatrixArray,
3073 ID3DXEffectImpl_SetMatrixPointerArray,
3074 ID3DXEffectImpl_GetMatrixPointerArray,
3075 ID3DXEffectImpl_SetMatrixTranspose,
3076 ID3DXEffectImpl_GetMatrixTranspose,
3077 ID3DXEffectImpl_SetMatrixTransposeArray,
3078 ID3DXEffectImpl_GetMatrixTransposeArray,
3079 ID3DXEffectImpl_SetMatrixTransposePointerArray,
3080 ID3DXEffectImpl_GetMatrixTransposePointerArray,
3081 ID3DXEffectImpl_SetString,
3082 ID3DXEffectImpl_GetString,
3083 ID3DXEffectImpl_SetTexture,
3084 ID3DXEffectImpl_GetTexture,
3085 ID3DXEffectImpl_GetPixelShader,
3086 ID3DXEffectImpl_GetVertexShader,
3087 ID3DXEffectImpl_SetArrayRange,
3088 /*** ID3DXEffect methods ***/
3089 ID3DXEffectImpl_GetPool,
3090 ID3DXEffectImpl_SetTechnique,
3091 ID3DXEffectImpl_GetCurrentTechnique,
3092 ID3DXEffectImpl_ValidateTechnique,
3093 ID3DXEffectImpl_FindNextValidTechnique,
3094 ID3DXEffectImpl_IsParameterUsed,
3095 ID3DXEffectImpl_Begin,
3096 ID3DXEffectImpl_BeginPass,
3097 ID3DXEffectImpl_CommitChanges,
3098 ID3DXEffectImpl_EndPass,
3099 ID3DXEffectImpl_End,
3100 ID3DXEffectImpl_GetDevice,
3101 ID3DXEffectImpl_OnLostDevice,
3102 ID3DXEffectImpl_OnResetDevice,
3103 ID3DXEffectImpl_SetStateManager,
3104 ID3DXEffectImpl_GetStateManager,
3105 ID3DXEffectImpl_BeginParameterBlock,
3106 ID3DXEffectImpl_EndParameterBlock,
3107 ID3DXEffectImpl_ApplyParameterBlock,
3108 ID3DXEffectImpl_DeleteParameterBlock,
3109 ID3DXEffectImpl_CloneEffect,
3110 ID3DXEffectImpl_SetRawValue
3113 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
3115 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
3118 /*** IUnknown methods ***/
3119 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
3121 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3123 TRACE("iface %p, riid %s, object %p\n", This, debugstr_guid(riid), object);
3125 if (IsEqualGUID(riid, &IID_IUnknown) ||
3126 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
3128 This->ID3DXEffectCompiler_iface.lpVtbl->AddRef(iface);
3133 ERR("Interface %s not found\n", debugstr_guid(riid));
3135 return E_NOINTERFACE;
3138 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
3140 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3142 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
3144 return InterlockedIncrement(&This->ref);
3147 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
3149 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3150 ULONG ref = InterlockedDecrement(&This->ref);
3152 TRACE("iface %p: Release from %u\n", iface, ref + 1);
3156 free_effect_compiler(This);
3157 HeapFree(GetProcessHeap(), 0, This);
3163 /*** ID3DXBaseEffect methods ***/
3164 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
3166 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3167 ID3DXBaseEffect *base = This->base_effect;
3169 TRACE("Forward iface %p, base %p\n", This, base);
3171 return ID3DXBaseEffectImpl_GetDesc(base, desc);
3174 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
3176 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3177 ID3DXBaseEffect *base = This->base_effect;
3179 TRACE("Forward iface %p, base %p\n", This, base);
3181 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
3184 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
3186 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3187 ID3DXBaseEffect *base = This->base_effect;
3189 TRACE("Forward iface %p, base %p\n", This, base);
3191 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
3194 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
3196 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3197 ID3DXBaseEffect *base = This->base_effect;
3199 TRACE("Forward iface %p, base %p\n", This, base);
3201 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
3204 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
3206 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3207 ID3DXBaseEffect *base = This->base_effect;
3209 TRACE("Forward iface %p, base %p\n", This, base);
3211 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
3214 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
3216 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3217 ID3DXBaseEffect *base = This->base_effect;
3219 TRACE("Forward iface %p, base %p\n", This, base);
3221 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
3224 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
3226 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3227 ID3DXBaseEffect *base = This->base_effect;
3229 TRACE("Forward iface %p, base %p\n", This, base);
3231 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
3234 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
3236 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3237 ID3DXBaseEffect *base = This->base_effect;
3239 TRACE("Forward iface %p, base %p\n", This, base);
3241 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
3244 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
3246 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3247 ID3DXBaseEffect *base = This->base_effect;
3249 TRACE("Forward iface %p, base %p\n", This, base);
3251 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
3254 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
3256 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3257 ID3DXBaseEffect *base = This->base_effect;
3259 TRACE("Forward iface %p, base %p\n", This, base);
3261 return ID3DXBaseEffectImpl_GetTechnique(base, index);
3264 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
3266 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3267 ID3DXBaseEffect *base = This->base_effect;
3269 TRACE("Forward iface %p, base %p\n", This, base);
3271 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
3274 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
3276 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3277 ID3DXBaseEffect *base = This->base_effect;
3279 TRACE("Forward iface %p, base %p\n", This, base);
3281 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
3284 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
3286 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3287 ID3DXBaseEffect *base = This->base_effect;
3289 TRACE("Forward iface %p, base %p\n", This, base);
3291 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
3294 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
3296 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3297 ID3DXBaseEffect *base = This->base_effect;
3299 TRACE("Forward iface %p, base %p\n", This, base);
3301 return ID3DXBaseEffectImpl_GetFunction(base, index);
3304 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
3306 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3307 ID3DXBaseEffect *base = This->base_effect;
3309 TRACE("Forward iface %p, base %p\n", This, base);
3311 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
3314 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
3316 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3317 ID3DXBaseEffect *base = This->base_effect;
3319 TRACE("Forward iface %p, base %p\n", This, base);
3321 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
3324 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
3326 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3327 ID3DXBaseEffect *base = This->base_effect;
3329 TRACE("Forward iface %p, base %p\n", This, base);
3331 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
3334 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
3336 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3337 ID3DXBaseEffect *base = This->base_effect;
3339 TRACE("Forward iface %p, base %p\n", This, base);
3341 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
3344 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
3346 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3347 ID3DXBaseEffect *base = This->base_effect;
3349 TRACE("Forward iface %p, base %p\n", This, base);
3351 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
3354 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
3356 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3357 ID3DXBaseEffect *base = This->base_effect;
3359 TRACE("Forward iface %p, base %p\n", This, base);
3361 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
3364 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
3366 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3367 ID3DXBaseEffect *base = This->base_effect;
3369 TRACE("Forward iface %p, base %p\n", This, base);
3371 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
3374 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
3376 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3377 ID3DXBaseEffect *base = This->base_effect;
3379 TRACE("Forward iface %p, base %p\n", This, base);
3381 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
3384 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
3386 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3387 ID3DXBaseEffect *base = This->base_effect;
3389 TRACE("Forward iface %p, base %p\n", This, base);
3391 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
3394 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
3396 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3397 ID3DXBaseEffect *base = This->base_effect;
3399 TRACE("Forward iface %p, base %p\n", This, base);
3401 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
3404 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
3406 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3407 ID3DXBaseEffect *base = This->base_effect;
3409 TRACE("Forward iface %p, base %p\n", This, base);
3411 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
3414 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
3416 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3417 ID3DXBaseEffect *base = This->base_effect;
3419 TRACE("Forward iface %p, base %p\n", This, base);
3421 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
3424 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
3426 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3427 ID3DXBaseEffect *base = This->base_effect;
3429 TRACE("Forward iface %p, base %p\n", This, base);
3431 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
3434 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
3436 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3437 ID3DXBaseEffect *base = This->base_effect;
3439 TRACE("Forward iface %p, base %p\n", This, base);
3441 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
3444 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
3446 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3447 ID3DXBaseEffect *base = This->base_effect;
3449 TRACE("Forward iface %p, base %p\n", This, base);
3451 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
3454 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
3456 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3457 ID3DXBaseEffect *base = This->base_effect;
3459 TRACE("Forward iface %p, base %p\n", This, base);
3461 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
3464 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
3466 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3467 ID3DXBaseEffect *base = This->base_effect;
3469 TRACE("Forward iface %p, base %p\n", This, base);
3471 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
3474 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
3476 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3477 ID3DXBaseEffect *base = This->base_effect;
3479 TRACE("Forward iface %p, base %p\n", This, base);
3481 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
3484 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
3486 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3487 ID3DXBaseEffect *base = This->base_effect;
3489 TRACE("Forward iface %p, base %p\n", This, base);
3491 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
3494 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
3496 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3497 ID3DXBaseEffect *base = This->base_effect;
3499 TRACE("Forward iface %p, base %p\n", This, base);
3501 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
3504 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
3506 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3507 ID3DXBaseEffect *base = This->base_effect;
3509 TRACE("Forward iface %p, base %p\n", This, base);
3511 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
3514 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3516 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3517 ID3DXBaseEffect *base = This->base_effect;
3519 TRACE("Forward iface %p, base %p\n", This, base);
3521 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
3524 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3526 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3527 ID3DXBaseEffect *base = This->base_effect;
3529 TRACE("Forward iface %p, base %p\n", This, base);
3531 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
3534 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3536 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3537 ID3DXBaseEffect *base = This->base_effect;
3539 TRACE("Forward iface %p, base %p\n", This, base);
3541 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
3544 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3546 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3547 ID3DXBaseEffect *base = This->base_effect;
3549 TRACE("Forward iface %p, base %p\n", This, base);
3551 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
3554 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3556 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3557 ID3DXBaseEffect *base = This->base_effect;
3559 TRACE("Forward iface %p, base %p\n", This, base);
3561 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
3564 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3566 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3567 ID3DXBaseEffect *base = This->base_effect;
3569 TRACE("Forward iface %p, base %p\n", This, base);
3571 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
3574 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3576 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3577 ID3DXBaseEffect *base = This->base_effect;
3579 TRACE("Forward iface %p, base %p\n", This, base);
3581 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
3584 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3586 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3587 ID3DXBaseEffect *base = This->base_effect;
3589 TRACE("Forward iface %p, base %p\n", This, base);
3591 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
3594 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3596 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3597 ID3DXBaseEffect *base = This->base_effect;
3599 TRACE("Forward iface %p, base %p\n", This, base);
3601 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
3604 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3606 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3607 ID3DXBaseEffect *base = This->base_effect;
3609 TRACE("Forward iface %p, base %p\n", This, base);
3611 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
3614 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3616 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3617 ID3DXBaseEffect *base = This->base_effect;
3619 TRACE("Forward iface %p, base %p\n", This, base);
3621 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
3624 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3626 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3627 ID3DXBaseEffect *base = This->base_effect;
3629 TRACE("Forward iface %p, base %p\n", This, base);
3631 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
3634 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
3636 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3637 ID3DXBaseEffect *base = This->base_effect;
3639 TRACE("Forward iface %p, base %p\n", This, base);
3641 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
3644 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
3646 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3647 ID3DXBaseEffect *base = This->base_effect;
3649 TRACE("Forward iface %p, base %p\n", This, base);
3651 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
3654 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 texture)
3656 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3657 ID3DXBaseEffect *base = This->base_effect;
3659 TRACE("Forward iface %p, base %p\n", This, base);
3661 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
3664 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DBASETEXTURE9 *texture)
3666 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3667 ID3DXBaseEffect *base = This->base_effect;
3669 TRACE("Forward iface %p, base %p\n", This, base);
3671 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
3674 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DPIXELSHADER9 *pshader)
3676 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3677 ID3DXBaseEffect *base = This->base_effect;
3679 TRACE("Forward iface %p, base %p\n", This, base);
3681 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, pshader);
3684 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPDIRECT3DVERTEXSHADER9 *vshader)
3686 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3687 ID3DXBaseEffect *base = This->base_effect;
3689 TRACE("Forward iface %p, base %p\n", This, base);
3691 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, vshader);
3694 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
3696 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3697 ID3DXBaseEffect *base = This->base_effect;
3699 TRACE("Forward iface %p, base %p\n", This, base);
3701 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
3704 /*** ID3DXEffectCompiler methods ***/
3705 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
3707 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3709 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
3714 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
3716 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3718 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
3723 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
3724 LPD3DXBUFFER *effect, LPD3DXBUFFER *error_msgs)
3726 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3728 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
3733 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
3734 LPCSTR target, DWORD flags, LPD3DXBUFFER *shader, LPD3DXBUFFER *error_msgs, LPD3DXCONSTANTTABLE *constant_table)
3736 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3738 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3739 This, function, target, flags, shader, error_msgs, constant_table);
3744 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
3746 /*** IUnknown methods ***/
3747 ID3DXEffectCompilerImpl_QueryInterface,
3748 ID3DXEffectCompilerImpl_AddRef,
3749 ID3DXEffectCompilerImpl_Release,
3750 /*** ID3DXBaseEffect methods ***/
3751 ID3DXEffectCompilerImpl_GetDesc,
3752 ID3DXEffectCompilerImpl_GetParameterDesc,
3753 ID3DXEffectCompilerImpl_GetTechniqueDesc,
3754 ID3DXEffectCompilerImpl_GetPassDesc,
3755 ID3DXEffectCompilerImpl_GetFunctionDesc,
3756 ID3DXEffectCompilerImpl_GetParameter,
3757 ID3DXEffectCompilerImpl_GetParameterByName,
3758 ID3DXEffectCompilerImpl_GetParameterBySemantic,
3759 ID3DXEffectCompilerImpl_GetParameterElement,
3760 ID3DXEffectCompilerImpl_GetTechnique,
3761 ID3DXEffectCompilerImpl_GetTechniqueByName,
3762 ID3DXEffectCompilerImpl_GetPass,
3763 ID3DXEffectCompilerImpl_GetPassByName,
3764 ID3DXEffectCompilerImpl_GetFunction,
3765 ID3DXEffectCompilerImpl_GetFunctionByName,
3766 ID3DXEffectCompilerImpl_GetAnnotation,
3767 ID3DXEffectCompilerImpl_GetAnnotationByName,
3768 ID3DXEffectCompilerImpl_SetValue,
3769 ID3DXEffectCompilerImpl_GetValue,
3770 ID3DXEffectCompilerImpl_SetBool,
3771 ID3DXEffectCompilerImpl_GetBool,
3772 ID3DXEffectCompilerImpl_SetBoolArray,
3773 ID3DXEffectCompilerImpl_GetBoolArray,
3774 ID3DXEffectCompilerImpl_SetInt,
3775 ID3DXEffectCompilerImpl_GetInt,
3776 ID3DXEffectCompilerImpl_SetIntArray,
3777 ID3DXEffectCompilerImpl_GetIntArray,
3778 ID3DXEffectCompilerImpl_SetFloat,
3779 ID3DXEffectCompilerImpl_GetFloat,
3780 ID3DXEffectCompilerImpl_SetFloatArray,
3781 ID3DXEffectCompilerImpl_GetFloatArray,
3782 ID3DXEffectCompilerImpl_SetVector,
3783 ID3DXEffectCompilerImpl_GetVector,
3784 ID3DXEffectCompilerImpl_SetVectorArray,
3785 ID3DXEffectCompilerImpl_GetVectorArray,
3786 ID3DXEffectCompilerImpl_SetMatrix,
3787 ID3DXEffectCompilerImpl_GetMatrix,
3788 ID3DXEffectCompilerImpl_SetMatrixArray,
3789 ID3DXEffectCompilerImpl_GetMatrixArray,
3790 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
3791 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
3792 ID3DXEffectCompilerImpl_SetMatrixTranspose,
3793 ID3DXEffectCompilerImpl_GetMatrixTranspose,
3794 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
3795 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
3796 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
3797 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
3798 ID3DXEffectCompilerImpl_SetString,
3799 ID3DXEffectCompilerImpl_GetString,
3800 ID3DXEffectCompilerImpl_SetTexture,
3801 ID3DXEffectCompilerImpl_GetTexture,
3802 ID3DXEffectCompilerImpl_GetPixelShader,
3803 ID3DXEffectCompilerImpl_GetVertexShader,
3804 ID3DXEffectCompilerImpl_SetArrayRange,
3805 /*** ID3DXEffectCompiler methods ***/
3806 ID3DXEffectCompilerImpl_SetLiteral,
3807 ID3DXEffectCompilerImpl_GetLiteral,
3808 ID3DXEffectCompilerImpl_CompileEffect,
3809 ID3DXEffectCompilerImpl_CompileShader,
3812 static HRESULT d3dx9_parse_sampler(struct d3dx_sampler *sampler, const char *data, const char **ptr, D3DXHANDLE *objects)
3816 struct d3dx_state *states;
3818 read_dword(ptr, &sampler->state_count);
3819 TRACE("Count: %u\n", sampler->state_count);
3821 states = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*states) * sampler->state_count);
3824 ERR("Out of memory\n");
3825 return E_OUTOFMEMORY;
3828 for (i = 0; i < sampler->state_count; ++i)
3830 hr = d3dx9_parse_state(&states[i], data, ptr, objects);
3833 WARN("Failed to parse state\n");
3838 sampler->states = states;
3844 for (i = 0; i < sampler->state_count; ++i)
3846 free_state(&states[i]);
3849 HeapFree(GetProcessHeap(), 0, states);
3854 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char *data, const char **ptr, D3DXHANDLE *objects)
3861 if (param->element_count)
3863 param->data = value;
3865 for (i = 0; i < param->element_count; ++i)
3867 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3869 hr = d3dx9_parse_value(member, value ? (char *)value + old_size : NULL, data, ptr, objects);
3872 WARN("Failed to parse value\n");
3876 old_size += member->bytes;
3882 switch(param->class)
3886 case D3DXPC_MATRIX_ROWS:
3887 case D3DXPC_MATRIX_COLUMNS:
3888 param->data = value;
3892 param->data = value;
3894 for (i = 0; i < param->member_count; ++i)
3896 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
3898 hr = d3dx9_parse_value(member, (char *)value + old_size, data, ptr, objects);
3901 WARN("Failed to parse value\n");
3905 old_size += member->bytes;
3910 switch (param->type)
3913 case D3DXPT_TEXTURE:
3914 case D3DXPT_TEXTURE1D:
3915 case D3DXPT_TEXTURE2D:
3916 case D3DXPT_TEXTURE3D:
3917 case D3DXPT_TEXTURECUBE:
3918 case D3DXPT_PIXELSHADER:
3919 case D3DXPT_VERTEXSHADER:
3920 read_dword(ptr, &id);
3921 TRACE("Id: %u\n", id);
3922 objects[id] = get_parameter_handle(param);
3923 param->data = value;
3926 case D3DXPT_SAMPLER:
3927 case D3DXPT_SAMPLER1D:
3928 case D3DXPT_SAMPLER2D:
3929 case D3DXPT_SAMPLER3D:
3930 case D3DXPT_SAMPLERCUBE:
3932 struct d3dx_sampler *sampler;
3934 sampler = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sampler));
3937 ERR("Out of memory\n");
3938 return E_OUTOFMEMORY;
3941 hr = d3dx9_parse_sampler(sampler, data, ptr, objects);
3944 HeapFree(GetProcessHeap(), 0, sampler);
3945 WARN("Failed to parse sampler\n");
3949 param->data = sampler;
3954 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
3960 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
3967 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *data, const char *ptr, D3DXHANDLE *objects)
3969 UINT size = param->bytes;
3973 TRACE("param size: %u\n", size);
3977 value = HeapAlloc(GetProcessHeap(), 0, size);
3980 ERR("Failed to allocate data memory.\n");
3981 return E_OUTOFMEMORY;
3984 TRACE("Data: %s.\n", debugstr_an(ptr, size));
3985 memcpy(value, ptr, size);
3988 hr = d3dx9_parse_value(param, value, data, &ptr, objects);
3991 WARN("Failed to parse value\n");
3992 HeapFree(GetProcessHeap(), 0, value);
3999 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
4003 read_dword(&ptr, &size);
4004 TRACE("Name size: %#x\n", size);
4011 *name = HeapAlloc(GetProcessHeap(), 0, size);
4014 ERR("Failed to allocate name memory.\n");
4015 return E_OUTOFMEMORY;
4018 TRACE("Name: %s.\n", debugstr_an(ptr, size));
4019 memcpy(*name, ptr, size);
4024 static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr, LPDIRECT3DDEVICE9 device)
4029 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type));
4031 read_dword(ptr, &size);
4032 TRACE("Data size: %#x\n", size);
4036 TRACE("Size is 0\n");
4037 *(void **)param->data = NULL;
4041 switch (param->type)
4044 /* re-read with size (sizeof(DWORD) = 4) */
4045 hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
4048 WARN("Failed to parse string data\n");
4053 case D3DXPT_VERTEXSHADER:
4054 hr = IDirect3DDevice9_CreateVertexShader(device, (DWORD *)*ptr, (LPDIRECT3DVERTEXSHADER9 *)param->data);
4057 WARN("Failed to create vertex shader\n");
4062 case D3DXPT_PIXELSHADER:
4063 hr = IDirect3DDevice9_CreatePixelShader(device, (DWORD *)*ptr, (LPDIRECT3DPIXELSHADER9 *)param->data);
4066 WARN("Failed to create pixel shader\n");
4072 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
4077 *ptr += ((size + 3) & ~3);
4082 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr,
4083 struct d3dx_parameter *parent, UINT flags)
4087 D3DXHANDLE *member_handles = NULL;
4090 param->flags = flags;
4094 read_dword(ptr, ¶m->type);
4095 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
4097 read_dword(ptr, ¶m->class);
4098 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
4100 read_dword(ptr, &offset);
4101 TRACE("Type name offset: %#x\n", offset);
4102 hr = d3dx9_parse_name(¶m->name, data + offset);
4105 WARN("Failed to parse name\n");
4109 read_dword(ptr, &offset);
4110 TRACE("Type semantic offset: %#x\n", offset);
4111 hr = d3dx9_parse_name(¶m->semantic, data + offset);
4114 WARN("Failed to parse semantic\n");
4118 read_dword(ptr, ¶m->element_count);
4119 TRACE("Elements: %u\n", param->element_count);
4121 switch (param->class)
4124 read_dword(ptr, ¶m->columns);
4125 TRACE("Columns: %u\n", param->columns);
4127 read_dword(ptr, ¶m->rows);
4128 TRACE("Rows: %u\n", param->rows);
4130 /* sizeof(DWORD) * rows * columns */
4131 param->bytes = 4 * param->rows * param->columns;
4135 case D3DXPC_MATRIX_ROWS:
4136 case D3DXPC_MATRIX_COLUMNS:
4137 read_dword(ptr, ¶m->rows);
4138 TRACE("Rows: %u\n", param->rows);
4140 read_dword(ptr, ¶m->columns);
4141 TRACE("Columns: %u\n", param->columns);
4143 /* sizeof(DWORD) * rows * columns */
4144 param->bytes = 4 * param->rows * param->columns;
4148 read_dword(ptr, ¶m->member_count);
4149 TRACE("Members: %u\n", param->member_count);
4153 switch (param->type)
4156 param->bytes = sizeof(LPCSTR);
4159 case D3DXPT_PIXELSHADER:
4160 param->bytes = sizeof(LPDIRECT3DPIXELSHADER9);
4163 case D3DXPT_VERTEXSHADER:
4164 param->bytes = sizeof(LPDIRECT3DVERTEXSHADER9);
4167 case D3DXPT_TEXTURE:
4168 case D3DXPT_TEXTURE1D:
4169 case D3DXPT_TEXTURE2D:
4170 case D3DXPT_TEXTURE3D:
4171 case D3DXPT_TEXTURECUBE:
4172 param->bytes = sizeof(LPDIRECT3DBASETEXTURE9);
4175 case D3DXPT_SAMPLER:
4176 case D3DXPT_SAMPLER1D:
4177 case D3DXPT_SAMPLER2D:
4178 case D3DXPT_SAMPLER3D:
4179 case D3DXPT_SAMPLERCUBE:
4184 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
4190 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
4197 param->type = parent->type;
4198 param->class = parent->class;
4199 param->name = parent->name;
4200 param->semantic = parent->semantic;
4201 param->element_count = 0;
4202 param->annotation_count = 0;
4203 param->member_count = parent->member_count;
4204 param->bytes = parent->bytes;
4205 param->rows = parent->rows;
4206 param->columns = parent->columns;
4209 if (param->element_count)
4211 unsigned int param_bytes = 0;
4212 const char *save_ptr = *ptr;
4214 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
4215 if (!member_handles)
4217 ERR("Out of memory\n");
4222 for (i = 0; i < param->element_count; ++i)
4224 struct d3dx_parameter *member;
4227 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
4230 ERR("Out of memory\n");
4235 member_handles[i] = get_parameter_handle(member);
4237 hr = d3dx9_parse_effect_typedef(member, data, ptr, param, flags);
4240 WARN("Failed to parse member\n");
4244 param_bytes += member->bytes;
4247 param->bytes = param_bytes;
4249 else if (param->member_count)
4251 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
4252 if (!member_handles)
4254 ERR("Out of memory\n");
4259 for (i = 0; i < param->member_count; ++i)
4261 struct d3dx_parameter *member;
4263 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
4266 ERR("Out of memory\n");
4271 member_handles[i] = get_parameter_handle(member);
4273 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL, flags);
4276 WARN("Failed to parse member\n");
4280 param->bytes += member->bytes;
4284 param->member_handles = member_handles;
4294 if (param->element_count) count = param->element_count;
4295 else count = param->member_count;
4297 for (i = 0; i < count; ++i)
4299 free_parameter(member_handles[i], param->element_count != 0, TRUE);
4301 HeapFree(GetProcessHeap(), 0, member_handles);
4306 HeapFree(GetProcessHeap(), 0, param->name);
4307 HeapFree(GetProcessHeap(), 0, param->semantic);
4310 param->semantic = NULL;
4315 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr, D3DXHANDLE *objects)
4321 anno->flags = D3DX_PARAMETER_ANNOTATION;
4323 read_dword(ptr, &offset);
4324 TRACE("Typedef offset: %#x\n", offset);
4325 ptr2 = data + offset;
4326 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION);
4329 WARN("Failed to parse type definition\n");
4333 read_dword(ptr, &offset);
4334 TRACE("Value offset: %#x\n", offset);
4335 hr = d3dx9_parse_init_value(anno, data, data + offset, objects);
4338 WARN("Failed to parse value\n");
4345 static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, D3DXHANDLE *objects)
4350 struct d3dx_parameter *parameter;
4352 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
4355 ERR("Out of memory\n");
4356 return E_OUTOFMEMORY;
4359 state->type = ST_CONSTANT;
4361 read_dword(ptr, &state->operation);
4362 TRACE("Operation: %#x (%s)\n", state->operation, state_table[state->operation].name);
4364 read_dword(ptr, &state->index);
4365 TRACE("Index: %#x\n", state->index);
4367 read_dword(ptr, &offset);
4368 TRACE("Typedef offset: %#x\n", offset);
4369 ptr2 = data + offset;
4370 hr = d3dx9_parse_effect_typedef(parameter, data, &ptr2, NULL, 0);
4373 WARN("Failed to parse type definition\n");
4377 read_dword(ptr, &offset);
4378 TRACE("Value offset: %#x\n", offset);
4379 hr = d3dx9_parse_init_value(parameter, data, data + offset, objects);
4382 WARN("Failed to parse value\n");
4386 state->parameter = get_parameter_handle(parameter);
4392 free_parameter(get_parameter_handle(parameter), FALSE, FALSE);
4397 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr, D3DXHANDLE *objects)
4402 D3DXHANDLE *annotation_handles = NULL;
4405 read_dword(ptr, &offset);
4406 TRACE("Typedef offset: %#x\n", offset);
4407 ptr2 = data + offset;
4409 read_dword(ptr, &offset);
4410 TRACE("Value offset: %#x\n", offset);
4412 read_dword(ptr, ¶m->flags);
4413 TRACE("Flags: %#x\n", param->flags);
4415 read_dword(ptr, ¶m->annotation_count);
4416 TRACE("Annotation count: %u\n", param->annotation_count);
4418 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags);
4421 WARN("Failed to parse type definition\n");
4425 hr = d3dx9_parse_init_value(param, data, data + offset, objects);
4428 WARN("Failed to parse value\n");
4432 if (param->annotation_count)
4434 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
4435 if (!annotation_handles)
4437 ERR("Out of memory\n");
4442 for (i = 0; i < param->annotation_count; ++i)
4444 struct d3dx_parameter *annotation;
4446 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
4449 ERR("Out of memory\n");
4454 annotation_handles[i] = get_parameter_handle(annotation);
4456 hr = d3dx9_parse_effect_annotation(annotation, data, ptr, objects);
4459 WARN("Failed to parse annotation\n");
4465 param->annotation_handles = annotation_handles;
4471 if (annotation_handles)
4473 for (i = 0; i < param->annotation_count; ++i)
4475 free_parameter(annotation_handles[i], FALSE, FALSE);
4477 HeapFree(GetProcessHeap(), 0, annotation_handles);
4483 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr, D3DXHANDLE *objects)
4488 D3DXHANDLE *annotation_handles = NULL;
4489 struct d3dx_state *states = NULL;
4492 read_dword(ptr, &offset);
4493 TRACE("Pass name offset: %#x\n", offset);
4494 hr = d3dx9_parse_name(&name, data + offset);
4497 WARN("Failed to parse name\n");
4501 read_dword(ptr, &pass->annotation_count);
4502 TRACE("Annotation count: %u\n", pass->annotation_count);
4504 read_dword(ptr, &pass->state_count);
4505 TRACE("State count: %u\n", pass->state_count);
4507 if (pass->annotation_count)
4509 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
4510 if (!annotation_handles)
4512 ERR("Out of memory\n");
4517 for (i = 0; i < pass->annotation_count; ++i)
4519 struct d3dx_parameter *annotation;
4521 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
4524 ERR("Out of memory\n");
4529 annotation_handles[i] = get_parameter_handle(annotation);
4531 hr = d3dx9_parse_effect_annotation(annotation, data, ptr, objects);
4534 WARN("Failed to parse annotations\n");
4540 if (pass->state_count)
4542 states = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*states) * pass->state_count);
4545 ERR("Out of memory\n");
4550 for (i = 0; i < pass->state_count; ++i)
4552 hr = d3dx9_parse_state(&states[i], data, ptr, objects);
4555 WARN("Failed to parse annotations\n");
4562 pass->annotation_handles = annotation_handles;
4563 pass->states = states;
4569 if (annotation_handles)
4571 for (i = 0; i < pass->annotation_count; ++i)
4573 free_parameter(annotation_handles[i], FALSE, FALSE);
4575 HeapFree(GetProcessHeap(), 0, annotation_handles);
4580 for (i = 0; i < pass->state_count; ++i)
4582 free_state(&states[i]);
4584 HeapFree(GetProcessHeap(), 0, states);
4587 HeapFree(GetProcessHeap(), 0, name);
4592 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr, D3DXHANDLE *objects)
4597 D3DXHANDLE *annotation_handles = NULL;
4598 D3DXHANDLE *pass_handles = NULL;
4601 read_dword(ptr, &offset);
4602 TRACE("Technique name offset: %#x\n", offset);
4603 hr = d3dx9_parse_name(&name, data + offset);
4606 WARN("Failed to parse name\n");
4610 read_dword(ptr, &technique->annotation_count);
4611 TRACE("Annotation count: %u\n", technique->annotation_count);
4613 read_dword(ptr, &technique->pass_count);
4614 TRACE("Pass count: %u\n", technique->pass_count);
4616 if (technique->annotation_count)
4618 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
4619 if (!annotation_handles)
4621 ERR("Out of memory\n");
4626 for (i = 0; i < technique->annotation_count; ++i)
4628 struct d3dx_parameter *annotation;
4630 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
4633 ERR("Out of memory\n");
4638 annotation_handles[i] = get_parameter_handle(annotation);
4640 hr = d3dx9_parse_effect_annotation(annotation, data, ptr, objects);
4643 WARN("Failed to parse annotations\n");
4649 if (technique->pass_count)
4651 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
4654 ERR("Out of memory\n");
4659 for (i = 0; i < technique->pass_count; ++i)
4661 struct d3dx_pass *pass;
4663 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
4666 ERR("Out of memory\n");
4671 pass_handles[i] = get_pass_handle(pass);
4673 hr = d3dx9_parse_effect_pass(pass, data, ptr, objects);
4676 WARN("Failed to parse passes\n");
4682 technique->name = name;
4683 technique->pass_handles = pass_handles;
4684 technique->annotation_handles = annotation_handles;
4692 for (i = 0; i < technique->pass_count; ++i)
4694 free_pass(pass_handles[i]);
4696 HeapFree(GetProcessHeap(), 0, pass_handles);
4699 if (annotation_handles)
4701 for (i = 0; i < technique->annotation_count; ++i)
4703 free_parameter(annotation_handles[i], FALSE, FALSE);
4705 HeapFree(GetProcessHeap(), 0, annotation_handles);
4708 HeapFree(GetProcessHeap(), 0, name);
4713 static HRESULT d3dx9_parse_resource(struct ID3DXBaseEffectImpl *base, const char *data, const char **ptr)
4715 DWORD technique_index;
4716 DWORD index, state_index, usage;
4717 struct d3dx_state *state;
4718 struct d3dx_parameter *param;
4721 read_dword(ptr, &technique_index);
4722 TRACE("techn: %u\n", technique_index);
4724 read_dword(ptr, &index);
4725 TRACE("index: %u\n", index);
4727 skip_dword_unknown(ptr, 1);
4729 read_dword(ptr, &state_index);
4730 TRACE("state: %u\n", state_index);
4732 read_dword(ptr, &usage);
4733 TRACE("usage: %u\n", usage);
4735 if (technique_index == 0xffffffff)
4737 struct d3dx_parameter *parameter;
4738 struct d3dx_sampler *sampler;
4740 if (index >= base->parameter_count)
4742 FIXME("Index out of bounds: index %u >= parameter_count %u\n", index, base->parameter_count);
4746 parameter = get_parameter_struct(base->parameter_handles[index]);
4747 sampler = parameter->data;
4748 if (state_index >= sampler->state_count)
4750 FIXME("Index out of bounds: state_index %u >= state_count %u\n", state_index, sampler->state_count);
4754 state = &sampler->states[state_index];
4758 struct d3dx_technique *technique;
4759 struct d3dx_pass *pass;
4761 if (technique_index >= base->technique_count)
4763 FIXME("Index out of bounds: technique_index %u >= technique_count %u\n", technique_index, base->technique_count);
4767 technique = get_technique_struct(base->technique_handles[technique_index]);
4768 if (index >= technique->pass_count)
4770 FIXME("Index out of bounds: index %u >= pass_count %u\n", index, technique->pass_count);
4774 pass = get_pass_struct(technique->pass_handles[index]);
4775 if (state_index >= pass->state_count)
4777 FIXME("Index out of bounds: state_index %u >= state_count %u\n", state_index, pass->state_count);
4781 state = &pass->states[state_index];
4784 param = get_parameter_struct(state->parameter);
4789 TRACE("usage 0: type %s\n", debug_d3dxparameter_type(param->type));
4790 switch (param->type)
4792 case D3DXPT_VERTEXSHADER:
4793 case D3DXPT_PIXELSHADER:
4794 state->type = ST_CONSTANT;
4795 hr = d3dx9_parse_data(param, ptr, base->effect->device);
4799 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
4806 FIXME("Unknown usage %x\n", usage);
4814 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
4816 const char *ptr = data + start;
4817 D3DXHANDLE *parameter_handles = NULL;
4818 D3DXHANDLE *technique_handles = NULL;
4819 D3DXHANDLE *objects = NULL;
4820 UINT stringcount, objectcount, resourcecount;
4824 read_dword(&ptr, &base->parameter_count);
4825 TRACE("Parameter count: %u\n", base->parameter_count);
4827 read_dword(&ptr, &base->technique_count);
4828 TRACE("Technique count: %u\n", base->technique_count);
4830 skip_dword_unknown(&ptr, 1);
4832 read_dword(&ptr, &objectcount);
4833 TRACE("Object count: %u\n", objectcount);
4835 objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * objectcount);
4838 ERR("Out of memory\n");
4843 if (base->parameter_count)
4845 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
4846 if (!parameter_handles)
4848 ERR("Out of memory\n");
4853 for (i = 0; i < base->parameter_count; ++i)
4855 struct d3dx_parameter *parameter;
4857 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
4860 ERR("Out of memory\n");
4865 parameter_handles[i] = get_parameter_handle(parameter);
4867 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr, objects);
4870 WARN("Failed to parse parameter\n");
4876 if (base->technique_count)
4878 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
4879 if (!technique_handles)
4881 ERR("Out of memory\n");
4886 for (i = 0; i < base->technique_count; ++i)
4888 struct d3dx_technique *technique;
4890 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
4893 ERR("Out of memory\n");
4898 technique_handles[i] = get_technique_handle(technique);
4900 hr = d3dx9_parse_effect_technique(technique, data, &ptr, objects);
4903 WARN("Failed to parse technique\n");
4909 /* needed for further parsing */
4910 base->technique_handles = technique_handles;
4911 base->parameter_handles = parameter_handles;
4913 read_dword(&ptr, &stringcount);
4914 TRACE("String count: %u\n", stringcount);
4916 read_dword(&ptr, &resourcecount);
4917 TRACE("Resource count: %u\n", resourcecount);
4919 for (i = 0; i < stringcount; ++i)
4922 struct d3dx_parameter *param;
4924 read_dword(&ptr, &id);
4925 TRACE("Id: %u\n", id);
4927 param = get_parameter_struct(objects[id]);
4929 hr = d3dx9_parse_data(param, &ptr, base->effect->device);
4932 WARN("Failed to parse data\n");
4937 for (i = 0; i < resourcecount; ++i)
4939 TRACE("parse resource %u\n", i);
4941 hr = d3dx9_parse_resource(base, data, &ptr);
4944 WARN("Failed to parse data\n");
4949 HeapFree(GetProcessHeap(), 0, objects);
4955 if (technique_handles)
4957 for (i = 0; i < base->technique_count; ++i)
4959 free_technique(technique_handles[i]);
4961 HeapFree(GetProcessHeap(), 0, technique_handles);
4964 if (parameter_handles)
4966 for (i = 0; i < base->parameter_count; ++i)
4968 free_parameter(parameter_handles[i], FALSE, FALSE);
4970 HeapFree(GetProcessHeap(), 0, parameter_handles);
4973 base->technique_handles = NULL;
4974 base->parameter_handles = NULL;
4976 HeapFree(GetProcessHeap(), 0, objects);
4981 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
4982 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
4985 const char *ptr = data;
4988 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
4990 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
4992 base->effect = effect;
4994 read_dword(&ptr, &tag);
4995 TRACE("Tag: %x\n", tag);
4997 if (tag != d3dx9_effect_version(9, 1))
4999 /* todo: compile hlsl ascii code */
5000 FIXME("HLSL ascii effects not supported, yet\n");
5002 /* Show the start of the shader for debugging info. */
5003 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
5007 read_dword(&ptr, &offset);
5008 TRACE("Offset: %x\n", offset);
5010 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
5013 FIXME("Failed to parse effect.\n");
5021 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVICE9 device,
5022 const char *data, SIZE_T data_size, LPD3DXEFFECTPOOL pool)
5025 struct ID3DXBaseEffectImpl *object = NULL;
5027 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
5029 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
5032 if (pool) pool->lpVtbl->AddRef(pool);
5033 effect->pool = pool;
5035 IDirect3DDevice9_AddRef(device);
5036 effect->device = device;
5038 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5041 ERR("Out of memory\n");
5046 hr = d3dx9_base_effect_init(object, data, data_size, effect);
5049 FIXME("Failed to parse effect.\n");
5053 effect->base_effect = &object->ID3DXBaseEffect_iface;
5055 /* initialize defaults - check because of unsupported ascii effects */
5056 if (object->technique_handles)
5058 effect->active_technique = object->technique_handles[0];
5059 effect->active_pass = NULL;
5066 HeapFree(GetProcessHeap(), 0, object);
5067 free_effect(effect);
5072 HRESULT WINAPI D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device,
5075 CONST D3DXMACRO* defines,
5076 LPD3DXINCLUDE include,
5077 LPCSTR skip_constants,
5079 LPD3DXEFFECTPOOL pool,
5080 LPD3DXEFFECT* effect,
5081 LPD3DXBUFFER* compilation_errors)
5083 struct ID3DXEffectImpl *object;
5086 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
5087 skip_constants, flags, pool, effect, compilation_errors);
5089 if (!device || !srcdata)
5090 return D3DERR_INVALIDCALL;
5095 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
5099 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5102 ERR("Out of memory\n");
5103 return E_OUTOFMEMORY;
5106 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
5109 WARN("Failed to initialize shader reflection\n");
5110 HeapFree(GetProcessHeap(), 0, object);
5114 *effect = &object->ID3DXEffect_iface;
5116 TRACE("Created ID3DXEffect %p\n", object);
5121 HRESULT WINAPI D3DXCreateEffect(LPDIRECT3DDEVICE9 device,
5124 CONST D3DXMACRO* defines,
5125 LPD3DXINCLUDE include,
5127 LPD3DXEFFECTPOOL pool,
5128 LPD3DXEFFECT* effect,
5129 LPD3DXBUFFER* compilation_errors)
5131 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
5132 include, flags, pool, effect, compilation_errors);
5134 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
5137 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
5140 struct ID3DXBaseEffectImpl *object = NULL;
5142 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
5144 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
5147 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5150 ERR("Out of memory\n");
5155 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
5158 FIXME("Failed to parse effect.\n");
5162 compiler->base_effect = &object->ID3DXBaseEffect_iface;
5168 HeapFree(GetProcessHeap(), 0, object);
5169 free_effect_compiler(compiler);
5174 HRESULT WINAPI D3DXCreateEffectCompiler(LPCSTR srcdata,
5176 CONST D3DXMACRO *defines,
5177 LPD3DXINCLUDE include,
5179 LPD3DXEFFECTCOMPILER *compiler,
5180 LPD3DXBUFFER *parse_errors)
5182 struct ID3DXEffectCompilerImpl *object;
5185 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
5186 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
5188 if (!srcdata || !compiler)
5190 WARN("Invalid arguments supplied\n");
5191 return D3DERR_INVALIDCALL;
5194 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5197 ERR("Out of memory\n");
5198 return E_OUTOFMEMORY;
5201 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
5204 WARN("Failed to initialize effect compiler\n");
5205 HeapFree(GetProcessHeap(), 0, object);
5209 *compiler = &object->ID3DXEffectCompiler_iface;
5211 TRACE("Created ID3DXEffectCompiler %p\n", object);
5216 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
5218 struct ID3DXEffectPoolImpl
5220 ID3DXEffectPool ID3DXEffectPool_iface;
5224 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
5226 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
5229 /*** IUnknown methods ***/
5230 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
5232 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
5234 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), object);
5236 if (IsEqualGUID(riid, &IID_IUnknown) ||
5237 IsEqualGUID(riid, &IID_ID3DXEffectPool))
5239 This->ID3DXEffectPool_iface.lpVtbl->AddRef(iface);
5244 WARN("Interface %s not found\n", debugstr_guid(riid));
5246 return E_NOINTERFACE;
5249 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
5251 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
5253 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
5255 return InterlockedIncrement(&This->ref);
5258 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
5260 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
5261 ULONG ref = InterlockedDecrement(&This->ref);
5263 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
5266 HeapFree(GetProcessHeap(), 0, This);
5271 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
5273 /*** IUnknown methods ***/
5274 ID3DXEffectPoolImpl_QueryInterface,
5275 ID3DXEffectPoolImpl_AddRef,
5276 ID3DXEffectPoolImpl_Release
5279 HRESULT WINAPI D3DXCreateEffectPool(LPD3DXEFFECTPOOL *pool)
5281 struct ID3DXEffectPoolImpl *object;
5283 TRACE("(%p)\n", pool);
5286 return D3DERR_INVALIDCALL;
5288 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5291 ERR("Out of memory\n");
5292 return E_OUTOFMEMORY;
5295 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
5298 *pool = &object->ID3DXEffectPool_iface;
5303 HRESULT WINAPI D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
5304 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
5305 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5311 TRACE("(%s): relay\n", debugstr_w(srcfile));
5313 if (!device || !srcfile)
5314 return D3DERR_INVALIDCALL;
5316 ret = map_view_of_file(srcfile, &buffer, &size);
5319 return D3DXERR_INVALIDDATA;
5321 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
5322 UnmapViewOfFile(buffer);
5327 HRESULT WINAPI D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
5328 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
5329 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5335 TRACE("(void): relay\n");
5338 return D3DERR_INVALIDCALL;
5340 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
5341 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
5342 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
5344 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
5345 HeapFree(GetProcessHeap(), 0, srcfileW);
5350 HRESULT WINAPI D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device, LPCWSTR srcfile,
5351 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
5352 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5354 TRACE("(void): relay\n");
5355 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
5358 HRESULT WINAPI D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device, LPCSTR srcfile,
5359 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
5360 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5362 TRACE("(void): relay\n");
5363 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
5366 HRESULT WINAPI D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
5367 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
5368 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5372 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
5375 return D3DERR_INVALIDCALL;
5377 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
5385 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
5388 return D3DXERR_INVALIDDATA;
5390 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
5393 return D3DXERR_INVALIDDATA;
5396 HRESULT WINAPI D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
5397 const D3DXMACRO *defines, LPD3DXINCLUDE include, LPCSTR skipconstants, DWORD flags,
5398 LPD3DXEFFECTPOOL pool, LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5402 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
5405 return D3DERR_INVALIDCALL;
5407 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
5415 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
5418 return D3DXERR_INVALIDDATA;
5420 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
5423 return D3DXERR_INVALIDDATA;
5426 HRESULT WINAPI D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCWSTR srcresource,
5427 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
5428 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5430 TRACE("(void): relay\n");
5431 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
5434 HRESULT WINAPI D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device, HMODULE srcmodule, LPCSTR srcresource,
5435 const D3DXMACRO *defines, LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTPOOL pool,
5436 LPD3DXEFFECT *effect, LPD3DXBUFFER *compilationerrors)
5438 TRACE("(void): relay\n");
5439 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
5442 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
5443 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
5449 TRACE("(%s): relay\n", debugstr_w(srcfile));
5452 return D3DERR_INVALIDCALL;
5454 ret = map_view_of_file(srcfile, &buffer, &size);
5457 return D3DXERR_INVALIDDATA;
5459 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
5460 UnmapViewOfFile(buffer);
5465 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile, const D3DXMACRO *defines, LPD3DXINCLUDE include,
5466 DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
5472 TRACE("(void): relay\n");
5475 return D3DERR_INVALIDCALL;
5477 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
5478 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
5479 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
5481 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
5482 HeapFree(GetProcessHeap(), 0, srcfileW);
5487 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, LPCSTR srcresource, const D3DXMACRO *defines,
5488 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
5492 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
5494 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
5502 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
5505 return D3DXERR_INVALIDDATA;
5507 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
5510 return D3DXERR_INVALIDDATA;
5513 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, LPCWSTR srcresource, const D3DXMACRO *defines,
5514 LPD3DXINCLUDE include, DWORD flags, LPD3DXEFFECTCOMPILER *effectcompiler, LPD3DXBUFFER *parseerrors)
5518 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
5520 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
5528 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
5531 return D3DXERR_INVALIDDATA;
5533 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
5536 return D3DXERR_INVALIDDATA;