2 * Copyright 2010 Christian Costa
3 * Copyright 2011 Rico Schüller
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
22 #define NONAMELESSUNION
23 #include "wine/debug.h"
24 #include "wine/unicode.h"
28 #include "d3dx9_36_private.h"
30 /* Constants for special INT/FLOAT conversation */
31 #define INT_FLOAT_MULTI 255.0f
32 #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI)
34 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
36 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl;
37 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl;
38 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl;
85 enum SHADER_CONSTANT_TYPE
102 struct d3dx_parameter
107 D3DXPARAMETER_CLASS class;
108 D3DXPARAMETER_TYPE type;
112 UINT annotation_count;
117 D3DXHANDLE *annotation_handles;
118 D3DXHANDLE *member_handles;
125 enum STATE_TYPE type;
126 D3DXHANDLE parameter;
132 struct d3dx_state *states;
139 UINT annotation_count;
141 struct d3dx_state *states;
142 D3DXHANDLE *annotation_handles;
145 struct d3dx_technique
149 UINT annotation_count;
151 D3DXHANDLE *annotation_handles;
152 D3DXHANDLE *pass_handles;
155 struct ID3DXBaseEffectImpl
157 ID3DXBaseEffect ID3DXBaseEffect_iface;
160 struct ID3DXEffectImpl *effect;
162 UINT parameter_count;
163 UINT technique_count;
165 D3DXHANDLE *parameter_handles;
166 D3DXHANDLE *technique_handles;
169 struct ID3DXEffectImpl
171 ID3DXEffect ID3DXEffect_iface;
174 struct ID3DXEffectStateManager *manager;
175 struct IDirect3DDevice9 *device;
176 struct ID3DXEffectPool *pool;
177 D3DXHANDLE active_technique;
178 D3DXHANDLE active_pass;
180 ID3DXBaseEffect *base_effect;
183 struct ID3DXEffectCompilerImpl
185 ID3DXEffectCompiler ID3DXEffectCompiler_iface;
188 ID3DXBaseEffect *base_effect;
191 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
192 struct d3dx_parameter *parameter, LPCSTR name);
193 static struct d3dx_parameter *get_annotation_by_name(UINT handlecount, D3DXHANDLE *handles, LPCSTR name);
194 static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, D3DXHANDLE *objects);
195 static void free_parameter_state(D3DXHANDLE handle, BOOL element, BOOL child, enum STATE_TYPE st);
199 enum STATE_CLASS class;
206 {SC_RENDERSTATE, D3DRS_ZENABLE, "D3DRS_ZENABLE"}, /* 0x0 */
207 {SC_RENDERSTATE, D3DRS_FILLMODE, "D3DRS_FILLMODE"},
208 {SC_RENDERSTATE, D3DRS_SHADEMODE, "D3DRS_SHADEMODE"},
209 {SC_RENDERSTATE, D3DRS_ZWRITEENABLE, "D3DRS_ZWRITEENABLE"},
210 {SC_RENDERSTATE, D3DRS_ALPHATESTENABLE, "D3DRS_ALPHATESTENABLE"},
211 {SC_RENDERSTATE, D3DRS_LASTPIXEL, "D3DRS_LASTPIXEL"},
212 {SC_RENDERSTATE, D3DRS_SRCBLEND, "D3DRS_SRCBLEND"},
213 {SC_RENDERSTATE, D3DRS_DESTBLEND, "D3DRS_DESTBLEND"},
214 {SC_RENDERSTATE, D3DRS_CULLMODE, "D3DRS_CULLMODE"},
215 {SC_RENDERSTATE, D3DRS_ZFUNC, "D3DRS_ZFUNC"},
216 {SC_RENDERSTATE, D3DRS_ALPHAREF, "D3DRS_ALPHAREF"},
217 {SC_RENDERSTATE, D3DRS_ALPHAFUNC, "D3DRS_ALPHAFUNC"},
218 {SC_RENDERSTATE, D3DRS_DITHERENABLE, "D3DRS_DITHERENABLE"},
219 {SC_RENDERSTATE, D3DRS_ALPHABLENDENABLE, "D3DRS_ALPHABLENDENABLE"},
220 {SC_RENDERSTATE, D3DRS_FOGENABLE, "D3DRS_FOGENABLE"},
221 {SC_RENDERSTATE, D3DRS_SPECULARENABLE, "D3DRS_SPECULARENABLE"},
222 {SC_RENDERSTATE, D3DRS_FOGCOLOR, "D3DRS_FOGCOLOR"}, /* 0x10 */
223 {SC_RENDERSTATE, D3DRS_FOGTABLEMODE, "D3DRS_FOGTABLEMODE"},
224 {SC_RENDERSTATE, D3DRS_FOGSTART, "D3DRS_FOGSTART"},
225 {SC_RENDERSTATE, D3DRS_FOGEND, "D3DRS_FOGEND"},
226 {SC_RENDERSTATE, D3DRS_FOGDENSITY, "D3DRS_FOGDENSITY"},
227 {SC_RENDERSTATE, D3DRS_RANGEFOGENABLE, "D3DRS_RANGEFOGENABLE"},
228 {SC_RENDERSTATE, D3DRS_STENCILENABLE, "D3DRS_STENCILENABLE"},
229 {SC_RENDERSTATE, D3DRS_STENCILFAIL, "D3DRS_STENCILFAIL"},
230 {SC_RENDERSTATE, D3DRS_STENCILZFAIL, "D3DRS_STENCILZFAIL"},
231 {SC_RENDERSTATE, D3DRS_STENCILPASS, "D3DRS_STENCILPASS"},
232 {SC_RENDERSTATE, D3DRS_STENCILFUNC, "D3DRS_STENCILFUNC"},
233 {SC_RENDERSTATE, D3DRS_STENCILREF, "D3DRS_STENCILREF"},
234 {SC_RENDERSTATE, D3DRS_STENCILMASK, "D3DRS_STENCILMASK"},
235 {SC_RENDERSTATE, D3DRS_STENCILWRITEMASK, "D3DRS_STENCILWRITEMASK"},
236 {SC_RENDERSTATE, D3DRS_TEXTUREFACTOR, "D3DRS_TEXTUREFACTOR"},
237 {SC_RENDERSTATE, D3DRS_WRAP0, "D3DRS_WRAP0"},
238 {SC_RENDERSTATE, D3DRS_WRAP1, "D3DRS_WRAP1"}, /* 0x20 */
239 {SC_RENDERSTATE, D3DRS_WRAP2, "D3DRS_WRAP2"},
240 {SC_RENDERSTATE, D3DRS_WRAP3, "D3DRS_WRAP3"},
241 {SC_RENDERSTATE, D3DRS_WRAP4, "D3DRS_WRAP4"},
242 {SC_RENDERSTATE, D3DRS_WRAP5, "D3DRS_WRAP5"},
243 {SC_RENDERSTATE, D3DRS_WRAP6, "D3DRS_WRAP6"},
244 {SC_RENDERSTATE, D3DRS_WRAP7, "D3DRS_WRAP7"},
245 {SC_RENDERSTATE, D3DRS_WRAP8, "D3DRS_WRAP8"},
246 {SC_RENDERSTATE, D3DRS_WRAP9, "D3DRS_WRAP9"},
247 {SC_RENDERSTATE, D3DRS_WRAP10, "D3DRS_WRAP10"},
248 {SC_RENDERSTATE, D3DRS_WRAP11, "D3DRS_WRAP11"},
249 {SC_RENDERSTATE, D3DRS_WRAP12, "D3DRS_WRAP12"},
250 {SC_RENDERSTATE, D3DRS_WRAP13, "D3DRS_WRAP13"},
251 {SC_RENDERSTATE, D3DRS_WRAP14, "D3DRS_WRAP14"},
252 {SC_RENDERSTATE, D3DRS_WRAP15, "D3DRS_WRAP15"},
253 {SC_RENDERSTATE, D3DRS_CLIPPING, "D3DRS_CLIPPING"},
254 {SC_RENDERSTATE, D3DRS_LIGHTING, "D3DRS_LIGHTING"}, /* 0x30 */
255 {SC_RENDERSTATE, D3DRS_AMBIENT, "D3DRS_AMBIENT"},
256 {SC_RENDERSTATE, D3DRS_FOGVERTEXMODE, "D3DRS_FOGVERTEXMODE"},
257 {SC_RENDERSTATE, D3DRS_COLORVERTEX, "D3DRS_COLORVERTEX"},
258 {SC_RENDERSTATE, D3DRS_LOCALVIEWER, "D3DRS_LOCALVIEWER"},
259 {SC_RENDERSTATE, D3DRS_NORMALIZENORMALS, "D3DRS_NORMALIZENORMALS"},
260 {SC_RENDERSTATE, D3DRS_DIFFUSEMATERIALSOURCE, "D3DRS_DIFFUSEMATERIALSOURCE"},
261 {SC_RENDERSTATE, D3DRS_SPECULARMATERIALSOURCE, "D3DRS_SPECULARMATERIALSOURCE"},
262 {SC_RENDERSTATE, D3DRS_AMBIENTMATERIALSOURCE, "D3DRS_AMBIENTMATERIALSOURCE"},
263 {SC_RENDERSTATE, D3DRS_EMISSIVEMATERIALSOURCE, "D3DRS_EMISSIVEMATERIALSOURCE"},
264 {SC_RENDERSTATE, D3DRS_VERTEXBLEND, "D3DRS_VERTEXBLEND"},
265 {SC_RENDERSTATE, D3DRS_CLIPPLANEENABLE, "D3DRS_CLIPPLANEENABLE"},
266 {SC_RENDERSTATE, D3DRS_POINTSIZE, "D3DRS_POINTSIZE"},
267 {SC_RENDERSTATE, D3DRS_POINTSIZE_MIN, "D3DRS_POINTSIZE_MIN"},
268 {SC_RENDERSTATE, D3DRS_POINTSIZE_MAX, "D3DRS_POINTSIZE_MAX"},
269 {SC_RENDERSTATE, D3DRS_POINTSPRITEENABLE, "D3DRS_POINTSPRITEENABLE"},
270 {SC_RENDERSTATE, D3DRS_POINTSCALEENABLE, "D3DRS_POINTSCALEENABLE"}, /* 0x40 */
271 {SC_RENDERSTATE, D3DRS_POINTSCALE_A, "D3DRS_POINTSCALE_A"},
272 {SC_RENDERSTATE, D3DRS_POINTSCALE_B, "D3DRS_POINTSCALE_B"},
273 {SC_RENDERSTATE, D3DRS_POINTSCALE_C, "D3DRS_POINTSCALE_C"},
274 {SC_RENDERSTATE, D3DRS_MULTISAMPLEANTIALIAS, "D3DRS_MULTISAMPLEANTIALIAS"},
275 {SC_RENDERSTATE, D3DRS_MULTISAMPLEMASK, "D3DRS_MULTISAMPLEMASK"},
276 {SC_RENDERSTATE, D3DRS_PATCHEDGESTYLE, "D3DRS_PATCHEDGESTYLE"},
277 {SC_RENDERSTATE, D3DRS_DEBUGMONITORTOKEN, "D3DRS_DEBUGMONITORTOKEN"},
278 {SC_RENDERSTATE, D3DRS_INDEXEDVERTEXBLENDENABLE, "D3DRS_INDEXEDVERTEXBLENDENABLE"},
279 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE, "D3DRS_COLORWRITEENABLE"},
280 {SC_RENDERSTATE, D3DRS_TWEENFACTOR, "D3DRS_TWEENFACTOR"},
281 {SC_RENDERSTATE, D3DRS_BLENDOP, "D3DRS_BLENDOP"},
282 {SC_RENDERSTATE, D3DRS_POSITIONDEGREE, "D3DRS_POSITIONDEGREE"},
283 {SC_RENDERSTATE, D3DRS_NORMALDEGREE, "D3DRS_NORMALDEGREE"},
284 {SC_RENDERSTATE, D3DRS_SCISSORTESTENABLE, "D3DRS_SCISSORTESTENABLE"},
285 {SC_RENDERSTATE, D3DRS_SLOPESCALEDEPTHBIAS, "D3DRS_SLOPESCALEDEPTHBIAS"},
286 {SC_RENDERSTATE, D3DRS_ANTIALIASEDLINEENABLE, "D3DRS_ANTIALIASEDLINEENABLE"}, /* 0x50 */
287 {SC_RENDERSTATE, D3DRS_MINTESSELLATIONLEVEL, "D3DRS_MINTESSELLATIONLEVEL"},
288 {SC_RENDERSTATE, D3DRS_MAXTESSELLATIONLEVEL, "D3DRS_MAXTESSELLATIONLEVEL"},
289 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_X, "D3DRS_ADAPTIVETESS_X"},
290 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_Y, "D3DRS_ADAPTIVETESS_Y"},
291 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_Z, "D3DRS_ADAPTIVETESS_Z"},
292 {SC_RENDERSTATE, D3DRS_ADAPTIVETESS_W, "D3DRS_ADAPTIVETESS_W"},
293 {SC_RENDERSTATE, D3DRS_ENABLEADAPTIVETESSELLATION, "D3DRS_ENABLEADAPTIVETESSELLATION"},
294 {SC_RENDERSTATE, D3DRS_TWOSIDEDSTENCILMODE, "D3DRS_TWOSIDEDSTENCILMODE"},
295 {SC_RENDERSTATE, D3DRS_CCW_STENCILFAIL, "D3DRS_CCW_STENCILFAIL"},
296 {SC_RENDERSTATE, D3DRS_CCW_STENCILZFAIL, "D3DRS_CCW_STENCILZFAIL"},
297 {SC_RENDERSTATE, D3DRS_CCW_STENCILPASS, "D3DRS_CCW_STENCILPASS"},
298 {SC_RENDERSTATE, D3DRS_CCW_STENCILFUNC, "D3DRS_CCW_STENCILFUNC"},
299 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE1, "D3DRS_COLORWRITEENABLE1"},
300 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE2, "D3DRS_COLORWRITEENABLE2"},
301 {SC_RENDERSTATE, D3DRS_COLORWRITEENABLE3, "D3DRS_COLORWRITEENABLE3"},
302 {SC_RENDERSTATE, D3DRS_BLENDFACTOR, "D3DRS_BLENDFACTOR"}, /* 0x60 */
303 {SC_RENDERSTATE, D3DRS_SRGBWRITEENABLE, "D3DRS_SRGBWRITEENABLE"},
304 {SC_RENDERSTATE, D3DRS_DEPTHBIAS, "D3DRS_DEPTHBIAS"},
305 {SC_RENDERSTATE, D3DRS_SEPARATEALPHABLENDENABLE, "D3DRS_SEPARATEALPHABLENDENABLE"},
306 {SC_RENDERSTATE, D3DRS_SRCBLENDALPHA, "D3DRS_SRCBLENDALPHA"},
307 {SC_RENDERSTATE, D3DRS_DESTBLENDALPHA, "D3DRS_DESTBLENDALPHA"},
308 {SC_RENDERSTATE, D3DRS_BLENDOPALPHA, "D3DRS_BLENDOPALPHA"},
310 {SC_TEXTURESTAGE, D3DTSS_COLOROP, "D3DTSS_COLOROP"},
311 {SC_TEXTURESTAGE, D3DTSS_COLORARG0, "D3DTSS_COLORARG0"},
312 {SC_TEXTURESTAGE, D3DTSS_COLORARG1, "D3DTSS_COLORARG1"},
313 {SC_TEXTURESTAGE, D3DTSS_COLORARG2, "D3DTSS_COLORARG2"},
314 {SC_TEXTURESTAGE, D3DTSS_ALPHAOP, "D3DTSS_ALPHAOP"},
315 {SC_TEXTURESTAGE, D3DTSS_ALPHAARG0, "D3DTSS_ALPHAARG0"},
316 {SC_TEXTURESTAGE, D3DTSS_ALPHAARG1, "D3DTSS_ALPHAARG1"},
317 {SC_TEXTURESTAGE, D3DTSS_ALPHAARG2, "D3DTSS_ALPHAARG2"},
318 {SC_TEXTURESTAGE, D3DTSS_RESULTARG, "D3DTSS_RESULTARG"},
319 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT00, "D3DTSS_BUMPENVMAT00"}, /* 0x70 */
320 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT01, "D3DTSS_BUMPENVMAT01"},
321 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT10, "D3DTSS_BUMPENVMAT10"},
322 {SC_TEXTURESTAGE, D3DTSS_BUMPENVMAT11, "D3DTSS_BUMPENVMAT11"},
323 {SC_TEXTURESTAGE, D3DTSS_TEXCOORDINDEX, "D3DTSS_TEXCOORDINDEX"},
324 {SC_TEXTURESTAGE, D3DTSS_BUMPENVLSCALE, "D3DTSS_BUMPENVLSCALE"},
325 {SC_TEXTURESTAGE, D3DTSS_BUMPENVLOFFSET, "D3DTSS_BUMPENVLOFFSET"},
326 {SC_TEXTURESTAGE, D3DTSS_TEXTURETRANSFORMFLAGS, "D3DTSS_TEXTURETRANSFORMFLAGS"},
327 {SC_TEXTURESTAGE, D3DTSS_CONSTANT, "D3DTSS_CONSTANT"},
329 {SC_NPATCHMODE, 0, "NPatchMode"},
333 {SC_TRANSFORM, D3DTS_PROJECTION, "D3DTS_PROJECTION"},
334 {SC_TRANSFORM, D3DTS_VIEW, "D3DTS_VIEW"},
335 {SC_TRANSFORM, D3DTS_WORLD, "D3DTS_WORLD"},
336 {SC_TRANSFORM, D3DTS_TEXTURE0, "D3DTS_TEXTURE0"},
338 {SC_MATERIAL, MT_DIFFUSE, "MaterialDiffuse"},
339 {SC_MATERIAL, MT_AMBIENT, "MaterialAmbient"}, /* 0x80 */
340 {SC_MATERIAL, MT_SPECULAR, "MaterialSpecular"},
341 {SC_MATERIAL, MT_EMISSIVE, "MaterialEmissive"},
342 {SC_MATERIAL, MT_POWER, "MaterialPower"},
344 {SC_LIGHT, LT_TYPE, "LightType"},
345 {SC_LIGHT, LT_DIFFUSE, "LightDiffuse"},
346 {SC_LIGHT, LT_SPECULAR, "LightSpecular"},
347 {SC_LIGHT, LT_AMBIENT, "LightAmbient"},
348 {SC_LIGHT, LT_POSITION, "LightPosition"},
349 {SC_LIGHT, LT_DIRECTION, "LightDirection"},
350 {SC_LIGHT, LT_RANGE, "LightRange"},
351 {SC_LIGHT, LT_FALLOFF, "LightFallOff"},
352 {SC_LIGHT, LT_ATTENUATION0, "LightAttenuation0"},
353 {SC_LIGHT, LT_ATTENUATION1, "LightAttenuation1"},
354 {SC_LIGHT, LT_ATTENUATION2, "LightAttenuation2"},
355 {SC_LIGHT, LT_THETA, "LightTheta"},
356 {SC_LIGHT, LT_PHI, "LightPhi"}, /* 0x90 */
358 {SC_LIGHTENABLE, 0, "LightEnable"},
360 {SC_VERTEXSHADER, 0, "Vertexshader"},
362 {SC_PIXELSHADER, 0, "Pixelshader"},
363 /* Shader constants */
364 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstantF"},
365 {SC_SHADERCONST, SCT_VSBOOL, "VertexShaderConstantB"},
366 {SC_SHADERCONST, SCT_VSINT, "VertexShaderConstantI"},
367 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant"},
368 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant1"},
369 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant2"},
370 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant3"},
371 {SC_SHADERCONST, SCT_VSFLOAT, "VertexShaderConstant4"},
372 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstantF"},
373 {SC_SHADERCONST, SCT_PSBOOL, "PixelShaderConstantB"},
374 {SC_SHADERCONST, SCT_PSINT, "PixelShaderConstantI"},
375 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant"},
376 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant1"}, /* 0xa0 */
377 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant2"},
378 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant3"},
379 {SC_SHADERCONST, SCT_PSFLOAT, "PixelShaderConstant4"},
381 {SC_TEXTURE, 0, "Texture"},
383 {SC_SAMPLERSTATE, D3DSAMP_ADDRESSU, "AddressU"},
384 {SC_SAMPLERSTATE, D3DSAMP_ADDRESSV, "AddressV"},
385 {SC_SAMPLERSTATE, D3DSAMP_ADDRESSW, "AddressW"},
386 {SC_SAMPLERSTATE, D3DSAMP_BORDERCOLOR, "BorderColor"},
387 {SC_SAMPLERSTATE, D3DSAMP_MAGFILTER, "MagFilter"},
388 {SC_SAMPLERSTATE, D3DSAMP_MINFILTER, "MinFilter"},
389 {SC_SAMPLERSTATE, D3DSAMP_MIPFILTER, "MipFilter"},
390 {SC_SAMPLERSTATE, D3DSAMP_MIPMAPLODBIAS, "MipMapLodBias"},
391 {SC_SAMPLERSTATE, D3DSAMP_MAXMIPLEVEL, "MaxMipLevel"},
392 {SC_SAMPLERSTATE, D3DSAMP_MAXANISOTROPY, "MaxAnisotropy"},
393 {SC_SAMPLERSTATE, D3DSAMP_SRGBTEXTURE, "SRGBTexture"},
394 {SC_SAMPLERSTATE, D3DSAMP_ELEMENTINDEX, "ElementIndex"}, /* 0xb0 */
395 {SC_SAMPLERSTATE, D3DSAMP_DMAPOFFSET, "DMAPOffset"},
397 {SC_SETSAMPLER, 0, "Sampler"},
400 static inline void read_dword(const char **ptr, DWORD *d)
402 memcpy(d, *ptr, sizeof(*d));
406 static void skip_dword_unknown(const char **ptr, unsigned int count)
411 FIXME("Skipping %u unknown DWORDs:\n", count);
412 for (i = 0; i < count; ++i)
415 FIXME("\t0x%08x\n", d);
419 static inline struct d3dx_parameter *get_parameter_struct(D3DXHANDLE handle)
421 return (struct d3dx_parameter *) handle;
424 static inline struct d3dx_pass *get_pass_struct(D3DXHANDLE handle)
426 return (struct d3dx_pass *) handle;
429 static inline struct d3dx_technique *get_technique_struct(D3DXHANDLE handle)
431 return (struct d3dx_technique *) handle;
434 static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter)
436 return (D3DXHANDLE) parameter;
439 static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique)
441 return (D3DXHANDLE) technique;
444 static inline D3DXHANDLE get_pass_handle(struct d3dx_pass *pass)
446 return (D3DXHANDLE) pass;
449 static struct d3dx_technique *get_technique_by_name(struct ID3DXBaseEffectImpl *base, LPCSTR name)
453 if (!name) return NULL;
455 for (i = 0; i < base->technique_count; ++i)
457 struct d3dx_technique *tech = get_technique_struct(base->technique_handles[i]);
459 if (!strcmp(tech->name, name)) return tech;
465 static struct d3dx_technique *is_valid_technique(struct ID3DXBaseEffectImpl *base, D3DXHANDLE technique)
467 struct d3dx_technique *tech = NULL;
470 for (i = 0; i < base->technique_count; ++i)
472 if (base->technique_handles[i] == technique)
474 tech = get_technique_struct(technique);
479 if (!tech) tech = get_technique_by_name(base, technique);
484 static struct d3dx_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
488 for (i = 0; i < base->technique_count; ++i)
490 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
492 for (k = 0; k < technique->pass_count; ++k)
494 if (technique->pass_handles[k] == pass)
496 return get_pass_struct(pass);
504 static struct d3dx_parameter *is_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter)
506 unsigned int i, count;
507 struct d3dx_parameter *p;
509 for (i = 0; i < param->annotation_count; ++i)
511 if (param->annotation_handles[i] == parameter)
513 return get_parameter_struct(parameter);
516 p = is_valid_sub_parameter(get_parameter_struct(param->annotation_handles[i]), parameter);
520 if (param->element_count) count = param->element_count;
521 else count = param->member_count;
523 for (i = 0; i < count; ++i)
525 if (param->member_handles[i] == parameter)
527 return get_parameter_struct(parameter);
530 p = is_valid_sub_parameter(get_parameter_struct(param->member_handles[i]), parameter);
537 static struct d3dx_parameter *is_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
539 unsigned int i, k, m;
540 struct d3dx_parameter *p;
542 for (i = 0; i < base->parameter_count; ++i)
544 if (base->parameter_handles[i] == parameter)
546 return get_parameter_struct(parameter);
549 p = is_valid_sub_parameter(get_parameter_struct(base->parameter_handles[i]), parameter);
553 for (i = 0; i < base->technique_count; ++i)
555 struct d3dx_technique *technique = get_technique_struct(base->technique_handles[i]);
557 for (k = 0; k < technique->pass_count; ++k)
559 struct d3dx_pass *pass = get_pass_struct(technique->pass_handles[k]);
561 for (m = 0; m < pass->annotation_count; ++m)
563 if (pass->annotation_handles[i] == parameter)
565 return get_parameter_struct(parameter);
568 p = is_valid_sub_parameter(get_parameter_struct(pass->annotation_handles[m]), parameter);
573 for (k = 0; k < technique->annotation_count; ++k)
575 if (technique->annotation_handles[k] == parameter)
577 return get_parameter_struct(parameter);
580 p = is_valid_sub_parameter(get_parameter_struct(technique->annotation_handles[k]), parameter);
588 static inline struct d3dx_parameter *get_valid_parameter(struct ID3DXBaseEffectImpl *base, D3DXHANDLE parameter)
590 struct d3dx_parameter *param = is_valid_parameter(base, parameter);
592 if (!param) param = get_parameter_by_name(base, NULL, parameter);
597 static void free_state(struct d3dx_state *state)
599 free_parameter_state(state->parameter, FALSE, FALSE, state->type);
602 static void free_sampler(struct d3dx_sampler *sampler)
606 for (i = 0; i < sampler->state_count; ++i)
608 free_state(&sampler->states[i]);
610 HeapFree(GetProcessHeap(), 0, sampler->states);
613 static void free_parameter(D3DXHANDLE handle, BOOL element, BOOL child)
615 free_parameter_state(handle, element, child, ST_CONSTANT);
618 static void free_parameter_state(D3DXHANDLE handle, BOOL element, BOOL child, enum STATE_TYPE st)
621 struct d3dx_parameter *param = get_parameter_struct(handle);
623 TRACE("Free parameter %p, name %s, type %s, child %s, state_type %x\n", param, param->name,
624 debug_d3dxparameter_type(param->type), child ? "yes" : "no", st);
631 if (param->annotation_handles)
633 for (i = 0; i < param->annotation_count; ++i)
635 free_parameter(param->annotation_handles[i], FALSE, FALSE);
637 HeapFree(GetProcessHeap(), 0, param->annotation_handles);
640 if (param->member_handles)
644 if (param->element_count) count = param->element_count;
645 else count = param->member_count;
647 for (i = 0; i < count; ++i)
649 free_parameter(param->member_handles[i], param->element_count != 0, TRUE);
651 HeapFree(GetProcessHeap(), 0, param->member_handles);
654 if (param->class == D3DXPC_OBJECT && !param->element_count)
659 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
660 if (!child) HeapFree(GetProcessHeap(), 0, param->data);
664 case D3DXPT_TEXTURE1D:
665 case D3DXPT_TEXTURE2D:
666 case D3DXPT_TEXTURE3D:
667 case D3DXPT_TEXTURECUBE:
668 case D3DXPT_PIXELSHADER:
669 case D3DXPT_VERTEXSHADER:
670 if (st == ST_CONSTANT)
672 if (*(IUnknown **)param->data) IUnknown_Release(*(IUnknown **)param->data);
676 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
678 if (!child) HeapFree(GetProcessHeap(), 0, param->data);
682 case D3DXPT_SAMPLER1D:
683 case D3DXPT_SAMPLER2D:
684 case D3DXPT_SAMPLER3D:
685 case D3DXPT_SAMPLERCUBE:
686 if (st == ST_CONSTANT)
688 free_sampler((struct d3dx_sampler *)param->data);
692 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
694 /* samplers have always own data, so free that */
695 HeapFree(GetProcessHeap(), 0, param->data);
699 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
707 if (st != ST_CONSTANT)
709 HeapFree(GetProcessHeap(), 0, *(LPSTR *)param->data);
711 HeapFree(GetProcessHeap(), 0, param->data);
715 /* only the parent has to release name and semantic */
718 HeapFree(GetProcessHeap(), 0, param->name);
719 HeapFree(GetProcessHeap(), 0, param->semantic);
722 HeapFree(GetProcessHeap(), 0, param);
725 static void free_pass(D3DXHANDLE handle)
728 struct d3dx_pass *pass = get_pass_struct(handle);
730 TRACE("Free pass %p\n", pass);
737 if (pass->annotation_handles)
739 for (i = 0; i < pass->annotation_count; ++i)
741 free_parameter(pass->annotation_handles[i], FALSE, FALSE);
743 HeapFree(GetProcessHeap(), 0, pass->annotation_handles);
748 for (i = 0; i < pass->state_count; ++i)
750 free_state(&pass->states[i]);
752 HeapFree(GetProcessHeap(), 0, pass->states);
755 HeapFree(GetProcessHeap(), 0, pass->name);
756 HeapFree(GetProcessHeap(), 0, pass);
759 static void free_technique(D3DXHANDLE handle)
762 struct d3dx_technique *technique = get_technique_struct(handle);
764 TRACE("Free technique %p\n", technique);
771 if (technique->annotation_handles)
773 for (i = 0; i < technique->annotation_count; ++i)
775 free_parameter(technique->annotation_handles[i], FALSE, FALSE);
777 HeapFree(GetProcessHeap(), 0, technique->annotation_handles);
780 if (technique->pass_handles)
782 for (i = 0; i < technique->pass_count; ++i)
784 free_pass(technique->pass_handles[i]);
786 HeapFree(GetProcessHeap(), 0, technique->pass_handles);
789 HeapFree(GetProcessHeap(), 0, technique->name);
790 HeapFree(GetProcessHeap(), 0, technique);
793 static void free_base_effect(struct ID3DXBaseEffectImpl *base)
797 TRACE("Free base effect %p\n", base);
799 if (base->parameter_handles)
801 for (i = 0; i < base->parameter_count; ++i)
803 free_parameter(base->parameter_handles[i], FALSE, FALSE);
805 HeapFree(GetProcessHeap(), 0, base->parameter_handles);
808 if (base->technique_handles)
810 for (i = 0; i < base->technique_count; ++i)
812 free_technique(base->technique_handles[i]);
814 HeapFree(GetProcessHeap(), 0, base->technique_handles);
818 static void free_effect(struct ID3DXEffectImpl *effect)
820 TRACE("Free effect %p\n", effect);
822 if (effect->base_effect)
824 effect->base_effect->lpVtbl->Release(effect->base_effect);
829 effect->pool->lpVtbl->Release(effect->pool);
834 IUnknown_Release(effect->manager);
837 IDirect3DDevice9_Release(effect->device);
840 static void free_effect_compiler(struct ID3DXEffectCompilerImpl *compiler)
842 TRACE("Free effect compiler %p\n", compiler);
844 if (compiler->base_effect)
846 compiler->base_effect->lpVtbl->Release(compiler->base_effect);
850 static void get_vector(struct d3dx_parameter *param, D3DXVECTOR4 *vector)
854 for (i = 0; i < 4; ++i)
856 if (i < param->columns)
857 set_number((FLOAT *)vector + i, D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
859 ((FLOAT *)vector)[i] = 0.0f;
863 static void set_vector(struct d3dx_parameter *param, CONST D3DXVECTOR4 *vector)
867 for (i = 0; i < param->columns; ++i)
869 set_number((FLOAT *)param->data + i, param->type, (FLOAT *)vector + i, D3DXPT_FLOAT);
873 static void get_matrix(struct d3dx_parameter *param, D3DXMATRIX *matrix, BOOL transpose)
877 for (i = 0; i < 4; ++i)
879 for (k = 0; k < 4; ++k)
881 FLOAT *tmp = transpose ? (FLOAT *)&matrix->u.m[k][i] : (FLOAT *)&matrix->u.m[i][k];
883 if ((i < param->rows) && (k < param->columns))
884 set_number(tmp, D3DXPT_FLOAT, (DWORD *)param->data + i * param->columns + k, param->type);
891 static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix, BOOL transpose)
895 for (i = 0; i < param->rows; ++i)
897 for (k = 0; k < param->columns; ++k)
899 set_number((FLOAT *)param->data + i * param->columns + k, param->type,
900 transpose ? &matrix->u.m[k][i] : &matrix->u.m[i][k], D3DXPT_FLOAT);
905 static struct d3dx_parameter *get_parameter_element_by_name(struct d3dx_parameter *parameter, LPCSTR name)
908 struct d3dx_parameter *temp_parameter;
911 TRACE("parameter %p, name %s\n", parameter, debugstr_a(name));
913 if (!name || !*name) return NULL;
915 element = atoi(name);
916 part = strchr(name, ']') + 1;
918 /* check for empty [] && element range */
919 if ((part - name) > 1 && parameter->element_count > element)
921 temp_parameter = get_parameter_struct(parameter->member_handles[element]);
926 return get_parameter_by_name(NULL, temp_parameter, part);
929 return get_annotation_by_name(temp_parameter->annotation_count, temp_parameter->annotation_handles, part);
932 TRACE("Returning parameter %p\n", temp_parameter);
933 return temp_parameter;
936 FIXME("Unhandled case \"%c\"\n", *--part);
941 TRACE("Parameter not found\n");
945 static struct d3dx_parameter *get_annotation_by_name(UINT handlecount, D3DXHANDLE *handles, LPCSTR name)
948 struct d3dx_parameter *temp_parameter;
951 TRACE("handlecount %u, handles %p, name %s\n", handlecount, handles, debugstr_a(name));
953 if (!name || !*name) return NULL;
955 length = strcspn( name, "[.@" );
956 part = name + length;
958 for (i = 0; i < handlecount; ++i)
960 temp_parameter = get_parameter_struct(handles[i]);
962 if (!strcmp(temp_parameter->name, name))
964 TRACE("Returning parameter %p\n", temp_parameter);
965 return temp_parameter;
967 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
972 return get_parameter_by_name(NULL, temp_parameter, part);
975 return get_parameter_element_by_name(temp_parameter, part);
978 FIXME("Unhandled case \"%c\"\n", *--part);
984 TRACE("Parameter not found\n");
988 static struct d3dx_parameter *get_parameter_by_name(struct ID3DXBaseEffectImpl *base,
989 struct d3dx_parameter *parameter, LPCSTR name)
991 UINT i, count, length;
992 struct d3dx_parameter *temp_parameter;
996 TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
998 if (!name || !*name) return NULL;
1002 count = base->parameter_count;
1003 handles = base->parameter_handles;
1007 count = parameter->member_count;
1008 handles = parameter->member_handles;
1011 length = strcspn( name, "[.@" );
1012 part = name + length;
1014 for (i = 0; i < count; i++)
1016 temp_parameter = get_parameter_struct(handles[i]);
1018 if (!strcmp(temp_parameter->name, name))
1020 TRACE("Returning parameter %p\n", temp_parameter);
1021 return temp_parameter;
1023 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
1028 return get_parameter_by_name(NULL, temp_parameter, part);
1031 return get_annotation_by_name(temp_parameter->annotation_count, temp_parameter->annotation_handles, part);
1034 return get_parameter_element_by_name(temp_parameter, part);
1037 FIXME("Unhandled case \"%c\"\n", *--part);
1043 TRACE("Parameter not found\n");
1047 static inline DWORD d3dx9_effect_version(DWORD major, DWORD minor)
1049 return (0xfeff0000 | ((major) << 8) | (minor));
1052 static inline struct ID3DXBaseEffectImpl *impl_from_ID3DXBaseEffect(ID3DXBaseEffect *iface)
1054 return CONTAINING_RECORD(iface, struct ID3DXBaseEffectImpl, ID3DXBaseEffect_iface);
1057 /*** IUnknown methods ***/
1058 static HRESULT WINAPI ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect *iface, REFIID riid, void **object)
1060 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
1062 if (IsEqualGUID(riid, &IID_IUnknown) ||
1063 IsEqualGUID(riid, &IID_ID3DXBaseEffect))
1065 iface->lpVtbl->AddRef(iface);
1070 ERR("Interface %s not found\n", debugstr_guid(riid));
1072 return E_NOINTERFACE;
1075 static ULONG WINAPI ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect *iface)
1077 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1079 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
1081 return InterlockedIncrement(&This->ref);
1084 static ULONG WINAPI ID3DXBaseEffectImpl_Release(ID3DXBaseEffect *iface)
1086 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1087 ULONG ref = InterlockedDecrement(&This->ref);
1089 TRACE("iface %p: Release from %u\n", iface, ref + 1);
1093 free_base_effect(This);
1094 HeapFree(GetProcessHeap(), 0, This);
1100 /*** ID3DXBaseEffect methods ***/
1101 static HRESULT WINAPI ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect *iface, D3DXEFFECT_DESC *desc)
1103 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1105 FIXME("iface %p, desc %p partial stub\n", This, desc);
1109 WARN("Invalid argument specified.\n");
1110 return D3DERR_INVALIDCALL;
1113 /* Todo: add creator and function count */
1114 desc->Creator = NULL;
1115 desc->Functions = 0;
1116 desc->Parameters = This->parameter_count;
1117 desc->Techniques = This->technique_count;
1122 static HRESULT WINAPI ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
1124 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1125 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1127 TRACE("iface %p, parameter %p, desc %p\n", This, parameter, desc);
1129 if (!desc || !param)
1131 WARN("Invalid argument specified.\n");
1132 return D3DERR_INVALIDCALL;
1135 desc->Name = param->name;
1136 desc->Semantic = param->semantic;
1137 desc->Class = param->class;
1138 desc->Type = param->type;
1139 desc->Rows = param->rows;
1140 desc->Columns = param->columns;
1141 desc->Elements = param->element_count;
1142 desc->Annotations = param->annotation_count;
1143 desc->StructMembers = param->member_count;
1144 desc->Flags = param->flags;
1145 desc->Bytes = param->bytes;
1150 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
1152 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1153 struct d3dx_technique *tech = technique ? is_valid_technique(This, technique) : get_technique_struct(This->technique_handles[0]);
1155 TRACE("iface %p, technique %p, desc %p\n", This, technique, desc);
1159 WARN("Invalid argument specified.\n");
1160 return D3DERR_INVALIDCALL;
1163 desc->Name = tech->name;
1164 desc->Passes = tech->pass_count;
1165 desc->Annotations = tech->annotation_count;
1170 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
1172 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1173 struct d3dx_pass *p = is_valid_pass(This, pass);
1175 TRACE("iface %p, pass %p, desc %p\n", This, pass, desc);
1179 WARN("Invalid argument specified.\n");
1180 return D3DERR_INVALIDCALL;
1183 desc->Name = p->name;
1184 desc->Annotations = p->annotation_count;
1186 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
1187 desc->pVertexShaderFunction = NULL;
1188 desc->pPixelShaderFunction = NULL;
1193 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
1195 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1197 FIXME("iface %p, shader %p, desc %p stub\n", This, shader, desc);
1202 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
1204 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1205 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1207 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
1211 if (index < This->parameter_count)
1213 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
1214 return This->parameter_handles[index];
1219 if (param && !param->element_count && index < param->member_count)
1221 TRACE("Returning parameter %p\n", param->member_handles[index]);
1222 return param->member_handles[index];
1226 WARN("Invalid argument specified.\n");
1231 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR name)
1233 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1234 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1237 TRACE("iface %p, parameter %p, name %s\n", This, parameter, debugstr_a(name));
1241 handle = get_parameter_handle(param);
1242 TRACE("Returning parameter %p\n", handle);
1246 handle = get_parameter_handle(get_parameter_by_name(This, param, name));
1247 TRACE("Returning parameter %p\n", handle);
1252 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
1254 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1255 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1256 struct d3dx_parameter *temp_param;
1259 TRACE("iface %p, parameter %p, semantic %s\n", This, parameter, debugstr_a(semantic));
1263 for (i = 0; i < This->parameter_count; ++i)
1265 temp_param = get_parameter_struct(This->parameter_handles[i]);
1267 if (!temp_param->semantic)
1271 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
1272 return This->parameter_handles[i];
1277 if (!strcasecmp(temp_param->semantic, semantic))
1279 TRACE("Returning parameter %p\n", This->parameter_handles[i]);
1280 return This->parameter_handles[i];
1286 for (i = 0; i < param->member_count; ++i)
1288 temp_param = get_parameter_struct(param->member_handles[i]);
1290 if (!temp_param->semantic)
1294 TRACE("Returning parameter %p\n", param->member_handles[i]);
1295 return param->member_handles[i];
1300 if (!strcasecmp(temp_param->semantic, semantic))
1302 TRACE("Returning parameter %p\n", param->member_handles[i]);
1303 return param->member_handles[i];
1308 WARN("Invalid argument specified\n");
1313 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT index)
1315 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1316 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1318 TRACE("iface %p, parameter %p, index %u\n", This, parameter, index);
1322 if (index < This->parameter_count)
1324 TRACE("Returning parameter %p\n", This->parameter_handles[index]);
1325 return This->parameter_handles[index];
1330 if (index < param->element_count)
1332 TRACE("Returning parameter %p\n", param->member_handles[index]);
1333 return param->member_handles[index];
1337 WARN("Invalid argument specified\n");
1342 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect *iface, UINT index)
1344 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1346 TRACE("iface %p, index %u\n", This, index);
1348 if (index >= This->technique_count)
1350 WARN("Invalid argument specified.\n");
1354 TRACE("Returning technique %p\n", This->technique_handles[index]);
1356 return This->technique_handles[index];
1359 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect *iface, LPCSTR name)
1361 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1362 struct d3dx_technique *tech = get_technique_by_name(This, name);
1364 TRACE("iface %p, name %s stub\n", This, debugstr_a(name));
1368 D3DXHANDLE t = get_technique_handle(tech);
1369 TRACE("Returning technique %p\n", t);
1373 WARN("Invalid argument specified.\n");
1378 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3DXHANDLE technique, UINT index)
1380 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1381 struct d3dx_technique *tech = is_valid_technique(This, technique);
1383 TRACE("iface %p, technique %p, index %u\n", This, technique, index);
1385 if (tech && index < tech->pass_count)
1387 TRACE("Returning pass %p\n", tech->pass_handles[index]);
1388 return tech->pass_handles[index];
1391 WARN("Invalid argument specified.\n");
1396 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *iface, D3DXHANDLE technique, LPCSTR name)
1398 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1399 struct d3dx_technique *tech = is_valid_technique(This, technique);
1401 TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
1407 for (i = 0; i < tech->pass_count; ++i)
1409 struct d3dx_pass *pass = get_pass_struct(tech->pass_handles[i]);
1411 if (!strcmp(pass->name, name))
1413 TRACE("Returning pass %p\n", tech->pass_handles[i]);
1414 return tech->pass_handles[i];
1419 WARN("Invalid argument specified.\n");
1424 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect *iface, UINT index)
1426 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1428 FIXME("iface %p, index %u stub\n", This, index);
1433 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect *iface, LPCSTR name)
1435 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1437 FIXME("iface %p, name %s stub\n", This, debugstr_a(name));
1442 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect *iface, D3DXHANDLE object, UINT index)
1444 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1445 struct d3dx_parameter *param = get_valid_parameter(This, object);
1446 struct d3dx_pass *pass = is_valid_pass(This, object);
1447 struct d3dx_technique *technique = is_valid_technique(This, object);
1448 UINT annotation_count = 0;
1449 D3DXHANDLE *annotation_handles = NULL;
1451 TRACE("iface %p, object %p, index %u\n", This, object, index);
1455 annotation_count = pass->annotation_count;
1456 annotation_handles = pass->annotation_handles;
1460 annotation_count = technique->annotation_count;
1461 annotation_handles = technique->annotation_handles;
1465 annotation_count = param->annotation_count;
1466 annotation_handles = param->annotation_handles;
1470 FIXME("Functions are not handled, yet!\n");
1473 if (index < annotation_count)
1475 TRACE("Returning parameter %p\n", annotation_handles[index]);
1476 return annotation_handles[index];
1479 WARN("Invalid argument specified\n");
1484 static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect *iface, D3DXHANDLE object, LPCSTR name)
1486 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1487 struct d3dx_parameter *param = get_valid_parameter(This, object);
1488 struct d3dx_pass *pass = is_valid_pass(This, object);
1489 struct d3dx_technique *technique = is_valid_technique(This, object);
1490 struct d3dx_parameter *anno = NULL;
1491 UINT annotation_count = 0;
1492 D3DXHANDLE *annotation_handles = NULL;
1494 TRACE("iface %p, object %p, name %s\n", This, object, debugstr_a(name));
1498 WARN("Invalid argument specified\n");
1504 annotation_count = pass->annotation_count;
1505 annotation_handles = pass->annotation_handles;
1509 annotation_count = technique->annotation_count;
1510 annotation_handles = technique->annotation_handles;
1514 annotation_count = param->annotation_count;
1515 annotation_handles = param->annotation_handles;
1519 FIXME("Functions are not handled, yet!\n");
1522 anno = get_annotation_by_name(annotation_count, annotation_handles, name);
1525 TRACE("Returning parameter %p\n", anno);
1526 return get_parameter_handle(anno);
1529 WARN("Invalid argument specified\n");
1534 static HRESULT WINAPI ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
1536 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1537 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1539 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1543 WARN("Invalid parameter %p specified\n", parameter);
1544 return D3DERR_INVALIDCALL;
1547 /* samplers don't touch data */
1548 if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
1549 || param->type == D3DXPT_SAMPLER1D || param->type == D3DXPT_SAMPLER2D
1550 || param->type == D3DXPT_SAMPLER3D || param->type == D3DXPT_SAMPLERCUBE))
1552 TRACE("Sampler: returning E_FAIL\n");
1556 if (data && param->bytes <= bytes)
1558 switch (param->type)
1564 TRACE("Copy %u bytes\n", param->bytes);
1565 memcpy(param->data, data, param->bytes);
1569 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
1576 WARN("Invalid argument specified\n");
1578 return D3DERR_INVALIDCALL;
1581 static HRESULT WINAPI ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
1583 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1584 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1586 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This, parameter, data, bytes);
1590 WARN("Invalid parameter %p specified\n", parameter);
1591 return D3DERR_INVALIDCALL;
1594 /* samplers don't touch data */
1595 if (param->class == D3DXPC_OBJECT && (param->type == D3DXPT_SAMPLER
1596 || param->type == D3DXPT_SAMPLER1D || param->type == D3DXPT_SAMPLER2D
1597 || param->type == D3DXPT_SAMPLER3D || param->type == D3DXPT_SAMPLERCUBE))
1599 TRACE("Sampler: returning E_FAIL\n");
1603 if (data && param->bytes <= bytes)
1605 TRACE("Type %s\n", debug_d3dxparameter_type(param->type));
1607 switch (param->type)
1616 case D3DXPT_VERTEXSHADER:
1617 case D3DXPT_PIXELSHADER:
1618 case D3DXPT_TEXTURE:
1619 case D3DXPT_TEXTURE1D:
1620 case D3DXPT_TEXTURE2D:
1621 case D3DXPT_TEXTURE3D:
1622 case D3DXPT_TEXTURECUBE:
1626 for (i = 0; i < (param->element_count ? param->element_count : 1); ++i)
1628 IUnknown *unk = ((IUnknown **)param->data)[i];
1629 if (unk) IUnknown_AddRef(unk);
1635 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
1639 TRACE("Copy %u bytes\n", param->bytes);
1640 memcpy(data, param->data, param->bytes);
1644 WARN("Invalid argument specified\n");
1646 return D3DERR_INVALIDCALL;
1649 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL b)
1651 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1652 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1654 TRACE("iface %p, parameter %p, b %s\n", This, parameter, b ? "TRUE" : "FALSE");
1656 if (param && !param->element_count && param->rows == 1 && param->columns == 1)
1658 set_number(param->data, param->type, &b, D3DXPT_BOOL);
1662 WARN("Invalid argument specified\n");
1664 return D3DERR_INVALIDCALL;
1667 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b)
1669 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1670 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1672 TRACE("iface %p, parameter %p, b %p\n", This, parameter, b);
1674 if (b && param && !param->element_count && param->rows == 1 && param->columns == 1)
1676 set_number(b, D3DXPT_BOOL, param->data, param->type);
1677 TRACE("Returning %s\n", *b ? "TRUE" : "FALSE");
1681 WARN("Invalid argument specified\n");
1683 return D3DERR_INVALIDCALL;
1686 static HRESULT WINAPI ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
1688 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1689 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1691 TRACE("iface %p, parameter %p, b %p, count %u\n", This, parameter, b, count);
1695 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1697 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
1699 switch (param->class)
1703 case D3DXPC_MATRIX_ROWS:
1704 for (i = 0; i < size; ++i)
1706 /* don't crop the input, use D3DXPT_INT instead of D3DXPT_BOOL */
1707 set_number((DWORD *)param->data + i, param->type, &b[i], D3DXPT_INT);
1716 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
1721 WARN("Invalid argument specified\n");
1723 return D3DERR_INVALIDCALL;
1726 static HRESULT WINAPI ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
1728 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1729 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1731 TRACE("iface %p, parameter %p, b %p, count %u\n", This, parameter, b, count);
1733 if (b && param && (param->class == D3DXPC_SCALAR
1734 || param->class == D3DXPC_VECTOR
1735 || param->class == D3DXPC_MATRIX_ROWS
1736 || param->class == D3DXPC_MATRIX_COLUMNS))
1738 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1740 for (i = 0; i < size; ++i)
1742 set_number(&b[i], D3DXPT_BOOL, (DWORD *)param->data + i, param->type);
1747 WARN("Invalid argument specified\n");
1749 return D3DERR_INVALIDCALL;
1752 static HRESULT WINAPI ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT n)
1754 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1755 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1757 TRACE("iface %p, parameter %p, n %i\n", This, parameter, n);
1759 if (param && !param->element_count)
1761 if (param->rows == 1 && param->columns == 1)
1763 set_number(param->data, param->type, &n, D3DXPT_INT);
1768 * Split the value, if parameter is a vector with dimension 3 or 4.
1770 if (param->type == D3DXPT_FLOAT &&
1771 ((param->class == D3DXPC_VECTOR && param->columns != 2) ||
1772 (param->class == D3DXPC_MATRIX_ROWS && param->rows != 2 && param->columns == 1)))
1774 TRACE("Vector fixup\n");
1776 *(FLOAT *)param->data = ((n & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
1777 ((FLOAT *)param->data)[1] = ((n & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
1778 ((FLOAT *)param->data)[2] = (n & 0xff) * INT_FLOAT_MULTI_INVERSE;
1779 if (param->rows * param->columns > 3)
1781 ((FLOAT *)param->data)[3] = ((n & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
1787 WARN("Invalid argument specified\n");
1789 return D3DERR_INVALIDCALL;
1792 static HRESULT WINAPI ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n)
1794 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1795 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1797 TRACE("iface %p, parameter %p, n %p\n", This, parameter, n);
1799 if (n && param && !param->element_count)
1801 if (param->columns == 1 && param->rows == 1)
1803 set_number(n, D3DXPT_INT, param->data, param->type);
1804 TRACE("Returning %i\n", *n);
1808 if (param->type == D3DXPT_FLOAT &&
1809 ((param->class == D3DXPC_VECTOR && param->columns != 2)
1810 || (param->class == D3DXPC_MATRIX_ROWS && param->rows != 2 && param->columns == 1)))
1812 TRACE("Vector fixup\n");
1814 /* all components (3,4) are clamped (0,255) and put in the INT */
1815 *n = (INT)(min(max(0.0f, *((FLOAT *)param->data + 2)), 1.0f) * INT_FLOAT_MULTI);
1816 *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 1)), 1.0f) * INT_FLOAT_MULTI)) << 8;
1817 *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 0)), 1.0f) * INT_FLOAT_MULTI)) << 16;
1818 if (param->columns * param->rows > 3)
1820 *n += ((INT)(min(max(0.0f, *((FLOAT *)param->data + 3)), 1.0f) * INT_FLOAT_MULTI)) << 24;
1823 TRACE("Returning %i\n", *n);
1828 WARN("Invalid argument specified\n");
1830 return D3DERR_INVALIDCALL;
1833 static HRESULT WINAPI ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
1835 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1836 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1838 TRACE("iface %p, parameter %p, n %p, count %u\n", This, parameter, n, count);
1842 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1844 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
1846 switch (param->class)
1850 case D3DXPC_MATRIX_ROWS:
1851 for (i = 0; i < size; ++i)
1853 set_number((DWORD *)param->data + i, param->type, &n[i], D3DXPT_INT);
1862 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
1867 WARN("Invalid argument specified\n");
1869 return D3DERR_INVALIDCALL;
1872 static HRESULT WINAPI ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
1874 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1875 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1877 TRACE("iface %p, parameter %p, n %p, count %u\n", This, parameter, n, count);
1879 if (n && param && (param->class == D3DXPC_SCALAR
1880 || param->class == D3DXPC_VECTOR
1881 || param->class == D3DXPC_MATRIX_ROWS
1882 || param->class == D3DXPC_MATRIX_COLUMNS))
1884 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1886 for (i = 0; i < size; ++i)
1888 set_number(&n[i], D3DXPT_INT, (DWORD *)param->data + i, param->type);
1893 WARN("Invalid argument specified\n");
1895 return D3DERR_INVALIDCALL;
1898 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT f)
1900 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1901 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1903 TRACE("iface %p, parameter %p, f %f\n", This, parameter, f);
1905 if (param && !param->element_count && param->rows == 1 && param->columns == 1)
1907 set_number((DWORD *)param->data, param->type, &f, D3DXPT_FLOAT);
1911 WARN("Invalid argument specified\n");
1913 return D3DERR_INVALIDCALL;
1916 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f)
1918 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1919 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1921 TRACE("iface %p, parameter %p, f %p\n", This, parameter, f);
1923 if (f && param && !param->element_count && param->columns == 1 && param->rows == 1)
1925 set_number(f, D3DXPT_FLOAT, (DWORD *)param->data, param->type);
1926 TRACE("Returning %f\n", *f);
1930 WARN("Invalid argument specified\n");
1932 return D3DERR_INVALIDCALL;
1935 static HRESULT WINAPI ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
1937 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1938 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1940 TRACE("iface %p, parameter %p, f %p, count %u\n", This, parameter, f, count);
1944 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1946 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
1948 switch (param->class)
1952 case D3DXPC_MATRIX_ROWS:
1953 for (i = 0; i < size; ++i)
1955 set_number((DWORD *)param->data + i, param->type, &f[i], D3DXPT_FLOAT);
1964 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
1969 WARN("Invalid argument specified\n");
1971 return D3DERR_INVALIDCALL;
1974 static HRESULT WINAPI ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
1976 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
1977 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
1979 TRACE("iface %p, parameter %p, f %p, count %u\n", This, parameter, f, count);
1981 if (f && param && (param->class == D3DXPC_SCALAR
1982 || param->class == D3DXPC_VECTOR
1983 || param->class == D3DXPC_MATRIX_ROWS
1984 || param->class == D3DXPC_MATRIX_COLUMNS))
1986 UINT i, size = min(count, param->bytes / sizeof(DWORD));
1988 for (i = 0; i < size; ++i)
1990 set_number(&f[i], D3DXPT_FLOAT, (DWORD *)param->data + i, param->type);
1995 WARN("Invalid argument specified\n");
1997 return D3DERR_INVALIDCALL;
2000 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
2002 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2003 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2005 TRACE("iface %p, parameter %p, vector %p\n", This, parameter, vector);
2007 if (param && !param->element_count)
2009 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2011 switch (param->class)
2015 if (param->type == D3DXPT_INT && param->bytes == 4)
2019 TRACE("INT fixup\n");
2020 tmp = (DWORD)(max(min(vector->z, 1.0f), 0.0f) * INT_FLOAT_MULTI);
2021 tmp += ((DWORD)(max(min(vector->y, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 8;
2022 tmp += ((DWORD)(max(min(vector->x, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 16;
2023 tmp += ((DWORD)(max(min(vector->w, 1.0f), 0.0f) * INT_FLOAT_MULTI)) << 24;
2025 *(INT *)param->data = tmp;
2028 set_vector(param, vector);
2031 case D3DXPC_MATRIX_ROWS:
2037 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2042 WARN("Invalid argument specified\n");
2044 return D3DERR_INVALIDCALL;
2047 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
2049 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2050 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2052 TRACE("iface %p, parameter %p, vector %p\n", This, parameter, vector);
2054 if (vector && param && !param->element_count)
2056 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2058 switch (param->class)
2062 if (param->type == D3DXPT_INT && param->bytes == 4)
2064 TRACE("INT fixup\n");
2065 vector->x = (((*(INT *)param->data) & 0xff0000) >> 16) * INT_FLOAT_MULTI_INVERSE;
2066 vector->y = (((*(INT *)param->data) & 0xff00) >> 8) * INT_FLOAT_MULTI_INVERSE;
2067 vector->z = ((*(INT *)param->data) & 0xff) * INT_FLOAT_MULTI_INVERSE;
2068 vector->w = (((*(INT *)param->data) & 0xff000000) >> 24) * INT_FLOAT_MULTI_INVERSE;
2071 get_vector(param, vector);
2074 case D3DXPC_MATRIX_ROWS:
2080 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2085 WARN("Invalid argument specified\n");
2087 return D3DERR_INVALIDCALL;
2090 static HRESULT WINAPI ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
2092 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2093 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2095 TRACE("iface %p, parameter %p, vector %p, count %u stub\n", This, parameter, vector, count);
2097 if (param && param->element_count && param->element_count >= count)
2101 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2103 switch (param->class)
2106 for (i = 0; i < count; ++i)
2108 set_vector(get_parameter_struct(param->member_handles[i]), &vector[i]);
2113 case D3DXPC_MATRIX_ROWS:
2119 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2124 WARN("Invalid argument specified\n");
2126 return D3DERR_INVALIDCALL;
2129 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
2131 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2132 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2134 TRACE("iface %p, parameter %p, vector %p, count %u\n", This, parameter, vector, count);
2136 if (!count) return D3D_OK;
2138 if (vector && param && count <= param->element_count)
2142 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2144 switch (param->class)
2147 for (i = 0; i < count; ++i)
2149 get_vector(get_parameter_struct(param->member_handles[i]), &vector[i]);
2154 case D3DXPC_MATRIX_ROWS:
2160 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2165 WARN("Invalid argument specified\n");
2167 return D3DERR_INVALIDCALL;
2170 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2172 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2173 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2175 TRACE("iface %p, parameter %p, matrix %p\n", This, parameter, matrix);
2177 if (param && !param->element_count)
2179 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2181 switch (param->class)
2183 case D3DXPC_MATRIX_ROWS:
2184 set_matrix(param, matrix, FALSE);
2194 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2199 WARN("Invalid argument specified\n");
2201 return D3DERR_INVALIDCALL;
2204 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2206 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2207 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2209 TRACE("iface %p, parameter %p, matrix %p\n", This, parameter, matrix);
2211 if (matrix && param && !param->element_count)
2213 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2215 switch (param->class)
2217 case D3DXPC_MATRIX_ROWS:
2218 get_matrix(param, matrix, FALSE);
2228 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2233 WARN("Invalid argument specified\n");
2235 return D3DERR_INVALIDCALL;
2238 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2240 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2241 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2243 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2245 if (param && param->element_count >= count)
2249 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2251 switch (param->class)
2253 case D3DXPC_MATRIX_ROWS:
2254 for (i = 0; i < count; ++i)
2256 set_matrix(get_parameter_struct(param->member_handles[i]), &matrix[i], FALSE);
2267 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2272 WARN("Invalid argument specified\n");
2274 return D3DERR_INVALIDCALL;
2277 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2279 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2280 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2282 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2284 if (!count) return D3D_OK;
2286 if (matrix && param && count <= param->element_count)
2290 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2292 switch (param->class)
2294 case D3DXPC_MATRIX_ROWS:
2295 for (i = 0; i < count; ++i)
2297 get_matrix(get_parameter_struct(param->member_handles[i]), &matrix[i], FALSE);
2308 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2313 WARN("Invalid argument specified\n");
2315 return D3DERR_INVALIDCALL;
2318 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2320 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2321 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2323 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2325 if (param && count <= param->element_count)
2329 switch (param->class)
2331 case D3DXPC_MATRIX_ROWS:
2332 for (i = 0; i < count; ++i)
2334 set_matrix(get_parameter_struct(param->member_handles[i]), matrix[i], FALSE);
2344 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2349 WARN("Invalid argument specified\n");
2351 return D3DERR_INVALIDCALL;
2354 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2356 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2357 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2359 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2361 if (!count) return D3D_OK;
2363 if (param && matrix && count <= param->element_count)
2367 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2369 switch (param->class)
2371 case D3DXPC_MATRIX_ROWS:
2372 for (i = 0; i < count; ++i)
2374 get_matrix(get_parameter_struct(param->member_handles[i]), matrix[i], FALSE);
2384 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2389 WARN("Invalid argument specified\n");
2391 return D3DERR_INVALIDCALL;
2394 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
2396 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2397 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2399 TRACE("iface %p, parameter %p, matrix %p\n", This, parameter, matrix);
2401 if (param && !param->element_count)
2403 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2405 switch (param->class)
2407 case D3DXPC_MATRIX_ROWS:
2408 set_matrix(param, matrix, TRUE);
2418 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2423 WARN("Invalid argument specified\n");
2425 return D3DERR_INVALIDCALL;
2428 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
2430 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2431 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2433 TRACE("iface %p, parameter %p, matrix %p\n", This, parameter, matrix);
2435 if (matrix && param && !param->element_count)
2437 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2439 switch (param->class)
2443 get_matrix(param, matrix, FALSE);
2446 case D3DXPC_MATRIX_ROWS:
2447 get_matrix(param, matrix, TRUE);
2455 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2460 WARN("Invalid argument specified\n");
2462 return D3DERR_INVALIDCALL;
2465 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
2467 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2468 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2470 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2472 if (param && param->element_count >= count)
2476 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2478 switch (param->class)
2480 case D3DXPC_MATRIX_ROWS:
2481 for (i = 0; i < count; ++i)
2483 set_matrix(get_parameter_struct(param->member_handles[i]), &matrix[i], TRUE);
2494 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2499 WARN("Invalid argument specified\n");
2501 return D3DERR_INVALIDCALL;
2504 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
2506 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2507 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2509 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2511 if (!count) return D3D_OK;
2513 if (matrix && param && count <= param->element_count)
2517 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2519 switch (param->class)
2521 case D3DXPC_MATRIX_ROWS:
2522 for (i = 0; i < count; ++i)
2524 get_matrix(get_parameter_struct(param->member_handles[i]), &matrix[i], TRUE);
2535 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2540 WARN("Invalid argument specified\n");
2542 return D3DERR_INVALIDCALL;
2545 static HRESULT WINAPI ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
2547 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2548 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2550 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2552 if (param && count <= param->element_count)
2556 switch (param->class)
2558 case D3DXPC_MATRIX_ROWS:
2559 for (i = 0; i < count; ++i)
2561 set_matrix(get_parameter_struct(param->member_handles[i]), matrix[i], TRUE);
2571 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2576 WARN("Invalid argument specified\n");
2578 return D3DERR_INVALIDCALL;
2581 static HRESULT WINAPI ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
2583 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2584 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2586 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This, parameter, matrix, count);
2588 if (!count) return D3D_OK;
2590 if (matrix && param && count <= param->element_count)
2594 TRACE("Class %s\n", debug_d3dxparameter_class(param->class));
2596 switch (param->class)
2598 case D3DXPC_MATRIX_ROWS:
2599 for (i = 0; i < count; ++i)
2601 get_matrix(get_parameter_struct(param->member_handles[i]), matrix[i], TRUE);
2611 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
2616 WARN("Invalid argument specified\n");
2618 return D3DERR_INVALIDCALL;
2621 static HRESULT WINAPI ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR string)
2623 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2625 FIXME("iface %p, parameter %p, string %p stub\n", This, parameter, string);
2630 static HRESULT WINAPI ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
2632 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2633 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2635 TRACE("iface %p, parameter %p, string %p\n", This, parameter, string);
2637 if (string && param && !param->element_count && param->type == D3DXPT_STRING)
2639 *string = *(LPCSTR *)param->data;
2640 TRACE("Returning %s\n", debugstr_a(*string));
2644 WARN("Invalid argument specified\n");
2646 return D3DERR_INVALIDCALL;
2649 static HRESULT WINAPI ID3DXBaseEffectImpl_SetTexture(struct ID3DXBaseEffect *iface,
2650 D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture)
2652 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2653 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2655 TRACE("iface %p, parameter %p, texture %p\n", This, parameter, texture);
2657 if (param && !param->element_count &&
2658 (param->type == D3DXPT_TEXTURE || param->type == D3DXPT_TEXTURE1D
2659 || param->type == D3DXPT_TEXTURE2D || param->type == D3DXPT_TEXTURE3D
2660 || param->type == D3DXPT_TEXTURECUBE))
2662 struct IDirect3DBaseTexture9 *oltexture = *(struct IDirect3DBaseTexture9 **)param->data;
2664 if (texture) IDirect3DBaseTexture9_AddRef(texture);
2665 if (oltexture) IDirect3DBaseTexture9_Release(oltexture);
2667 *(struct IDirect3DBaseTexture9 **)param->data = texture;
2672 WARN("Invalid argument specified\n");
2674 return D3DERR_INVALIDCALL;
2677 static HRESULT WINAPI ID3DXBaseEffectImpl_GetTexture(struct ID3DXBaseEffect *iface,
2678 D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture)
2680 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2681 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2683 TRACE("iface %p, parameter %p, texture %p\n", This, parameter, texture);
2685 if (texture && param && !param->element_count &&
2686 (param->type == D3DXPT_TEXTURE || param->type == D3DXPT_TEXTURE1D
2687 || param->type == D3DXPT_TEXTURE2D || param->type == D3DXPT_TEXTURE3D
2688 || param->type == D3DXPT_TEXTURECUBE))
2690 *texture = *(struct IDirect3DBaseTexture9 **)param->data;
2691 if (*texture) IDirect3DBaseTexture9_AddRef(*texture);
2692 TRACE("Returning %p\n", *texture);
2696 WARN("Invalid argument specified\n");
2698 return D3DERR_INVALIDCALL;
2701 static HRESULT WINAPI ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect *iface,
2702 D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader)
2704 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2705 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2707 TRACE("iface %p, parameter %p, shader %p.\n", This, parameter, shader);
2709 if (shader && param && !param->element_count && param->type == D3DXPT_PIXELSHADER)
2711 if ((*shader = *(struct IDirect3DPixelShader9 **)param->data))
2712 IDirect3DPixelShader9_AddRef(*shader);
2713 TRACE("Returning %p.\n", *shader);
2717 WARN("Invalid argument specified\n");
2719 return D3DERR_INVALIDCALL;
2722 static HRESULT WINAPI ID3DXBaseEffectImpl_GetVertexShader(struct ID3DXBaseEffect *iface,
2723 D3DXHANDLE parameter, struct IDirect3DVertexShader9 **shader)
2725 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2726 struct d3dx_parameter *param = get_valid_parameter(This, parameter);
2728 TRACE("iface %p, parameter %p, shader %p.\n", This, parameter, shader);
2730 if (shader && param && !param->element_count && param->type == D3DXPT_VERTEXSHADER)
2732 if ((*shader = *(struct IDirect3DVertexShader9 **)param->data))
2733 IDirect3DVertexShader9_AddRef(*shader);
2734 TRACE("Returning %p.\n", *shader);
2738 WARN("Invalid argument specified\n");
2740 return D3DERR_INVALIDCALL;
2743 static HRESULT WINAPI ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
2745 struct ID3DXBaseEffectImpl *This = impl_from_ID3DXBaseEffect(iface);
2747 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This, parameter, start, end);
2752 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl =
2754 /*** IUnknown methods ***/
2755 ID3DXBaseEffectImpl_QueryInterface,
2756 ID3DXBaseEffectImpl_AddRef,
2757 ID3DXBaseEffectImpl_Release,
2758 /*** ID3DXBaseEffect methods ***/
2759 ID3DXBaseEffectImpl_GetDesc,
2760 ID3DXBaseEffectImpl_GetParameterDesc,
2761 ID3DXBaseEffectImpl_GetTechniqueDesc,
2762 ID3DXBaseEffectImpl_GetPassDesc,
2763 ID3DXBaseEffectImpl_GetFunctionDesc,
2764 ID3DXBaseEffectImpl_GetParameter,
2765 ID3DXBaseEffectImpl_GetParameterByName,
2766 ID3DXBaseEffectImpl_GetParameterBySemantic,
2767 ID3DXBaseEffectImpl_GetParameterElement,
2768 ID3DXBaseEffectImpl_GetTechnique,
2769 ID3DXBaseEffectImpl_GetTechniqueByName,
2770 ID3DXBaseEffectImpl_GetPass,
2771 ID3DXBaseEffectImpl_GetPassByName,
2772 ID3DXBaseEffectImpl_GetFunction,
2773 ID3DXBaseEffectImpl_GetFunctionByName,
2774 ID3DXBaseEffectImpl_GetAnnotation,
2775 ID3DXBaseEffectImpl_GetAnnotationByName,
2776 ID3DXBaseEffectImpl_SetValue,
2777 ID3DXBaseEffectImpl_GetValue,
2778 ID3DXBaseEffectImpl_SetBool,
2779 ID3DXBaseEffectImpl_GetBool,
2780 ID3DXBaseEffectImpl_SetBoolArray,
2781 ID3DXBaseEffectImpl_GetBoolArray,
2782 ID3DXBaseEffectImpl_SetInt,
2783 ID3DXBaseEffectImpl_GetInt,
2784 ID3DXBaseEffectImpl_SetIntArray,
2785 ID3DXBaseEffectImpl_GetIntArray,
2786 ID3DXBaseEffectImpl_SetFloat,
2787 ID3DXBaseEffectImpl_GetFloat,
2788 ID3DXBaseEffectImpl_SetFloatArray,
2789 ID3DXBaseEffectImpl_GetFloatArray,
2790 ID3DXBaseEffectImpl_SetVector,
2791 ID3DXBaseEffectImpl_GetVector,
2792 ID3DXBaseEffectImpl_SetVectorArray,
2793 ID3DXBaseEffectImpl_GetVectorArray,
2794 ID3DXBaseEffectImpl_SetMatrix,
2795 ID3DXBaseEffectImpl_GetMatrix,
2796 ID3DXBaseEffectImpl_SetMatrixArray,
2797 ID3DXBaseEffectImpl_GetMatrixArray,
2798 ID3DXBaseEffectImpl_SetMatrixPointerArray,
2799 ID3DXBaseEffectImpl_GetMatrixPointerArray,
2800 ID3DXBaseEffectImpl_SetMatrixTranspose,
2801 ID3DXBaseEffectImpl_GetMatrixTranspose,
2802 ID3DXBaseEffectImpl_SetMatrixTransposeArray,
2803 ID3DXBaseEffectImpl_GetMatrixTransposeArray,
2804 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray,
2805 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray,
2806 ID3DXBaseEffectImpl_SetString,
2807 ID3DXBaseEffectImpl_GetString,
2808 ID3DXBaseEffectImpl_SetTexture,
2809 ID3DXBaseEffectImpl_GetTexture,
2810 ID3DXBaseEffectImpl_GetPixelShader,
2811 ID3DXBaseEffectImpl_GetVertexShader,
2812 ID3DXBaseEffectImpl_SetArrayRange,
2815 static inline struct ID3DXEffectImpl *impl_from_ID3DXEffect(ID3DXEffect *iface)
2817 return CONTAINING_RECORD(iface, struct ID3DXEffectImpl, ID3DXEffect_iface);
2820 /*** IUnknown methods ***/
2821 static HRESULT WINAPI ID3DXEffectImpl_QueryInterface(ID3DXEffect *iface, REFIID riid, void **object)
2823 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), object);
2825 if (IsEqualGUID(riid, &IID_IUnknown) ||
2826 IsEqualGUID(riid, &IID_ID3DXEffect))
2828 iface->lpVtbl->AddRef(iface);
2833 ERR("Interface %s not found\n", debugstr_guid(riid));
2835 return E_NOINTERFACE;
2838 static ULONG WINAPI ID3DXEffectImpl_AddRef(ID3DXEffect *iface)
2840 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2842 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
2844 return InterlockedIncrement(&This->ref);
2847 static ULONG WINAPI ID3DXEffectImpl_Release(ID3DXEffect *iface)
2849 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2850 ULONG ref = InterlockedDecrement(&This->ref);
2852 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
2857 HeapFree(GetProcessHeap(), 0, This);
2863 /*** ID3DXBaseEffect methods ***/
2864 static HRESULT WINAPI ID3DXEffectImpl_GetDesc(ID3DXEffect *iface, D3DXEFFECT_DESC *desc)
2866 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2867 ID3DXBaseEffect *base = This->base_effect;
2869 TRACE("Forward iface %p, base %p\n", This, base);
2871 return ID3DXBaseEffectImpl_GetDesc(base, desc);
2874 static HRESULT WINAPI ID3DXEffectImpl_GetParameterDesc(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
2876 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2877 ID3DXBaseEffect *base = This->base_effect;
2879 TRACE("Forward iface %p, base %p\n", This, base);
2881 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
2884 static HRESULT WINAPI ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
2886 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2887 ID3DXBaseEffect *base = This->base_effect;
2889 TRACE("Forward iface %p, base %p\n", This, base);
2891 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
2894 static HRESULT WINAPI ID3DXEffectImpl_GetPassDesc(ID3DXEffect *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
2896 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2897 ID3DXBaseEffect *base = This->base_effect;
2899 TRACE("Forward iface %p, base %p\n", This, base);
2901 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
2904 static HRESULT WINAPI ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
2906 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2907 ID3DXBaseEffect *base = This->base_effect;
2909 TRACE("Forward iface %p, base %p\n", This, base);
2911 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
2914 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameter(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
2916 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2917 ID3DXBaseEffect *base = This->base_effect;
2919 TRACE("Forward iface %p, base %p\n", This, base);
2921 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
2924 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterByName(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR name)
2926 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2927 ID3DXBaseEffect *base = This->base_effect;
2929 TRACE("Forward iface %p, base %p\n", This, base);
2931 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
2934 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR semantic)
2936 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2937 ID3DXBaseEffect *base = This->base_effect;
2939 TRACE("Forward iface %p, base %p\n", This, base);
2941 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
2944 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetParameterElement(ID3DXEffect *iface, D3DXHANDLE parameter, UINT index)
2946 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2947 ID3DXBaseEffect *base = This->base_effect;
2949 TRACE("Forward iface %p, base %p\n", This, base);
2951 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
2954 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechnique(ID3DXEffect *iface, UINT index)
2956 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2957 ID3DXBaseEffect *base = This->base_effect;
2959 TRACE("Forward iface %p, base %p\n", This, base);
2961 return ID3DXBaseEffectImpl_GetTechnique(base, index);
2964 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect *iface, LPCSTR name)
2966 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2967 ID3DXBaseEffect *base = This->base_effect;
2969 TRACE("Forward iface %p, base %p\n", This, base);
2971 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
2974 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPass(ID3DXEffect *iface, D3DXHANDLE technique, UINT index)
2976 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2977 ID3DXBaseEffect *base = This->base_effect;
2979 TRACE("Forward iface %p, base %p\n", This, base);
2981 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
2984 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetPassByName(ID3DXEffect *iface, D3DXHANDLE technique, LPCSTR name)
2986 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2987 ID3DXBaseEffect *base = This->base_effect;
2989 TRACE("Forward iface %p, base %p\n", This, base);
2991 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
2994 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunction(ID3DXEffect *iface, UINT index)
2996 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
2997 ID3DXBaseEffect *base = This->base_effect;
2999 TRACE("Forward iface %p, base %p\n", This, base);
3001 return ID3DXBaseEffectImpl_GetFunction(base, index);
3004 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetFunctionByName(ID3DXEffect *iface, LPCSTR name)
3006 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3007 ID3DXBaseEffect *base = This->base_effect;
3009 TRACE("Forward iface %p, base %p\n", This, base);
3011 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
3014 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotation(ID3DXEffect *iface, D3DXHANDLE object, UINT index)
3016 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3017 ID3DXBaseEffect *base = This->base_effect;
3019 TRACE("Forward iface %p, base %p\n", This, base);
3021 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
3024 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect *iface, D3DXHANDLE object, LPCSTR name)
3026 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3027 ID3DXBaseEffect *base = This->base_effect;
3029 TRACE("Forward iface %p, base %p\n", This, base);
3031 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
3034 static HRESULT WINAPI ID3DXEffectImpl_SetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
3036 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3037 ID3DXBaseEffect *base = This->base_effect;
3039 TRACE("Forward iface %p, base %p\n", This, base);
3041 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
3044 static HRESULT WINAPI ID3DXEffectImpl_GetValue(ID3DXEffect *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
3046 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3047 ID3DXBaseEffect *base = This->base_effect;
3049 TRACE("Forward iface %p, base %p\n", This, base);
3051 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
3054 static HRESULT WINAPI ID3DXEffectImpl_SetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL b)
3056 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3057 ID3DXBaseEffect *base = This->base_effect;
3059 TRACE("Forward iface %p, base %p\n", This, base);
3061 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
3064 static HRESULT WINAPI ID3DXEffectImpl_GetBool(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b)
3066 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3067 ID3DXBaseEffect *base = This->base_effect;
3069 TRACE("Forward iface %p, base %p\n", This, base);
3071 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
3074 static HRESULT WINAPI ID3DXEffectImpl_SetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
3076 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3077 ID3DXBaseEffect *base = This->base_effect;
3079 TRACE("Forward iface %p, base %p\n", This, base);
3081 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
3084 static HRESULT WINAPI ID3DXEffectImpl_GetBoolArray(ID3DXEffect *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
3086 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3087 ID3DXBaseEffect *base = This->base_effect;
3089 TRACE("Forward iface %p, base %p\n", This, base);
3091 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
3094 static HRESULT WINAPI ID3DXEffectImpl_SetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT n)
3096 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3097 ID3DXBaseEffect *base = This->base_effect;
3099 TRACE("Forward iface %p, base %p\n", This, base);
3101 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
3104 static HRESULT WINAPI ID3DXEffectImpl_GetInt(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n)
3106 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3107 ID3DXBaseEffect *base = This->base_effect;
3109 TRACE("Forward iface %p, base %p\n", This, base);
3111 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
3114 static HRESULT WINAPI ID3DXEffectImpl_SetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
3116 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3117 ID3DXBaseEffect *base = This->base_effect;
3119 TRACE("Forward iface %p, base %p\n", This, base);
3121 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
3124 static HRESULT WINAPI ID3DXEffectImpl_GetIntArray(ID3DXEffect *iface, D3DXHANDLE parameter, INT *n, UINT count)
3126 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3127 ID3DXBaseEffect *base = This->base_effect;
3129 TRACE("Forward iface %p, base %p\n", This, base);
3131 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
3134 static HRESULT WINAPI ID3DXEffectImpl_SetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT f)
3136 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3137 ID3DXBaseEffect *base = This->base_effect;
3139 TRACE("Forward iface %p, base %p\n", This, base);
3141 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
3144 static HRESULT WINAPI ID3DXEffectImpl_GetFloat(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f)
3146 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3147 ID3DXBaseEffect *base = This->base_effect;
3149 TRACE("Forward iface %p, base %p\n", This, base);
3151 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
3154 static HRESULT WINAPI ID3DXEffectImpl_SetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
3156 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3157 ID3DXBaseEffect *base = This->base_effect;
3159 TRACE("Forward iface %p, base %p\n", This, base);
3161 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
3164 static HRESULT WINAPI ID3DXEffectImpl_GetFloatArray(ID3DXEffect *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
3166 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3167 ID3DXBaseEffect *base = This->base_effect;
3169 TRACE("Forward iface %p, base %p\n", This, base);
3171 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
3174 static HRESULT WINAPI ID3DXEffectImpl_SetVector(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
3176 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3177 ID3DXBaseEffect *base = This->base_effect;
3179 TRACE("Forward iface %p, base %p\n", This, base);
3181 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
3184 static HRESULT WINAPI ID3DXEffectImpl_GetVector(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
3186 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3187 ID3DXBaseEffect *base = This->base_effect;
3189 TRACE("Forward iface %p, base %p\n", This, base);
3191 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
3194 static HRESULT WINAPI ID3DXEffectImpl_SetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
3196 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3197 ID3DXBaseEffect *base = This->base_effect;
3199 TRACE("Forward iface %p, base %p\n", This, base);
3201 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
3204 static HRESULT WINAPI ID3DXEffectImpl_GetVectorArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
3206 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3207 ID3DXBaseEffect *base = This->base_effect;
3209 TRACE("Forward iface %p, base %p\n", This, base);
3211 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
3214 static HRESULT WINAPI ID3DXEffectImpl_SetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3216 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3217 ID3DXBaseEffect *base = This->base_effect;
3219 TRACE("Forward iface %p, base %p\n", This, base);
3221 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
3224 static HRESULT WINAPI ID3DXEffectImpl_GetMatrix(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3226 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3227 ID3DXBaseEffect *base = This->base_effect;
3229 TRACE("Forward iface %p, base %p\n", This, base);
3231 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
3234 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3236 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3237 ID3DXBaseEffect *base = This->base_effect;
3239 TRACE("Forward iface %p, base %p\n", This, base);
3241 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
3244 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3246 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3247 ID3DXBaseEffect *base = This->base_effect;
3249 TRACE("Forward iface %p, base %p\n", This, base);
3251 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
3254 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3256 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3257 ID3DXBaseEffect *base = This->base_effect;
3259 TRACE("Forward iface %p, base %p\n", This, base);
3261 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
3264 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3266 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3267 ID3DXBaseEffect *base = This->base_effect;
3269 TRACE("Forward iface %p, base %p\n", This, base);
3271 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
3274 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
3276 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3277 ID3DXBaseEffect *base = This->base_effect;
3279 TRACE("Forward iface %p, base %p\n", This, base);
3281 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
3284 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
3286 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3287 ID3DXBaseEffect *base = This->base_effect;
3289 TRACE("Forward iface %p, base %p\n", This, base);
3291 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
3294 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
3296 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3297 ID3DXBaseEffect *base = This->base_effect;
3299 TRACE("Forward iface %p, base %p\n", This, base);
3301 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
3304 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
3306 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3307 ID3DXBaseEffect *base = This->base_effect;
3309 TRACE("Forward iface %p, base %p\n", This, base);
3311 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
3314 static HRESULT WINAPI ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
3316 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3317 ID3DXBaseEffect *base = This->base_effect;
3319 TRACE("Forward iface %p, base %p\n", This, base);
3321 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
3324 static HRESULT WINAPI ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
3326 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3327 ID3DXBaseEffect *base = This->base_effect;
3329 TRACE("Forward iface %p, base %p\n", This, base);
3331 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
3334 static HRESULT WINAPI ID3DXEffectImpl_SetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR string)
3336 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3337 ID3DXBaseEffect *base = This->base_effect;
3339 TRACE("Forward iface %p, base %p\n", This, base);
3341 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
3344 static HRESULT WINAPI ID3DXEffectImpl_GetString(ID3DXEffect *iface, D3DXHANDLE parameter, LPCSTR *string)
3346 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3347 ID3DXBaseEffect *base = This->base_effect;
3349 TRACE("Forward iface %p, base %p\n", This, base);
3351 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
3354 static HRESULT WINAPI ID3DXEffectImpl_SetTexture(struct ID3DXEffect *iface,
3355 D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture)
3357 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3358 ID3DXBaseEffect *base = This->base_effect;
3360 TRACE("Forward iface %p, base %p\n", This, base);
3362 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
3365 static HRESULT WINAPI ID3DXEffectImpl_GetTexture(struct ID3DXEffect *iface,
3366 D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture)
3368 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3369 ID3DXBaseEffect *base = This->base_effect;
3371 TRACE("Forward iface %p, base %p\n", This, base);
3373 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
3376 static HRESULT WINAPI ID3DXEffectImpl_GetPixelShader(ID3DXEffect *iface,
3377 D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader)
3379 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3380 ID3DXBaseEffect *base = This->base_effect;
3382 TRACE("Forward iface %p, base %p\n", This, base);
3384 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, shader);
3387 static HRESULT WINAPI ID3DXEffectImpl_GetVertexShader(struct ID3DXEffect *iface,
3388 D3DXHANDLE parameter, struct IDirect3DVertexShader9 **shader)
3390 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3391 ID3DXBaseEffect *base = This->base_effect;
3393 TRACE("Forward iface %p, base %p\n", This, base);
3395 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, shader);
3398 static HRESULT WINAPI ID3DXEffectImpl_SetArrayRange(ID3DXEffect *iface, D3DXHANDLE parameter, UINT start, UINT end)
3400 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3401 ID3DXBaseEffect *base = This->base_effect;
3403 TRACE("Forward iface %p, base %p\n", This, base);
3405 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
3408 /*** ID3DXEffect methods ***/
3409 static HRESULT WINAPI ID3DXEffectImpl_GetPool(ID3DXEffect *iface, ID3DXEffectPool **pool)
3411 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3413 TRACE("iface %p, pool %p\n", This, pool);
3417 WARN("Invalid argument supplied.\n");
3418 return D3DERR_INVALIDCALL;
3423 This->pool->lpVtbl->AddRef(This->pool);
3428 TRACE("Returning pool %p\n", *pool);
3433 static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect *iface, D3DXHANDLE technique)
3435 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3436 struct ID3DXBaseEffectImpl *base = impl_from_ID3DXBaseEffect(This->base_effect);
3437 struct d3dx_technique *tech = is_valid_technique(base, technique);
3439 TRACE("iface %p, technique %p\n", This, technique);
3443 This->active_technique = get_technique_handle(tech);
3444 TRACE("Technique %p\n", tech);
3448 WARN("Invalid argument supplied.\n");
3450 return D3DERR_INVALIDCALL;
3453 static D3DXHANDLE WINAPI ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect *iface)
3455 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3457 TRACE("iface %p\n", This);
3459 return This->active_technique;
3462 static HRESULT WINAPI ID3DXEffectImpl_ValidateTechnique(ID3DXEffect* iface, D3DXHANDLE technique)
3464 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3466 FIXME("(%p)->(%p): stub\n", This, technique);
3471 static HRESULT WINAPI ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect* iface, D3DXHANDLE technique, D3DXHANDLE* next_technique)
3473 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3475 FIXME("(%p)->(%p, %p): stub\n", This, technique, next_technique);
3480 static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDLE parameter, D3DXHANDLE technique)
3482 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3484 FIXME("(%p)->(%p, %p): stub\n", This, parameter, technique);
3489 static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DWORD flags)
3491 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3492 struct d3dx_technique *technique = get_technique_struct(This->active_technique);
3494 FIXME("iface %p, passes %p, flags %#x partial stub\n", This, passes, flags);
3496 if (passes && technique)
3498 if (This->manager || flags & D3DXFX_DONOTSAVESTATE)
3500 TRACE("State capturing disabled.\n");
3504 FIXME("State capturing not supported, yet!\n");
3507 *passes = technique->pass_count;
3512 WARN("Invalid argument supplied.\n");
3514 return D3DERR_INVALIDCALL;
3517 static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect *iface, UINT pass)
3519 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3520 struct d3dx_technique *technique = get_technique_struct(This->active_technique);
3522 TRACE("iface %p, pass %u\n", This, pass);
3524 if (technique && pass < technique->pass_count && !This->active_pass)
3526 This->active_pass = technique->pass_handles[pass];
3528 FIXME("No states applied, yet!\n");
3533 WARN("Invalid argument supplied.\n");
3535 return D3DERR_INVALIDCALL;
3538 static HRESULT WINAPI ID3DXEffectImpl_CommitChanges(ID3DXEffect* iface)
3540 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3542 FIXME("(%p)->(): stub\n", This);
3547 static HRESULT WINAPI ID3DXEffectImpl_EndPass(ID3DXEffect *iface)
3549 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3551 TRACE("iface %p\n", This);
3553 if (This->active_pass)
3555 This->active_pass = NULL;
3559 WARN("Invalid call.\n");
3561 return D3DERR_INVALIDCALL;
3564 static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect* iface)
3566 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3568 FIXME("(%p)->(): stub\n", This);
3573 static HRESULT WINAPI ID3DXEffectImpl_GetDevice(ID3DXEffect *iface, struct IDirect3DDevice9 **device)
3575 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3577 TRACE("iface %p, device %p\n", This, device);
3581 WARN("Invalid argument supplied.\n");
3582 return D3DERR_INVALIDCALL;
3585 IDirect3DDevice9_AddRef(This->device);
3587 *device = This->device;
3589 TRACE("Returning device %p\n", *device);
3594 static HRESULT WINAPI ID3DXEffectImpl_OnLostDevice(ID3DXEffect* iface)
3596 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3598 FIXME("(%p)->(): stub\n", This);
3603 static HRESULT WINAPI ID3DXEffectImpl_OnResetDevice(ID3DXEffect* iface)
3605 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3607 FIXME("(%p)->(): stub\n", This);
3612 static HRESULT WINAPI ID3DXEffectImpl_SetStateManager(ID3DXEffect *iface, ID3DXEffectStateManager *manager)
3614 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3616 TRACE("iface %p, manager %p\n", This, manager);
3618 if (manager) IUnknown_AddRef(manager);
3619 if (This->manager) IUnknown_Release(This->manager);
3621 This->manager = manager;
3626 static HRESULT WINAPI ID3DXEffectImpl_GetStateManager(ID3DXEffect *iface, ID3DXEffectStateManager **manager)
3628 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3630 TRACE("iface %p, manager %p\n", This, manager);
3634 WARN("Invalid argument supplied.\n");
3635 return D3DERR_INVALIDCALL;
3638 if (This->manager) IUnknown_AddRef(This->manager);
3639 *manager = This->manager;
3644 static HRESULT WINAPI ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect* iface)
3646 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3648 FIXME("(%p)->(): stub\n", This);
3653 static D3DXHANDLE WINAPI ID3DXEffectImpl_EndParameterBlock(ID3DXEffect* iface)
3655 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3657 FIXME("(%p)->(): stub\n", This);
3662 static HRESULT WINAPI ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
3664 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3666 FIXME("(%p)->(%p): stub\n", This, parameter_block);
3671 static HRESULT WINAPI ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect* iface, D3DXHANDLE parameter_block)
3673 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3675 FIXME("(%p)->(%p): stub\n", This, parameter_block);
3680 static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect *iface,
3681 struct IDirect3DDevice9 *device, struct ID3DXEffect **effect)
3683 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3685 FIXME("(%p)->(%p, %p): stub\n", This, device, effect);
3690 static HRESULT WINAPI ID3DXEffectImpl_SetRawValue(ID3DXEffect* iface, D3DXHANDLE parameter, LPCVOID data, UINT byte_offset, UINT bytes)
3692 struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface);
3694 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This, parameter, data, byte_offset, bytes);
3699 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl =
3701 /*** IUnknown methods ***/
3702 ID3DXEffectImpl_QueryInterface,
3703 ID3DXEffectImpl_AddRef,
3704 ID3DXEffectImpl_Release,
3705 /*** ID3DXBaseEffect methods ***/
3706 ID3DXEffectImpl_GetDesc,
3707 ID3DXEffectImpl_GetParameterDesc,
3708 ID3DXEffectImpl_GetTechniqueDesc,
3709 ID3DXEffectImpl_GetPassDesc,
3710 ID3DXEffectImpl_GetFunctionDesc,
3711 ID3DXEffectImpl_GetParameter,
3712 ID3DXEffectImpl_GetParameterByName,
3713 ID3DXEffectImpl_GetParameterBySemantic,
3714 ID3DXEffectImpl_GetParameterElement,
3715 ID3DXEffectImpl_GetTechnique,
3716 ID3DXEffectImpl_GetTechniqueByName,
3717 ID3DXEffectImpl_GetPass,
3718 ID3DXEffectImpl_GetPassByName,
3719 ID3DXEffectImpl_GetFunction,
3720 ID3DXEffectImpl_GetFunctionByName,
3721 ID3DXEffectImpl_GetAnnotation,
3722 ID3DXEffectImpl_GetAnnotationByName,
3723 ID3DXEffectImpl_SetValue,
3724 ID3DXEffectImpl_GetValue,
3725 ID3DXEffectImpl_SetBool,
3726 ID3DXEffectImpl_GetBool,
3727 ID3DXEffectImpl_SetBoolArray,
3728 ID3DXEffectImpl_GetBoolArray,
3729 ID3DXEffectImpl_SetInt,
3730 ID3DXEffectImpl_GetInt,
3731 ID3DXEffectImpl_SetIntArray,
3732 ID3DXEffectImpl_GetIntArray,
3733 ID3DXEffectImpl_SetFloat,
3734 ID3DXEffectImpl_GetFloat,
3735 ID3DXEffectImpl_SetFloatArray,
3736 ID3DXEffectImpl_GetFloatArray,
3737 ID3DXEffectImpl_SetVector,
3738 ID3DXEffectImpl_GetVector,
3739 ID3DXEffectImpl_SetVectorArray,
3740 ID3DXEffectImpl_GetVectorArray,
3741 ID3DXEffectImpl_SetMatrix,
3742 ID3DXEffectImpl_GetMatrix,
3743 ID3DXEffectImpl_SetMatrixArray,
3744 ID3DXEffectImpl_GetMatrixArray,
3745 ID3DXEffectImpl_SetMatrixPointerArray,
3746 ID3DXEffectImpl_GetMatrixPointerArray,
3747 ID3DXEffectImpl_SetMatrixTranspose,
3748 ID3DXEffectImpl_GetMatrixTranspose,
3749 ID3DXEffectImpl_SetMatrixTransposeArray,
3750 ID3DXEffectImpl_GetMatrixTransposeArray,
3751 ID3DXEffectImpl_SetMatrixTransposePointerArray,
3752 ID3DXEffectImpl_GetMatrixTransposePointerArray,
3753 ID3DXEffectImpl_SetString,
3754 ID3DXEffectImpl_GetString,
3755 ID3DXEffectImpl_SetTexture,
3756 ID3DXEffectImpl_GetTexture,
3757 ID3DXEffectImpl_GetPixelShader,
3758 ID3DXEffectImpl_GetVertexShader,
3759 ID3DXEffectImpl_SetArrayRange,
3760 /*** ID3DXEffect methods ***/
3761 ID3DXEffectImpl_GetPool,
3762 ID3DXEffectImpl_SetTechnique,
3763 ID3DXEffectImpl_GetCurrentTechnique,
3764 ID3DXEffectImpl_ValidateTechnique,
3765 ID3DXEffectImpl_FindNextValidTechnique,
3766 ID3DXEffectImpl_IsParameterUsed,
3767 ID3DXEffectImpl_Begin,
3768 ID3DXEffectImpl_BeginPass,
3769 ID3DXEffectImpl_CommitChanges,
3770 ID3DXEffectImpl_EndPass,
3771 ID3DXEffectImpl_End,
3772 ID3DXEffectImpl_GetDevice,
3773 ID3DXEffectImpl_OnLostDevice,
3774 ID3DXEffectImpl_OnResetDevice,
3775 ID3DXEffectImpl_SetStateManager,
3776 ID3DXEffectImpl_GetStateManager,
3777 ID3DXEffectImpl_BeginParameterBlock,
3778 ID3DXEffectImpl_EndParameterBlock,
3779 ID3DXEffectImpl_ApplyParameterBlock,
3780 ID3DXEffectImpl_DeleteParameterBlock,
3781 ID3DXEffectImpl_CloneEffect,
3782 ID3DXEffectImpl_SetRawValue
3785 static inline struct ID3DXEffectCompilerImpl *impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler *iface)
3787 return CONTAINING_RECORD(iface, struct ID3DXEffectCompilerImpl, ID3DXEffectCompiler_iface);
3790 /*** IUnknown methods ***/
3791 static HRESULT WINAPI ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler *iface, REFIID riid, void **object)
3793 TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
3795 if (IsEqualGUID(riid, &IID_IUnknown) ||
3796 IsEqualGUID(riid, &IID_ID3DXEffectCompiler))
3798 iface->lpVtbl->AddRef(iface);
3803 ERR("Interface %s not found\n", debugstr_guid(riid));
3805 return E_NOINTERFACE;
3808 static ULONG WINAPI ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler *iface)
3810 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3812 TRACE("iface %p: AddRef from %u\n", iface, This->ref);
3814 return InterlockedIncrement(&This->ref);
3817 static ULONG WINAPI ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler *iface)
3819 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3820 ULONG ref = InterlockedDecrement(&This->ref);
3822 TRACE("iface %p: Release from %u\n", iface, ref + 1);
3826 free_effect_compiler(This);
3827 HeapFree(GetProcessHeap(), 0, This);
3833 /*** ID3DXBaseEffect methods ***/
3834 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler *iface, D3DXEFFECT_DESC *desc)
3836 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3837 ID3DXBaseEffect *base = This->base_effect;
3839 TRACE("Forward iface %p, base %p\n", This, base);
3841 return ID3DXBaseEffectImpl_GetDesc(base, desc);
3844 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXPARAMETER_DESC *desc)
3846 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3847 ID3DXBaseEffect *base = This->base_effect;
3849 TRACE("Forward iface %p, base %p\n", This, base);
3851 return ID3DXBaseEffectImpl_GetParameterDesc(base, parameter, desc);
3854 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler *iface, D3DXHANDLE technique, D3DXTECHNIQUE_DESC *desc)
3856 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3857 ID3DXBaseEffect *base = This->base_effect;
3859 TRACE("Forward iface %p, base %p\n", This, base);
3861 return ID3DXBaseEffectImpl_GetTechniqueDesc(base, technique, desc);
3864 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler *iface, D3DXHANDLE pass, D3DXPASS_DESC *desc)
3866 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3867 ID3DXBaseEffect *base = This->base_effect;
3869 TRACE("Forward iface %p, base %p\n", This, base);
3871 return ID3DXBaseEffectImpl_GetPassDesc(base, pass, desc);
3874 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler *iface, D3DXHANDLE shader, D3DXFUNCTION_DESC *desc)
3876 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3877 ID3DXBaseEffect *base = This->base_effect;
3879 TRACE("Forward iface %p, base %p\n", This, base);
3881 return ID3DXBaseEffectImpl_GetFunctionDesc(base, shader, desc);
3884 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
3886 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3887 ID3DXBaseEffect *base = This->base_effect;
3889 TRACE("Forward iface %p, base %p\n", This, base);
3891 return ID3DXBaseEffectImpl_GetParameter(base, parameter, index);
3894 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR name)
3896 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3897 ID3DXBaseEffect *base = This->base_effect;
3899 TRACE("Forward iface %p, base %p\n", This, base);
3901 return ID3DXBaseEffectImpl_GetParameterByName(base, parameter, name);
3904 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR semantic)
3906 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3907 ID3DXBaseEffect *base = This->base_effect;
3909 TRACE("Forward iface %p, base %p\n", This, base);
3911 return ID3DXBaseEffectImpl_GetParameterBySemantic(base, parameter, semantic);
3914 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT index)
3916 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3917 ID3DXBaseEffect *base = This->base_effect;
3919 TRACE("Forward iface %p, base %p\n", This, base);
3921 return ID3DXBaseEffectImpl_GetParameterElement(base, parameter, index);
3924 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler *iface, UINT index)
3926 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3927 ID3DXBaseEffect *base = This->base_effect;
3929 TRACE("Forward iface %p, base %p\n", This, base);
3931 return ID3DXBaseEffectImpl_GetTechnique(base, index);
3934 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler *iface, LPCSTR name)
3936 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3937 ID3DXBaseEffect *base = This->base_effect;
3939 TRACE("Forward iface %p, base %p\n", This, base);
3941 return ID3DXBaseEffectImpl_GetTechniqueByName(base, name);
3944 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler *iface, D3DXHANDLE technique, UINT index)
3946 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3947 ID3DXBaseEffect *base = This->base_effect;
3949 TRACE("Forward iface %p, base %p\n", This, base);
3951 return ID3DXBaseEffectImpl_GetPass(base, technique, index);
3954 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler *iface, D3DXHANDLE technique, LPCSTR name)
3956 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3957 ID3DXBaseEffect *base = This->base_effect;
3959 TRACE("Forward iface %p, base %p\n", This, base);
3961 return ID3DXBaseEffectImpl_GetPassByName(base, technique, name);
3964 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler *iface, UINT index)
3966 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3967 ID3DXBaseEffect *base = This->base_effect;
3969 TRACE("Forward iface %p, base %p\n", This, base);
3971 return ID3DXBaseEffectImpl_GetFunction(base, index);
3974 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler *iface, LPCSTR name)
3976 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3977 ID3DXBaseEffect *base = This->base_effect;
3979 TRACE("Forward iface %p, base %p\n", This, base);
3981 return ID3DXBaseEffectImpl_GetFunctionByName(base, name);
3984 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler *iface, D3DXHANDLE object, UINT index)
3986 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3987 ID3DXBaseEffect *base = This->base_effect;
3989 TRACE("Forward iface %p, base %p\n", This, base);
3991 return ID3DXBaseEffectImpl_GetAnnotation(base, object, index);
3994 static D3DXHANDLE WINAPI ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler *iface, D3DXHANDLE object, LPCSTR name)
3996 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
3997 ID3DXBaseEffect *base = This->base_effect;
3999 TRACE("Forward iface %p, base %p\n", This, base);
4001 return ID3DXBaseEffectImpl_GetAnnotationByName(base, object, name);
4004 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCVOID data, UINT bytes)
4006 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4007 ID3DXBaseEffect *base = This->base_effect;
4009 TRACE("Forward iface %p, base %p\n", This, base);
4011 return ID3DXBaseEffectImpl_SetValue(base, parameter, data, bytes);
4014 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPVOID data, UINT bytes)
4016 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4017 ID3DXBaseEffect *base = This->base_effect;
4019 TRACE("Forward iface %p, base %p\n", This, base);
4021 return ID3DXBaseEffectImpl_GetValue(base, parameter, data, bytes);
4024 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL b)
4026 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4027 ID3DXBaseEffect *base = This->base_effect;
4029 TRACE("Forward iface %p, base %p\n", This, base);
4031 return ID3DXBaseEffectImpl_SetBool(base, parameter, b);
4034 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b)
4036 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4037 ID3DXBaseEffect *base = This->base_effect;
4039 TRACE("Forward iface %p, base %p\n", This, base);
4041 return ID3DXBaseEffectImpl_GetBool(base, parameter, b);
4044 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST BOOL *b, UINT count)
4046 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4047 ID3DXBaseEffect *base = This->base_effect;
4049 TRACE("Forward iface %p, base %p\n", This, base);
4051 return ID3DXBaseEffectImpl_SetBoolArray(base, parameter, b, count);
4054 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *b, UINT count)
4056 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4057 ID3DXBaseEffect *base = This->base_effect;
4059 TRACE("Forward iface %p, base %p\n", This, base);
4061 return ID3DXBaseEffectImpl_GetBoolArray(base, parameter, b, count);
4064 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT n)
4066 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4067 ID3DXBaseEffect *base = This->base_effect;
4069 TRACE("Forward iface %p, base %p\n", This, base);
4071 return ID3DXBaseEffectImpl_SetInt(base, parameter, n);
4074 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n)
4076 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4077 ID3DXBaseEffect *base = This->base_effect;
4079 TRACE("Forward iface %p, base %p\n", This, base);
4081 return ID3DXBaseEffectImpl_GetInt(base, parameter, n);
4084 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST INT *n, UINT count)
4086 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4087 ID3DXBaseEffect *base = This->base_effect;
4089 TRACE("Forward iface %p, base %p\n", This, base);
4091 return ID3DXBaseEffectImpl_SetIntArray(base, parameter, n, count);
4094 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, INT *n, UINT count)
4096 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4097 ID3DXBaseEffect *base = This->base_effect;
4099 TRACE("Forward iface %p, base %p\n", This, base);
4101 return ID3DXBaseEffectImpl_GetIntArray(base, parameter, n, count);
4104 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT f)
4106 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4107 ID3DXBaseEffect *base = This->base_effect;
4109 TRACE("Forward iface %p, base %p\n", This, base);
4111 return ID3DXBaseEffectImpl_SetFloat(base, parameter, f);
4114 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f)
4116 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4117 ID3DXBaseEffect *base = This->base_effect;
4119 TRACE("Forward iface %p, base %p\n", This, base);
4121 return ID3DXBaseEffectImpl_GetFloat(base, parameter, f);
4124 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST FLOAT *f, UINT count)
4126 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4127 ID3DXBaseEffect *base = This->base_effect;
4129 TRACE("Forward iface %p, base %p\n", This, base);
4131 return ID3DXBaseEffectImpl_SetFloatArray(base, parameter, f, count);
4134 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, FLOAT *f, UINT count)
4136 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4137 ID3DXBaseEffect *base = This->base_effect;
4139 TRACE("Forward iface %p, base %p\n", This, base);
4141 return ID3DXBaseEffectImpl_GetFloatArray(base, parameter, f, count);
4144 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector)
4146 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4147 ID3DXBaseEffect *base = This->base_effect;
4149 TRACE("Forward iface %p, base %p\n", This, base);
4151 return ID3DXBaseEffectImpl_SetVector(base, parameter, vector);
4154 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector)
4156 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4157 ID3DXBaseEffect *base = This->base_effect;
4159 TRACE("Forward iface %p, base %p\n", This, base);
4161 return ID3DXBaseEffectImpl_GetVector(base, parameter, vector);
4164 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXVECTOR4 *vector, UINT count)
4166 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4167 ID3DXBaseEffect *base = This->base_effect;
4169 TRACE("Forward iface %p, base %p\n", This, base);
4171 return ID3DXBaseEffectImpl_SetVectorArray(base, parameter, vector, count);
4174 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXVECTOR4 *vector, UINT count)
4176 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4177 ID3DXBaseEffect *base = This->base_effect;
4179 TRACE("Forward iface %p, base %p\n", This, base);
4181 return ID3DXBaseEffectImpl_GetVectorArray(base, parameter, vector, count);
4184 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
4186 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4187 ID3DXBaseEffect *base = This->base_effect;
4189 TRACE("Forward iface %p, base %p\n", This, base);
4191 return ID3DXBaseEffectImpl_SetMatrix(base, parameter, matrix);
4194 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
4196 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4197 ID3DXBaseEffect *base = This->base_effect;
4199 TRACE("Forward iface %p, base %p\n", This, base);
4201 return ID3DXBaseEffectImpl_GetMatrix(base, parameter, matrix);
4204 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
4206 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4207 ID3DXBaseEffect *base = This->base_effect;
4209 TRACE("Forward iface %p, base %p\n", This, base);
4211 return ID3DXBaseEffectImpl_SetMatrixArray(base, parameter, matrix, count);
4214 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
4216 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4217 ID3DXBaseEffect *base = This->base_effect;
4219 TRACE("Forward iface %p, base %p\n", This, base);
4221 return ID3DXBaseEffectImpl_GetMatrixArray(base, parameter, matrix, count);
4224 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
4226 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4227 ID3DXBaseEffect *base = This->base_effect;
4229 TRACE("Forward iface %p, base %p\n", This, base);
4231 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base, parameter, matrix, count);
4234 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
4236 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4237 ID3DXBaseEffect *base = This->base_effect;
4239 TRACE("Forward iface %p, base %p\n", This, base);
4241 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base, parameter, matrix, count);
4244 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix)
4246 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4247 ID3DXBaseEffect *base = This->base_effect;
4249 TRACE("Forward iface %p, base %p\n", This, base);
4251 return ID3DXBaseEffectImpl_SetMatrixTranspose(base, parameter, matrix);
4254 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix)
4256 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4257 ID3DXBaseEffect *base = This->base_effect;
4259 TRACE("Forward iface %p, base %p\n", This, base);
4261 return ID3DXBaseEffectImpl_GetMatrixTranspose(base, parameter, matrix);
4264 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX *matrix, UINT count)
4266 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4267 ID3DXBaseEffect *base = This->base_effect;
4269 TRACE("Forward iface %p, base %p\n", This, base);
4271 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base, parameter, matrix, count);
4274 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX *matrix, UINT count)
4276 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4277 ID3DXBaseEffect *base = This->base_effect;
4279 TRACE("Forward iface %p, base %p\n", This, base);
4281 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base, parameter, matrix, count);
4284 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, CONST D3DXMATRIX **matrix, UINT count)
4286 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4287 ID3DXBaseEffect *base = This->base_effect;
4289 TRACE("Forward iface %p, base %p\n", This, base);
4291 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base, parameter, matrix, count);
4294 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, D3DXMATRIX **matrix, UINT count)
4296 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4297 ID3DXBaseEffect *base = This->base_effect;
4299 TRACE("Forward iface %p, base %p\n", This, base);
4301 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base, parameter, matrix, count);
4304 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR string)
4306 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4307 ID3DXBaseEffect *base = This->base_effect;
4309 TRACE("Forward iface %p, base %p\n", This, base);
4311 return ID3DXBaseEffectImpl_SetString(base, parameter, string);
4314 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, LPCSTR *string)
4316 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4317 ID3DXBaseEffect *base = This->base_effect;
4319 TRACE("Forward iface %p, base %p\n", This, base);
4321 return ID3DXBaseEffectImpl_GetString(base, parameter, string);
4324 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetTexture(struct ID3DXEffectCompiler *iface,
4325 D3DXHANDLE parameter, struct IDirect3DBaseTexture9 *texture)
4327 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4328 ID3DXBaseEffect *base = This->base_effect;
4330 TRACE("Forward iface %p, base %p\n", This, base);
4332 return ID3DXBaseEffectImpl_SetTexture(base, parameter, texture);
4335 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetTexture(struct ID3DXEffectCompiler *iface,
4336 D3DXHANDLE parameter, struct IDirect3DBaseTexture9 **texture)
4338 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4339 ID3DXBaseEffect *base = This->base_effect;
4341 TRACE("Forward iface %p, base %p\n", This, base);
4343 return ID3DXBaseEffectImpl_GetTexture(base, parameter, texture);
4346 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler *iface,
4347 D3DXHANDLE parameter, struct IDirect3DPixelShader9 **shader)
4349 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4350 ID3DXBaseEffect *base = This->base_effect;
4352 TRACE("Forward iface %p, base %p\n", This, base);
4354 return ID3DXBaseEffectImpl_GetPixelShader(base, parameter, shader);
4357 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetVertexShader(struct ID3DXEffectCompiler *iface,
4358 D3DXHANDLE parameter, struct IDirect3DVertexShader9 **shader)
4360 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4361 ID3DXBaseEffect *base = This->base_effect;
4363 TRACE("Forward iface %p, base %p\n", This, base);
4365 return ID3DXBaseEffectImpl_GetVertexShader(base, parameter, shader);
4368 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, UINT start, UINT end)
4370 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4371 ID3DXBaseEffect *base = This->base_effect;
4373 TRACE("Forward iface %p, base %p\n", This, base);
4375 return ID3DXBaseEffectImpl_SetArrayRange(base, parameter, start, end);
4378 /*** ID3DXEffectCompiler methods ***/
4379 static HRESULT WINAPI ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL literal)
4381 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4383 FIXME("iface %p, parameter %p, literal %u\n", This, parameter, literal);
4388 static HRESULT WINAPI ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler *iface, D3DXHANDLE parameter, BOOL *literal)
4390 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4392 FIXME("iface %p, parameter %p, literal %p\n", This, parameter, literal);
4397 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler *iface, DWORD flags,
4398 ID3DXBuffer **effect, ID3DXBuffer **error_msgs)
4400 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4402 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This, flags, effect, error_msgs);
4407 static HRESULT WINAPI ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler *iface, D3DXHANDLE function,
4408 const char *target, DWORD flags, ID3DXBuffer **shader, ID3DXBuffer **error_msgs,
4409 ID3DXConstantTable **constant_table)
4411 struct ID3DXEffectCompilerImpl *This = impl_from_ID3DXEffectCompiler(iface);
4413 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
4414 This, function, target, flags, shader, error_msgs, constant_table);
4419 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl =
4421 /*** IUnknown methods ***/
4422 ID3DXEffectCompilerImpl_QueryInterface,
4423 ID3DXEffectCompilerImpl_AddRef,
4424 ID3DXEffectCompilerImpl_Release,
4425 /*** ID3DXBaseEffect methods ***/
4426 ID3DXEffectCompilerImpl_GetDesc,
4427 ID3DXEffectCompilerImpl_GetParameterDesc,
4428 ID3DXEffectCompilerImpl_GetTechniqueDesc,
4429 ID3DXEffectCompilerImpl_GetPassDesc,
4430 ID3DXEffectCompilerImpl_GetFunctionDesc,
4431 ID3DXEffectCompilerImpl_GetParameter,
4432 ID3DXEffectCompilerImpl_GetParameterByName,
4433 ID3DXEffectCompilerImpl_GetParameterBySemantic,
4434 ID3DXEffectCompilerImpl_GetParameterElement,
4435 ID3DXEffectCompilerImpl_GetTechnique,
4436 ID3DXEffectCompilerImpl_GetTechniqueByName,
4437 ID3DXEffectCompilerImpl_GetPass,
4438 ID3DXEffectCompilerImpl_GetPassByName,
4439 ID3DXEffectCompilerImpl_GetFunction,
4440 ID3DXEffectCompilerImpl_GetFunctionByName,
4441 ID3DXEffectCompilerImpl_GetAnnotation,
4442 ID3DXEffectCompilerImpl_GetAnnotationByName,
4443 ID3DXEffectCompilerImpl_SetValue,
4444 ID3DXEffectCompilerImpl_GetValue,
4445 ID3DXEffectCompilerImpl_SetBool,
4446 ID3DXEffectCompilerImpl_GetBool,
4447 ID3DXEffectCompilerImpl_SetBoolArray,
4448 ID3DXEffectCompilerImpl_GetBoolArray,
4449 ID3DXEffectCompilerImpl_SetInt,
4450 ID3DXEffectCompilerImpl_GetInt,
4451 ID3DXEffectCompilerImpl_SetIntArray,
4452 ID3DXEffectCompilerImpl_GetIntArray,
4453 ID3DXEffectCompilerImpl_SetFloat,
4454 ID3DXEffectCompilerImpl_GetFloat,
4455 ID3DXEffectCompilerImpl_SetFloatArray,
4456 ID3DXEffectCompilerImpl_GetFloatArray,
4457 ID3DXEffectCompilerImpl_SetVector,
4458 ID3DXEffectCompilerImpl_GetVector,
4459 ID3DXEffectCompilerImpl_SetVectorArray,
4460 ID3DXEffectCompilerImpl_GetVectorArray,
4461 ID3DXEffectCompilerImpl_SetMatrix,
4462 ID3DXEffectCompilerImpl_GetMatrix,
4463 ID3DXEffectCompilerImpl_SetMatrixArray,
4464 ID3DXEffectCompilerImpl_GetMatrixArray,
4465 ID3DXEffectCompilerImpl_SetMatrixPointerArray,
4466 ID3DXEffectCompilerImpl_GetMatrixPointerArray,
4467 ID3DXEffectCompilerImpl_SetMatrixTranspose,
4468 ID3DXEffectCompilerImpl_GetMatrixTranspose,
4469 ID3DXEffectCompilerImpl_SetMatrixTransposeArray,
4470 ID3DXEffectCompilerImpl_GetMatrixTransposeArray,
4471 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray,
4472 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray,
4473 ID3DXEffectCompilerImpl_SetString,
4474 ID3DXEffectCompilerImpl_GetString,
4475 ID3DXEffectCompilerImpl_SetTexture,
4476 ID3DXEffectCompilerImpl_GetTexture,
4477 ID3DXEffectCompilerImpl_GetPixelShader,
4478 ID3DXEffectCompilerImpl_GetVertexShader,
4479 ID3DXEffectCompilerImpl_SetArrayRange,
4480 /*** ID3DXEffectCompiler methods ***/
4481 ID3DXEffectCompilerImpl_SetLiteral,
4482 ID3DXEffectCompilerImpl_GetLiteral,
4483 ID3DXEffectCompilerImpl_CompileEffect,
4484 ID3DXEffectCompilerImpl_CompileShader,
4487 static HRESULT d3dx9_parse_sampler(struct d3dx_sampler *sampler, const char *data, const char **ptr, D3DXHANDLE *objects)
4491 struct d3dx_state *states;
4493 read_dword(ptr, &sampler->state_count);
4494 TRACE("Count: %u\n", sampler->state_count);
4496 states = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*states) * sampler->state_count);
4499 ERR("Out of memory\n");
4500 return E_OUTOFMEMORY;
4503 for (i = 0; i < sampler->state_count; ++i)
4505 hr = d3dx9_parse_state(&states[i], data, ptr, objects);
4508 WARN("Failed to parse state\n");
4513 sampler->states = states;
4519 for (i = 0; i < sampler->state_count; ++i)
4521 free_state(&states[i]);
4524 HeapFree(GetProcessHeap(), 0, states);
4529 static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char *data, const char **ptr, D3DXHANDLE *objects)
4536 if (param->element_count)
4538 param->data = value;
4540 for (i = 0; i < param->element_count; ++i)
4542 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
4544 hr = d3dx9_parse_value(member, value ? (char *)value + old_size : NULL, data, ptr, objects);
4547 WARN("Failed to parse value\n");
4551 old_size += member->bytes;
4557 switch(param->class)
4561 case D3DXPC_MATRIX_ROWS:
4562 case D3DXPC_MATRIX_COLUMNS:
4563 param->data = value;
4567 param->data = value;
4569 for (i = 0; i < param->member_count; ++i)
4571 struct d3dx_parameter *member = get_parameter_struct(param->member_handles[i]);
4573 hr = d3dx9_parse_value(member, (char *)value + old_size, data, ptr, objects);
4576 WARN("Failed to parse value\n");
4580 old_size += member->bytes;
4585 switch (param->type)
4588 case D3DXPT_TEXTURE:
4589 case D3DXPT_TEXTURE1D:
4590 case D3DXPT_TEXTURE2D:
4591 case D3DXPT_TEXTURE3D:
4592 case D3DXPT_TEXTURECUBE:
4593 case D3DXPT_PIXELSHADER:
4594 case D3DXPT_VERTEXSHADER:
4595 read_dword(ptr, &id);
4596 TRACE("Id: %u\n", id);
4597 objects[id] = get_parameter_handle(param);
4598 param->data = value;
4601 case D3DXPT_SAMPLER:
4602 case D3DXPT_SAMPLER1D:
4603 case D3DXPT_SAMPLER2D:
4604 case D3DXPT_SAMPLER3D:
4605 case D3DXPT_SAMPLERCUBE:
4607 struct d3dx_sampler *sampler;
4609 sampler = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sampler));
4612 ERR("Out of memory\n");
4613 return E_OUTOFMEMORY;
4616 hr = d3dx9_parse_sampler(sampler, data, ptr, objects);
4619 HeapFree(GetProcessHeap(), 0, sampler);
4620 WARN("Failed to parse sampler\n");
4624 param->data = sampler;
4629 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
4635 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
4642 static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *data, const char *ptr, D3DXHANDLE *objects)
4644 UINT size = param->bytes;
4648 TRACE("param size: %u\n", size);
4652 value = HeapAlloc(GetProcessHeap(), 0, size);
4655 ERR("Failed to allocate data memory.\n");
4656 return E_OUTOFMEMORY;
4659 TRACE("Data: %s.\n", debugstr_an(ptr, size));
4660 memcpy(value, ptr, size);
4663 hr = d3dx9_parse_value(param, value, data, &ptr, objects);
4666 WARN("Failed to parse value\n");
4667 HeapFree(GetProcessHeap(), 0, value);
4674 static HRESULT d3dx9_parse_name(char **name, const char *ptr)
4678 read_dword(&ptr, &size);
4679 TRACE("Name size: %#x\n", size);
4686 *name = HeapAlloc(GetProcessHeap(), 0, size);
4689 ERR("Failed to allocate name memory.\n");
4690 return E_OUTOFMEMORY;
4693 TRACE("Name: %s.\n", debugstr_an(ptr, size));
4694 memcpy(*name, ptr, size);
4699 static HRESULT d3dx9_copy_data(char **str, const char **ptr)
4703 read_dword(ptr, &size);
4704 TRACE("Data size: %#x\n", size);
4706 *str = HeapAlloc(GetProcessHeap(), 0, size);
4709 ERR("Failed to allocate name memory.\n");
4710 return E_OUTOFMEMORY;
4713 TRACE("Data: %s.\n", debugstr_an(*ptr, size));
4714 memcpy(*str, *ptr, size);
4716 *ptr += ((size + 3) & ~3);
4721 static HRESULT d3dx9_parse_data(struct d3dx_parameter *param, const char **ptr, struct IDirect3DDevice9 *device)
4726 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param->name), debug_d3dxparameter_type(param->type));
4728 read_dword(ptr, &size);
4729 TRACE("Data size: %#x\n", size);
4733 TRACE("Size is 0\n");
4734 *(void **)param->data = NULL;
4738 switch (param->type)
4741 /* re-read with size (sizeof(DWORD) = 4) */
4742 hr = d3dx9_parse_name((LPSTR *)param->data, *ptr - 4);
4745 WARN("Failed to parse string data\n");
4750 case D3DXPT_VERTEXSHADER:
4751 if (FAILED(hr = IDirect3DDevice9_CreateVertexShader(device, (DWORD *)*ptr, param->data)))
4753 WARN("Failed to create vertex shader\n");
4758 case D3DXPT_PIXELSHADER:
4759 if (FAILED(hr = IDirect3DDevice9_CreatePixelShader(device, (DWORD *)*ptr, param->data)))
4761 WARN("Failed to create pixel shader\n");
4767 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
4772 *ptr += ((size + 3) & ~3);
4777 static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr,
4778 struct d3dx_parameter *parent, UINT flags)
4782 D3DXHANDLE *member_handles = NULL;
4785 param->flags = flags;
4789 read_dword(ptr, ¶m->type);
4790 TRACE("Type: %s\n", debug_d3dxparameter_type(param->type));
4792 read_dword(ptr, ¶m->class);
4793 TRACE("Class: %s\n", debug_d3dxparameter_class(param->class));
4795 read_dword(ptr, &offset);
4796 TRACE("Type name offset: %#x\n", offset);
4797 hr = d3dx9_parse_name(¶m->name, data + offset);
4800 WARN("Failed to parse name\n");
4804 read_dword(ptr, &offset);
4805 TRACE("Type semantic offset: %#x\n", offset);
4806 hr = d3dx9_parse_name(¶m->semantic, data + offset);
4809 WARN("Failed to parse semantic\n");
4813 read_dword(ptr, ¶m->element_count);
4814 TRACE("Elements: %u\n", param->element_count);
4816 switch (param->class)
4819 read_dword(ptr, ¶m->columns);
4820 TRACE("Columns: %u\n", param->columns);
4822 read_dword(ptr, ¶m->rows);
4823 TRACE("Rows: %u\n", param->rows);
4825 /* sizeof(DWORD) * rows * columns */
4826 param->bytes = 4 * param->rows * param->columns;
4830 case D3DXPC_MATRIX_ROWS:
4831 case D3DXPC_MATRIX_COLUMNS:
4832 read_dword(ptr, ¶m->rows);
4833 TRACE("Rows: %u\n", param->rows);
4835 read_dword(ptr, ¶m->columns);
4836 TRACE("Columns: %u\n", param->columns);
4838 /* sizeof(DWORD) * rows * columns */
4839 param->bytes = 4 * param->rows * param->columns;
4843 read_dword(ptr, ¶m->member_count);
4844 TRACE("Members: %u\n", param->member_count);
4848 switch (param->type)
4851 case D3DXPT_PIXELSHADER:
4852 case D3DXPT_VERTEXSHADER:
4853 case D3DXPT_TEXTURE:
4854 case D3DXPT_TEXTURE1D:
4855 case D3DXPT_TEXTURE2D:
4856 case D3DXPT_TEXTURE3D:
4857 case D3DXPT_TEXTURECUBE:
4858 param->bytes = sizeof(void *);
4861 case D3DXPT_SAMPLER:
4862 case D3DXPT_SAMPLER1D:
4863 case D3DXPT_SAMPLER2D:
4864 case D3DXPT_SAMPLER3D:
4865 case D3DXPT_SAMPLERCUBE:
4870 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
4876 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param->class));
4883 param->type = parent->type;
4884 param->class = parent->class;
4885 param->name = parent->name;
4886 param->semantic = parent->semantic;
4887 param->element_count = 0;
4888 param->annotation_count = 0;
4889 param->member_count = parent->member_count;
4890 param->bytes = parent->bytes;
4891 param->rows = parent->rows;
4892 param->columns = parent->columns;
4895 if (param->element_count)
4897 unsigned int param_bytes = 0;
4898 const char *save_ptr = *ptr;
4900 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->element_count);
4901 if (!member_handles)
4903 ERR("Out of memory\n");
4908 for (i = 0; i < param->element_count; ++i)
4910 struct d3dx_parameter *member;
4913 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
4916 ERR("Out of memory\n");
4921 member_handles[i] = get_parameter_handle(member);
4923 hr = d3dx9_parse_effect_typedef(member, data, ptr, param, flags);
4926 WARN("Failed to parse member\n");
4930 param_bytes += member->bytes;
4933 param->bytes = param_bytes;
4935 else if (param->member_count)
4937 member_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member_handles) * param->member_count);
4938 if (!member_handles)
4940 ERR("Out of memory\n");
4945 for (i = 0; i < param->member_count; ++i)
4947 struct d3dx_parameter *member;
4949 member = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*member));
4952 ERR("Out of memory\n");
4957 member_handles[i] = get_parameter_handle(member);
4959 hr = d3dx9_parse_effect_typedef(member, data, ptr, NULL, flags);
4962 WARN("Failed to parse member\n");
4966 param->bytes += member->bytes;
4970 param->member_handles = member_handles;
4980 if (param->element_count) count = param->element_count;
4981 else count = param->member_count;
4983 for (i = 0; i < count; ++i)
4985 free_parameter(member_handles[i], param->element_count != 0, TRUE);
4987 HeapFree(GetProcessHeap(), 0, member_handles);
4992 HeapFree(GetProcessHeap(), 0, param->name);
4993 HeapFree(GetProcessHeap(), 0, param->semantic);
4996 param->semantic = NULL;
5001 static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, const char **ptr, D3DXHANDLE *objects)
5007 anno->flags = D3DX_PARAMETER_ANNOTATION;
5009 read_dword(ptr, &offset);
5010 TRACE("Typedef offset: %#x\n", offset);
5011 ptr2 = data + offset;
5012 hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION);
5015 WARN("Failed to parse type definition\n");
5019 read_dword(ptr, &offset);
5020 TRACE("Value offset: %#x\n", offset);
5021 hr = d3dx9_parse_init_value(anno, data, data + offset, objects);
5024 WARN("Failed to parse value\n");
5031 static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, D3DXHANDLE *objects)
5036 struct d3dx_parameter *parameter;
5038 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
5041 ERR("Out of memory\n");
5042 return E_OUTOFMEMORY;
5045 state->type = ST_CONSTANT;
5047 read_dword(ptr, &state->operation);
5048 TRACE("Operation: %#x (%s)\n", state->operation, state_table[state->operation].name);
5050 read_dword(ptr, &state->index);
5051 TRACE("Index: %#x\n", state->index);
5053 read_dword(ptr, &offset);
5054 TRACE("Typedef offset: %#x\n", offset);
5055 ptr2 = data + offset;
5056 hr = d3dx9_parse_effect_typedef(parameter, data, &ptr2, NULL, 0);
5059 WARN("Failed to parse type definition\n");
5063 read_dword(ptr, &offset);
5064 TRACE("Value offset: %#x\n", offset);
5065 hr = d3dx9_parse_init_value(parameter, data, data + offset, objects);
5068 WARN("Failed to parse value\n");
5072 state->parameter = get_parameter_handle(parameter);
5078 free_parameter(get_parameter_handle(parameter), FALSE, FALSE);
5083 static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, const char **ptr, D3DXHANDLE *objects)
5088 D3DXHANDLE *annotation_handles = NULL;
5091 read_dword(ptr, &offset);
5092 TRACE("Typedef offset: %#x\n", offset);
5093 ptr2 = data + offset;
5095 read_dword(ptr, &offset);
5096 TRACE("Value offset: %#x\n", offset);
5098 read_dword(ptr, ¶m->flags);
5099 TRACE("Flags: %#x\n", param->flags);
5101 read_dword(ptr, ¶m->annotation_count);
5102 TRACE("Annotation count: %u\n", param->annotation_count);
5104 hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags);
5107 WARN("Failed to parse type definition\n");
5111 hr = d3dx9_parse_init_value(param, data, data + offset, objects);
5114 WARN("Failed to parse value\n");
5118 if (param->annotation_count)
5120 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * param->annotation_count);
5121 if (!annotation_handles)
5123 ERR("Out of memory\n");
5128 for (i = 0; i < param->annotation_count; ++i)
5130 struct d3dx_parameter *annotation;
5132 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
5135 ERR("Out of memory\n");
5140 annotation_handles[i] = get_parameter_handle(annotation);
5142 hr = d3dx9_parse_effect_annotation(annotation, data, ptr, objects);
5145 WARN("Failed to parse annotation\n");
5151 param->annotation_handles = annotation_handles;
5157 if (annotation_handles)
5159 for (i = 0; i < param->annotation_count; ++i)
5161 free_parameter(annotation_handles[i], FALSE, FALSE);
5163 HeapFree(GetProcessHeap(), 0, annotation_handles);
5169 static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr, D3DXHANDLE *objects)
5174 D3DXHANDLE *annotation_handles = NULL;
5175 struct d3dx_state *states = NULL;
5178 read_dword(ptr, &offset);
5179 TRACE("Pass name offset: %#x\n", offset);
5180 hr = d3dx9_parse_name(&name, data + offset);
5183 WARN("Failed to parse name\n");
5187 read_dword(ptr, &pass->annotation_count);
5188 TRACE("Annotation count: %u\n", pass->annotation_count);
5190 read_dword(ptr, &pass->state_count);
5191 TRACE("State count: %u\n", pass->state_count);
5193 if (pass->annotation_count)
5195 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * pass->annotation_count);
5196 if (!annotation_handles)
5198 ERR("Out of memory\n");
5203 for (i = 0; i < pass->annotation_count; ++i)
5205 struct d3dx_parameter *annotation;
5207 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
5210 ERR("Out of memory\n");
5215 annotation_handles[i] = get_parameter_handle(annotation);
5217 hr = d3dx9_parse_effect_annotation(annotation, data, ptr, objects);
5220 WARN("Failed to parse annotations\n");
5226 if (pass->state_count)
5228 states = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*states) * pass->state_count);
5231 ERR("Out of memory\n");
5236 for (i = 0; i < pass->state_count; ++i)
5238 hr = d3dx9_parse_state(&states[i], data, ptr, objects);
5241 WARN("Failed to parse annotations\n");
5248 pass->annotation_handles = annotation_handles;
5249 pass->states = states;
5255 if (annotation_handles)
5257 for (i = 0; i < pass->annotation_count; ++i)
5259 free_parameter(annotation_handles[i], FALSE, FALSE);
5261 HeapFree(GetProcessHeap(), 0, annotation_handles);
5266 for (i = 0; i < pass->state_count; ++i)
5268 free_state(&states[i]);
5270 HeapFree(GetProcessHeap(), 0, states);
5273 HeapFree(GetProcessHeap(), 0, name);
5278 static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, const char **ptr, D3DXHANDLE *objects)
5283 D3DXHANDLE *annotation_handles = NULL;
5284 D3DXHANDLE *pass_handles = NULL;
5287 read_dword(ptr, &offset);
5288 TRACE("Technique name offset: %#x\n", offset);
5289 hr = d3dx9_parse_name(&name, data + offset);
5292 WARN("Failed to parse name\n");
5296 read_dword(ptr, &technique->annotation_count);
5297 TRACE("Annotation count: %u\n", technique->annotation_count);
5299 read_dword(ptr, &technique->pass_count);
5300 TRACE("Pass count: %u\n", technique->pass_count);
5302 if (technique->annotation_count)
5304 annotation_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation_handles) * technique->annotation_count);
5305 if (!annotation_handles)
5307 ERR("Out of memory\n");
5312 for (i = 0; i < technique->annotation_count; ++i)
5314 struct d3dx_parameter *annotation;
5316 annotation = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*annotation));
5319 ERR("Out of memory\n");
5324 annotation_handles[i] = get_parameter_handle(annotation);
5326 hr = d3dx9_parse_effect_annotation(annotation, data, ptr, objects);
5329 WARN("Failed to parse annotations\n");
5335 if (technique->pass_count)
5337 pass_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass_handles) * technique->pass_count);
5340 ERR("Out of memory\n");
5345 for (i = 0; i < technique->pass_count; ++i)
5347 struct d3dx_pass *pass;
5349 pass = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pass));
5352 ERR("Out of memory\n");
5357 pass_handles[i] = get_pass_handle(pass);
5359 hr = d3dx9_parse_effect_pass(pass, data, ptr, objects);
5362 WARN("Failed to parse passes\n");
5368 technique->name = name;
5369 technique->pass_handles = pass_handles;
5370 technique->annotation_handles = annotation_handles;
5378 for (i = 0; i < technique->pass_count; ++i)
5380 free_pass(pass_handles[i]);
5382 HeapFree(GetProcessHeap(), 0, pass_handles);
5385 if (annotation_handles)
5387 for (i = 0; i < technique->annotation_count; ++i)
5389 free_parameter(annotation_handles[i], FALSE, FALSE);
5391 HeapFree(GetProcessHeap(), 0, annotation_handles);
5394 HeapFree(GetProcessHeap(), 0, name);
5399 static HRESULT d3dx9_parse_resource(struct ID3DXBaseEffectImpl *base, const char *data, const char **ptr)
5401 DWORD technique_index;
5402 DWORD index, state_index, usage, element_index;
5403 struct d3dx_state *state;
5404 struct d3dx_parameter *param;
5405 HRESULT hr = E_FAIL;
5407 read_dword(ptr, &technique_index);
5408 TRACE("techn: %u\n", technique_index);
5410 read_dword(ptr, &index);
5411 TRACE("index: %u\n", index);
5413 read_dword(ptr, &element_index);
5414 TRACE("element_index: %u\n", element_index);
5416 read_dword(ptr, &state_index);
5417 TRACE("state_index: %u\n", state_index);
5419 read_dword(ptr, &usage);
5420 TRACE("usage: %u\n", usage);
5422 if (technique_index == 0xffffffff)
5424 struct d3dx_parameter *parameter;
5425 struct d3dx_sampler *sampler;
5427 if (index >= base->parameter_count)
5429 FIXME("Index out of bounds: index %u >= parameter_count %u\n", index, base->parameter_count);
5433 parameter = get_parameter_struct(base->parameter_handles[index]);
5434 if (element_index != 0xffffffff)
5436 if (element_index >= parameter->element_count && parameter->element_count != 0)
5438 FIXME("Index out of bounds: element_index %u >= element_count %u\n", element_index, parameter->element_count);
5442 if (parameter->element_count != 0) parameter = get_parameter_struct(parameter->member_handles[element_index]);
5445 sampler = parameter->data;
5446 if (state_index >= sampler->state_count)
5448 FIXME("Index out of bounds: state_index %u >= state_count %u\n", state_index, sampler->state_count);
5452 state = &sampler->states[state_index];
5456 struct d3dx_technique *technique;
5457 struct d3dx_pass *pass;
5459 if (technique_index >= base->technique_count)
5461 FIXME("Index out of bounds: technique_index %u >= technique_count %u\n", technique_index, base->technique_count);
5465 technique = get_technique_struct(base->technique_handles[technique_index]);
5466 if (index >= technique->pass_count)
5468 FIXME("Index out of bounds: index %u >= pass_count %u\n", index, technique->pass_count);
5472 pass = get_pass_struct(technique->pass_handles[index]);
5473 if (state_index >= pass->state_count)
5475 FIXME("Index out of bounds: state_index %u >= state_count %u\n", state_index, pass->state_count);
5479 state = &pass->states[state_index];
5482 param = get_parameter_struct(state->parameter);
5487 TRACE("usage 0: type %s\n", debug_d3dxparameter_type(param->type));
5488 switch (param->type)
5490 case D3DXPT_VERTEXSHADER:
5491 case D3DXPT_PIXELSHADER:
5492 state->type = ST_CONSTANT;
5493 hr = d3dx9_parse_data(param, ptr, base->effect->device);
5500 state->type = ST_FXLC;
5501 hr = d3dx9_copy_data(param->data, ptr);
5505 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param->type));
5511 state->type = ST_PARAMETER;
5512 hr = d3dx9_copy_data(param->data, ptr);
5515 TRACE("Mapping to parameter %s\n", *(char **)param->data);
5520 FIXME("Unknown usage %x\n", usage);
5527 static HRESULT d3dx9_parse_effect(struct ID3DXBaseEffectImpl *base, const char *data, UINT data_size, DWORD start)
5529 const char *ptr = data + start;
5530 D3DXHANDLE *parameter_handles = NULL;
5531 D3DXHANDLE *technique_handles = NULL;
5532 D3DXHANDLE *objects = NULL;
5533 UINT stringcount, objectcount, resourcecount;
5537 read_dword(&ptr, &base->parameter_count);
5538 TRACE("Parameter count: %u\n", base->parameter_count);
5540 read_dword(&ptr, &base->technique_count);
5541 TRACE("Technique count: %u\n", base->technique_count);
5543 skip_dword_unknown(&ptr, 1);
5545 read_dword(&ptr, &objectcount);
5546 TRACE("Object count: %u\n", objectcount);
5548 objects = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*objects) * objectcount);
5551 ERR("Out of memory\n");
5556 if (base->parameter_count)
5558 parameter_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter_handles) * base->parameter_count);
5559 if (!parameter_handles)
5561 ERR("Out of memory\n");
5566 for (i = 0; i < base->parameter_count; ++i)
5568 struct d3dx_parameter *parameter;
5570 parameter = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*parameter));
5573 ERR("Out of memory\n");
5578 parameter_handles[i] = get_parameter_handle(parameter);
5580 hr = d3dx9_parse_effect_parameter(parameter, data, &ptr, objects);
5583 WARN("Failed to parse parameter\n");
5589 if (base->technique_count)
5591 technique_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique_handles) * base->technique_count);
5592 if (!technique_handles)
5594 ERR("Out of memory\n");
5599 for (i = 0; i < base->technique_count; ++i)
5601 struct d3dx_technique *technique;
5603 technique = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*technique));
5606 ERR("Out of memory\n");
5611 technique_handles[i] = get_technique_handle(technique);
5613 hr = d3dx9_parse_effect_technique(technique, data, &ptr, objects);
5616 WARN("Failed to parse technique\n");
5622 /* needed for further parsing */
5623 base->technique_handles = technique_handles;
5624 base->parameter_handles = parameter_handles;
5626 read_dword(&ptr, &stringcount);
5627 TRACE("String count: %u\n", stringcount);
5629 read_dword(&ptr, &resourcecount);
5630 TRACE("Resource count: %u\n", resourcecount);
5632 for (i = 0; i < stringcount; ++i)
5635 struct d3dx_parameter *param;
5637 read_dword(&ptr, &id);
5638 TRACE("Id: %u\n", id);
5640 param = get_parameter_struct(objects[id]);
5642 hr = d3dx9_parse_data(param, &ptr, base->effect->device);
5645 WARN("Failed to parse data\n");
5650 for (i = 0; i < resourcecount; ++i)
5652 TRACE("parse resource %u\n", i);
5654 hr = d3dx9_parse_resource(base, data, &ptr);
5657 WARN("Failed to parse data\n");
5662 HeapFree(GetProcessHeap(), 0, objects);
5668 if (technique_handles)
5670 for (i = 0; i < base->technique_count; ++i)
5672 free_technique(technique_handles[i]);
5674 HeapFree(GetProcessHeap(), 0, technique_handles);
5677 if (parameter_handles)
5679 for (i = 0; i < base->parameter_count; ++i)
5681 free_parameter(parameter_handles[i], FALSE, FALSE);
5683 HeapFree(GetProcessHeap(), 0, parameter_handles);
5686 base->technique_handles = NULL;
5687 base->parameter_handles = NULL;
5689 HeapFree(GetProcessHeap(), 0, objects);
5694 static HRESULT d3dx9_base_effect_init(struct ID3DXBaseEffectImpl *base,
5695 const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect)
5698 const char *ptr = data;
5701 TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect);
5703 base->ID3DXBaseEffect_iface.lpVtbl = &ID3DXBaseEffect_Vtbl;
5705 base->effect = effect;
5707 read_dword(&ptr, &tag);
5708 TRACE("Tag: %x\n", tag);
5710 if (tag != d3dx9_effect_version(9, 1))
5712 /* todo: compile hlsl ascii code */
5713 FIXME("HLSL ascii effects not supported, yet\n");
5715 /* Show the start of the shader for debugging info. */
5716 TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size));
5720 read_dword(&ptr, &offset);
5721 TRACE("Offset: %x\n", offset);
5723 hr = d3dx9_parse_effect(base, ptr, data_size, offset);
5726 FIXME("Failed to parse effect.\n");
5734 static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, struct IDirect3DDevice9 *device,
5735 const char *data, SIZE_T data_size, struct ID3DXEffectPool *pool)
5738 struct ID3DXBaseEffectImpl *object = NULL;
5740 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect, device, data, data_size, pool);
5742 effect->ID3DXEffect_iface.lpVtbl = &ID3DXEffect_Vtbl;
5745 if (pool) pool->lpVtbl->AddRef(pool);
5746 effect->pool = pool;
5748 IDirect3DDevice9_AddRef(device);
5749 effect->device = device;
5751 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5754 ERR("Out of memory\n");
5759 hr = d3dx9_base_effect_init(object, data, data_size, effect);
5762 FIXME("Failed to parse effect.\n");
5766 effect->base_effect = &object->ID3DXBaseEffect_iface;
5768 /* initialize defaults - check because of unsupported ascii effects */
5769 if (object->technique_handles)
5771 effect->active_technique = object->technique_handles[0];
5772 effect->active_pass = NULL;
5779 HeapFree(GetProcessHeap(), 0, object);
5780 free_effect(effect);
5785 HRESULT WINAPI D3DXCreateEffectEx(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatalen,
5786 const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skip_constants, DWORD flags,
5787 struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilation_errors)
5789 struct ID3DXEffectImpl *object;
5792 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include,
5793 skip_constants, flags, pool, effect, compilation_errors);
5795 if (!device || !srcdata)
5796 return D3DERR_INVALIDCALL;
5801 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
5805 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5808 ERR("Out of memory\n");
5809 return E_OUTOFMEMORY;
5812 hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool);
5815 WARN("Failed to initialize shader reflection\n");
5816 HeapFree(GetProcessHeap(), 0, object);
5820 *effect = &object->ID3DXEffect_iface;
5822 TRACE("Created ID3DXEffect %p\n", object);
5827 HRESULT WINAPI D3DXCreateEffect(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatalen,
5828 const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags,
5829 struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilation_errors)
5831 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device, srcdata, srcdatalen, defines,
5832 include, flags, pool, effect, compilation_errors);
5834 return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors);
5837 static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size)
5840 struct ID3DXBaseEffectImpl *object = NULL;
5842 TRACE("effect %p, data %p, data_size %lu\n", compiler, data, data_size);
5844 compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl;
5847 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5850 ERR("Out of memory\n");
5855 hr = d3dx9_base_effect_init(object, data, data_size, NULL);
5858 FIXME("Failed to parse effect.\n");
5862 compiler->base_effect = &object->ID3DXBaseEffect_iface;
5868 HeapFree(GetProcessHeap(), 0, object);
5869 free_effect_compiler(compiler);
5874 HRESULT WINAPI D3DXCreateEffectCompiler(const char *srcdata, UINT srcdatalen, const D3DXMACRO *defines,
5875 ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **compiler, ID3DXBuffer **parse_errors)
5877 struct ID3DXEffectCompilerImpl *object;
5880 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
5881 srcdata, srcdatalen, defines, include, flags, compiler, parse_errors);
5883 if (!srcdata || !compiler)
5885 WARN("Invalid arguments supplied\n");
5886 return D3DERR_INVALIDCALL;
5889 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5892 ERR("Out of memory\n");
5893 return E_OUTOFMEMORY;
5896 hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen);
5899 WARN("Failed to initialize effect compiler\n");
5900 HeapFree(GetProcessHeap(), 0, object);
5904 *compiler = &object->ID3DXEffectCompiler_iface;
5906 TRACE("Created ID3DXEffectCompiler %p\n", object);
5911 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl;
5913 struct ID3DXEffectPoolImpl
5915 ID3DXEffectPool ID3DXEffectPool_iface;
5919 static inline struct ID3DXEffectPoolImpl *impl_from_ID3DXEffectPool(ID3DXEffectPool *iface)
5921 return CONTAINING_RECORD(iface, struct ID3DXEffectPoolImpl, ID3DXEffectPool_iface);
5924 /*** IUnknown methods ***/
5925 static HRESULT WINAPI ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool *iface, REFIID riid, void **object)
5927 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), object);
5929 if (IsEqualGUID(riid, &IID_IUnknown) ||
5930 IsEqualGUID(riid, &IID_ID3DXEffectPool))
5932 iface->lpVtbl->AddRef(iface);
5937 WARN("Interface %s not found\n", debugstr_guid(riid));
5939 return E_NOINTERFACE;
5942 static ULONG WINAPI ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool *iface)
5944 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
5946 TRACE("(%p)->(): AddRef from %u\n", This, This->ref);
5948 return InterlockedIncrement(&This->ref);
5951 static ULONG WINAPI ID3DXEffectPoolImpl_Release(ID3DXEffectPool *iface)
5953 struct ID3DXEffectPoolImpl *This = impl_from_ID3DXEffectPool(iface);
5954 ULONG ref = InterlockedDecrement(&This->ref);
5956 TRACE("(%p)->(): Release from %u\n", This, ref + 1);
5959 HeapFree(GetProcessHeap(), 0, This);
5964 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl =
5966 /*** IUnknown methods ***/
5967 ID3DXEffectPoolImpl_QueryInterface,
5968 ID3DXEffectPoolImpl_AddRef,
5969 ID3DXEffectPoolImpl_Release
5972 HRESULT WINAPI D3DXCreateEffectPool(ID3DXEffectPool **pool)
5974 struct ID3DXEffectPoolImpl *object;
5976 TRACE("(%p)\n", pool);
5979 return D3DERR_INVALIDCALL;
5981 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
5984 ERR("Out of memory\n");
5985 return E_OUTOFMEMORY;
5988 object->ID3DXEffectPool_iface.lpVtbl = &ID3DXEffectPool_Vtbl;
5991 *pool = &object->ID3DXEffectPool_iface;
5996 HRESULT WINAPI D3DXCreateEffectFromFileExW(struct IDirect3DDevice9 *device, const WCHAR *srcfile,
5997 const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags,
5998 struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6004 TRACE("(%s): relay\n", debugstr_w(srcfile));
6006 if (!device || !srcfile)
6007 return D3DERR_INVALIDCALL;
6009 ret = map_view_of_file(srcfile, &buffer, &size);
6012 return D3DXERR_INVALIDDATA;
6014 ret = D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
6015 UnmapViewOfFile(buffer);
6020 HRESULT WINAPI D3DXCreateEffectFromFileExA(struct IDirect3DDevice9 *device, const char *srcfile,
6021 const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants, DWORD flags,
6022 struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6028 TRACE("(void): relay\n");
6031 return D3DERR_INVALIDCALL;
6033 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
6034 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
6035 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
6037 ret = D3DXCreateEffectFromFileExW(device, srcfileW, defines, include, skipconstants, flags, pool, effect, compilationerrors);
6038 HeapFree(GetProcessHeap(), 0, srcfileW);
6043 HRESULT WINAPI D3DXCreateEffectFromFileW(struct IDirect3DDevice9 *device, const WCHAR *srcfile,
6044 const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool,
6045 struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6047 TRACE("(void): relay\n");
6048 return D3DXCreateEffectFromFileExW(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
6051 HRESULT WINAPI D3DXCreateEffectFromFileA(struct IDirect3DDevice9 *device, const char *srcfile,
6052 const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags, struct ID3DXEffectPool *pool,
6053 struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6055 TRACE("(void): relay\n");
6056 return D3DXCreateEffectFromFileExA(device, srcfile, defines, include, NULL, flags, pool, effect, compilationerrors);
6059 HRESULT WINAPI D3DXCreateEffectFromResourceExW(struct IDirect3DDevice9 *device, HMODULE srcmodule,
6060 const WCHAR *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants,
6061 DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6065 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
6068 return D3DERR_INVALIDCALL;
6070 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
6078 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
6081 return D3DXERR_INVALIDDATA;
6083 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
6086 return D3DXERR_INVALIDDATA;
6089 HRESULT WINAPI D3DXCreateEffectFromResourceExA(struct IDirect3DDevice9 *device, HMODULE srcmodule,
6090 const char *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, const char *skipconstants,
6091 DWORD flags, struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6095 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
6098 return D3DERR_INVALIDCALL;
6100 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
6108 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
6111 return D3DXERR_INVALIDDATA;
6113 return D3DXCreateEffectEx(device, buffer, size, defines, include, skipconstants, flags, pool, effect, compilationerrors);
6116 return D3DXERR_INVALIDDATA;
6119 HRESULT WINAPI D3DXCreateEffectFromResourceW(struct IDirect3DDevice9 *device, HMODULE srcmodule,
6120 const WCHAR *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags,
6121 struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6123 TRACE("(void): relay\n");
6124 return D3DXCreateEffectFromResourceExW(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
6127 HRESULT WINAPI D3DXCreateEffectFromResourceA(struct IDirect3DDevice9 *device, HMODULE srcmodule,
6128 const char *srcresource, const D3DXMACRO *defines, struct ID3DXInclude *include, DWORD flags,
6129 struct ID3DXEffectPool *pool, struct ID3DXEffect **effect, struct ID3DXBuffer **compilationerrors)
6131 TRACE("(void): relay\n");
6132 return D3DXCreateEffectFromResourceExA(device, srcmodule, srcresource, defines, include, NULL, flags, pool, effect, compilationerrors);
6135 HRESULT WINAPI D3DXCreateEffectCompilerFromFileW(const WCHAR *srcfile, const D3DXMACRO *defines,
6136 ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
6142 TRACE("(%s): relay\n", debugstr_w(srcfile));
6145 return D3DERR_INVALIDCALL;
6147 ret = map_view_of_file(srcfile, &buffer, &size);
6150 return D3DXERR_INVALIDDATA;
6152 ret = D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
6153 UnmapViewOfFile(buffer);
6158 HRESULT WINAPI D3DXCreateEffectCompilerFromFileA(const char *srcfile, const D3DXMACRO *defines,
6159 ID3DXInclude *include, DWORD flags, ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
6165 TRACE("(void): relay\n");
6168 return D3DERR_INVALIDCALL;
6170 len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
6171 srcfileW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*srcfileW));
6172 MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, len);
6174 ret = D3DXCreateEffectCompilerFromFileW(srcfileW, defines, include, flags, effectcompiler, parseerrors);
6175 HeapFree(GetProcessHeap(), 0, srcfileW);
6180 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule, const char *srcresource,
6181 const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags,
6182 ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
6186 TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(srcresource));
6188 resinfo = FindResourceA(srcmodule, srcresource, (LPCSTR) RT_RCDATA);
6196 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
6199 return D3DXERR_INVALIDDATA;
6201 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
6204 return D3DXERR_INVALIDDATA;
6207 HRESULT WINAPI D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule, const WCHAR *srcresource,
6208 const D3DXMACRO *defines, ID3DXInclude *include, DWORD flags,
6209 ID3DXEffectCompiler **effectcompiler, ID3DXBuffer **parseerrors)
6213 TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(srcresource));
6215 resinfo = FindResourceW(srcmodule, srcresource, (LPCWSTR) RT_RCDATA);
6223 ret = load_resource_into_memory(srcmodule, resinfo, &buffer, &size);
6226 return D3DXERR_INVALIDDATA;
6228 return D3DXCreateEffectCompiler(buffer, size, defines, include, flags, effectcompiler, parseerrors);
6231 return D3DXERR_INVALIDDATA;