2 * Copyright 2010 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "wine/port.h"
21 #define NONAMELESSUNION
22 #include "wine/debug.h"
23 #include "wine/unicode.h"
27 #include "d3dx9_36_private.h"
29 /* Constants for special INT/FLOAT conversation */
30 #define INT_FLOAT_MULTI 255.0f
32 WINE_DEFAULT_DEBUG_CHANNEL(d3dx
);
34 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl
;
35 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl
;
36 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl
;
83 enum SHADER_CONSTANT_TYPE
100 struct d3dx_parameter
105 D3DXPARAMETER_CLASS
class;
106 D3DXPARAMETER_TYPE type
;
110 UINT annotation_count
;
115 D3DXHANDLE
*annotation_handles
;
116 D3DXHANDLE
*member_handles
;
123 enum STATE_TYPE type
;
124 D3DXHANDLE parameter
;
130 struct d3dx_state
*states
;
137 UINT annotation_count
;
139 struct d3dx_state
*states
;
140 D3DXHANDLE
*annotation_handles
;
143 struct d3dx_technique
147 UINT annotation_count
;
149 D3DXHANDLE
*annotation_handles
;
150 D3DXHANDLE
*pass_handles
;
153 struct ID3DXBaseEffectImpl
155 ID3DXBaseEffect ID3DXBaseEffect_iface
;
158 struct ID3DXEffectImpl
*effect
;
160 UINT parameter_count
;
161 UINT technique_count
;
163 D3DXHANDLE
*parameter_handles
;
164 D3DXHANDLE
*technique_handles
;
167 struct ID3DXEffectImpl
169 ID3DXEffect ID3DXEffect_iface
;
172 LPD3DXEFFECTSTATEMANAGER manager
;
173 LPDIRECT3DDEVICE9 device
;
174 LPD3DXEFFECTPOOL pool
;
175 D3DXHANDLE active_technique
;
176 D3DXHANDLE active_pass
;
178 ID3DXBaseEffect
*base_effect
;
181 struct ID3DXEffectCompilerImpl
183 ID3DXEffectCompiler ID3DXEffectCompiler_iface
;
186 ID3DXBaseEffect
*base_effect
;
189 static struct d3dx_parameter
*get_parameter_by_name(struct ID3DXBaseEffectImpl
*base
,
190 struct d3dx_parameter
*parameter
, LPCSTR name
);
191 static struct d3dx_parameter
*get_parameter_annotation_by_name(struct d3dx_parameter
*parameter
, LPCSTR name
);
192 static HRESULT
d3dx9_parse_state(struct d3dx_state
*state
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
);
193 static void free_parameter_state(D3DXHANDLE handle
, BOOL element
, BOOL child
, enum STATE_TYPE st
);
197 enum STATE_CLASS
class;
204 {SC_RENDERSTATE
, D3DRS_ZENABLE
, "D3DRS_ZENABLE"}, /* 0x0 */
205 {SC_RENDERSTATE
, D3DRS_FILLMODE
, "D3DRS_FILLMODE"},
206 {SC_RENDERSTATE
, D3DRS_SHADEMODE
, "D3DRS_SHADEMODE"},
207 {SC_RENDERSTATE
, D3DRS_ZWRITEENABLE
, "D3DRS_ZWRITEENABLE"},
208 {SC_RENDERSTATE
, D3DRS_ALPHATESTENABLE
, "D3DRS_ALPHATESTENABLE"},
209 {SC_RENDERSTATE
, D3DRS_LASTPIXEL
, "D3DRS_LASTPIXEL"},
210 {SC_RENDERSTATE
, D3DRS_SRCBLEND
, "D3DRS_SRCBLEND"},
211 {SC_RENDERSTATE
, D3DRS_DESTBLEND
, "D3DRS_DESTBLEND"},
212 {SC_RENDERSTATE
, D3DRS_CULLMODE
, "D3DRS_CULLMODE"},
213 {SC_RENDERSTATE
, D3DRS_ZFUNC
, "D3DRS_ZFUNC"},
214 {SC_RENDERSTATE
, D3DRS_ALPHAREF
, "D3DRS_ALPHAREF"},
215 {SC_RENDERSTATE
, D3DRS_ALPHAFUNC
, "D3DRS_ALPHAFUNC"},
216 {SC_RENDERSTATE
, D3DRS_DITHERENABLE
, "D3DRS_DITHERENABLE"},
217 {SC_RENDERSTATE
, D3DRS_ALPHABLENDENABLE
, "D3DRS_ALPHABLENDENABLE"},
218 {SC_RENDERSTATE
, D3DRS_FOGENABLE
, "D3DRS_FOGENABLE"},
219 {SC_RENDERSTATE
, D3DRS_SPECULARENABLE
, "D3DRS_SPECULARENABLE"},
220 {SC_RENDERSTATE
, D3DRS_FOGCOLOR
, "D3DRS_FOGCOLOR"}, /* 0x10 */
221 {SC_RENDERSTATE
, D3DRS_FOGTABLEMODE
, "D3DRS_FOGTABLEMODE"},
222 {SC_RENDERSTATE
, D3DRS_FOGSTART
, "D3DRS_FOGSTART"},
223 {SC_RENDERSTATE
, D3DRS_FOGEND
, "D3DRS_FOGEND"},
224 {SC_RENDERSTATE
, D3DRS_FOGDENSITY
, "D3DRS_FOGDENSITY"},
225 {SC_RENDERSTATE
, D3DRS_RANGEFOGENABLE
, "D3DRS_RANGEFOGENABLE"},
226 {SC_RENDERSTATE
, D3DRS_STENCILENABLE
, "D3DRS_STENCILENABLE"},
227 {SC_RENDERSTATE
, D3DRS_STENCILFAIL
, "D3DRS_STENCILFAIL"},
228 {SC_RENDERSTATE
, D3DRS_STENCILZFAIL
, "D3DRS_STENCILZFAIL"},
229 {SC_RENDERSTATE
, D3DRS_STENCILPASS
, "D3DRS_STENCILPASS"},
230 {SC_RENDERSTATE
, D3DRS_STENCILFUNC
, "D3DRS_STENCILFUNC"},
231 {SC_RENDERSTATE
, D3DRS_STENCILREF
, "D3DRS_STENCILREF"},
232 {SC_RENDERSTATE
, D3DRS_STENCILMASK
, "D3DRS_STENCILMASK"},
233 {SC_RENDERSTATE
, D3DRS_STENCILWRITEMASK
, "D3DRS_STENCILWRITEMASK"},
234 {SC_RENDERSTATE
, D3DRS_TEXTUREFACTOR
, "D3DRS_TEXTUREFACTOR"},
235 {SC_RENDERSTATE
, D3DRS_WRAP0
, "D3DRS_WRAP0"},
236 {SC_RENDERSTATE
, D3DRS_WRAP1
, "D3DRS_WRAP1"}, /* 0x20 */
237 {SC_RENDERSTATE
, D3DRS_WRAP2
, "D3DRS_WRAP2"},
238 {SC_RENDERSTATE
, D3DRS_WRAP3
, "D3DRS_WRAP3"},
239 {SC_RENDERSTATE
, D3DRS_WRAP4
, "D3DRS_WRAP4"},
240 {SC_RENDERSTATE
, D3DRS_WRAP5
, "D3DRS_WRAP5"},
241 {SC_RENDERSTATE
, D3DRS_WRAP6
, "D3DRS_WRAP6"},
242 {SC_RENDERSTATE
, D3DRS_WRAP7
, "D3DRS_WRAP7"},
243 {SC_RENDERSTATE
, D3DRS_WRAP8
, "D3DRS_WRAP8"},
244 {SC_RENDERSTATE
, D3DRS_WRAP9
, "D3DRS_WRAP9"},
245 {SC_RENDERSTATE
, D3DRS_WRAP10
, "D3DRS_WRAP10"},
246 {SC_RENDERSTATE
, D3DRS_WRAP11
, "D3DRS_WRAP11"},
247 {SC_RENDERSTATE
, D3DRS_WRAP12
, "D3DRS_WRAP12"},
248 {SC_RENDERSTATE
, D3DRS_WRAP13
, "D3DRS_WRAP13"},
249 {SC_RENDERSTATE
, D3DRS_WRAP14
, "D3DRS_WRAP14"},
250 {SC_RENDERSTATE
, D3DRS_WRAP15
, "D3DRS_WRAP15"},
251 {SC_RENDERSTATE
, D3DRS_CLIPPING
, "D3DRS_CLIPPING"},
252 {SC_RENDERSTATE
, D3DRS_LIGHTING
, "D3DRS_LIGHTING"}, /* 0x30 */
253 {SC_RENDERSTATE
, D3DRS_AMBIENT
, "D3DRS_AMBIENT"},
254 {SC_RENDERSTATE
, D3DRS_FOGVERTEXMODE
, "D3DRS_FOGVERTEXMODE"},
255 {SC_RENDERSTATE
, D3DRS_COLORVERTEX
, "D3DRS_COLORVERTEX"},
256 {SC_RENDERSTATE
, D3DRS_LOCALVIEWER
, "D3DRS_LOCALVIEWER"},
257 {SC_RENDERSTATE
, D3DRS_NORMALIZENORMALS
, "D3DRS_NORMALIZENORMALS"},
258 {SC_RENDERSTATE
, D3DRS_DIFFUSEMATERIALSOURCE
, "D3DRS_DIFFUSEMATERIALSOURCE"},
259 {SC_RENDERSTATE
, D3DRS_SPECULARMATERIALSOURCE
, "D3DRS_SPECULARMATERIALSOURCE"},
260 {SC_RENDERSTATE
, D3DRS_AMBIENTMATERIALSOURCE
, "D3DRS_AMBIENTMATERIALSOURCE"},
261 {SC_RENDERSTATE
, D3DRS_EMISSIVEMATERIALSOURCE
, "D3DRS_EMISSIVEMATERIALSOURCE"},
262 {SC_RENDERSTATE
, D3DRS_VERTEXBLEND
, "D3DRS_VERTEXBLEND"},
263 {SC_RENDERSTATE
, D3DRS_CLIPPLANEENABLE
, "D3DRS_CLIPPLANEENABLE"},
264 {SC_RENDERSTATE
, D3DRS_POINTSIZE
, "D3DRS_POINTSIZE"},
265 {SC_RENDERSTATE
, D3DRS_POINTSIZE_MIN
, "D3DRS_POINTSIZE_MIN"},
266 {SC_RENDERSTATE
, D3DRS_POINTSIZE_MAX
, "D3DRS_POINTSIZE_MAX"},
267 {SC_RENDERSTATE
, D3DRS_POINTSPRITEENABLE
, "D3DRS_POINTSPRITEENABLE"},
268 {SC_RENDERSTATE
, D3DRS_POINTSCALEENABLE
, "D3DRS_POINTSCALEENABLE"}, /* 0x40 */
269 {SC_RENDERSTATE
, D3DRS_POINTSCALE_A
, "D3DRS_POINTSCALE_A"},
270 {SC_RENDERSTATE
, D3DRS_POINTSCALE_B
, "D3DRS_POINTSCALE_B"},
271 {SC_RENDERSTATE
, D3DRS_POINTSCALE_C
, "D3DRS_POINTSCALE_C"},
272 {SC_RENDERSTATE
, D3DRS_MULTISAMPLEANTIALIAS
, "D3DRS_MULTISAMPLEANTIALIAS"},
273 {SC_RENDERSTATE
, D3DRS_MULTISAMPLEMASK
, "D3DRS_MULTISAMPLEMASK"},
274 {SC_RENDERSTATE
, D3DRS_PATCHEDGESTYLE
, "D3DRS_PATCHEDGESTYLE"},
275 {SC_RENDERSTATE
, D3DRS_DEBUGMONITORTOKEN
, "D3DRS_DEBUGMONITORTOKEN"},
276 {SC_RENDERSTATE
, D3DRS_INDEXEDVERTEXBLENDENABLE
, "D3DRS_INDEXEDVERTEXBLENDENABLE"},
277 {SC_RENDERSTATE
, D3DRS_COLORWRITEENABLE
, "D3DRS_COLORWRITEENABLE"},
278 {SC_RENDERSTATE
, D3DRS_TWEENFACTOR
, "D3DRS_TWEENFACTOR"},
279 {SC_RENDERSTATE
, D3DRS_BLENDOP
, "D3DRS_BLENDOP"},
280 {SC_RENDERSTATE
, D3DRS_POSITIONDEGREE
, "D3DRS_POSITIONDEGREE"},
281 {SC_RENDERSTATE
, D3DRS_NORMALDEGREE
, "D3DRS_NORMALDEGREE"},
282 {SC_RENDERSTATE
, D3DRS_SCISSORTESTENABLE
, "D3DRS_SCISSORTESTENABLE"},
283 {SC_RENDERSTATE
, D3DRS_SLOPESCALEDEPTHBIAS
, "D3DRS_SLOPESCALEDEPTHBIAS"},
284 {SC_RENDERSTATE
, D3DRS_ANTIALIASEDLINEENABLE
, "D3DRS_ANTIALIASEDLINEENABLE"}, /* 0x50 */
285 {SC_RENDERSTATE
, D3DRS_MINTESSELLATIONLEVEL
, "D3DRS_MINTESSELLATIONLEVEL"},
286 {SC_RENDERSTATE
, D3DRS_MAXTESSELLATIONLEVEL
, "D3DRS_MAXTESSELLATIONLEVEL"},
287 {SC_RENDERSTATE
, D3DRS_ADAPTIVETESS_X
, "D3DRS_ADAPTIVETESS_X"},
288 {SC_RENDERSTATE
, D3DRS_ADAPTIVETESS_Y
, "D3DRS_ADAPTIVETESS_Y"},
289 {SC_RENDERSTATE
, D3DRS_ADAPTIVETESS_Z
, "D3DRS_ADAPTIVETESS_Z"},
290 {SC_RENDERSTATE
, D3DRS_ADAPTIVETESS_W
, "D3DRS_ADAPTIVETESS_W"},
291 {SC_RENDERSTATE
, D3DRS_ENABLEADAPTIVETESSELLATION
, "D3DRS_ENABLEADAPTIVETESSELLATION"},
292 {SC_RENDERSTATE
, D3DRS_TWOSIDEDSTENCILMODE
, "D3DRS_TWOSIDEDSTENCILMODE"},
293 {SC_RENDERSTATE
, D3DRS_CCW_STENCILFAIL
, "D3DRS_CCW_STENCILFAIL"},
294 {SC_RENDERSTATE
, D3DRS_CCW_STENCILZFAIL
, "D3DRS_CCW_STENCILZFAIL"},
295 {SC_RENDERSTATE
, D3DRS_CCW_STENCILPASS
, "D3DRS_CCW_STENCILPASS"},
296 {SC_RENDERSTATE
, D3DRS_CCW_STENCILFUNC
, "D3DRS_CCW_STENCILFUNC"},
297 {SC_RENDERSTATE
, D3DRS_COLORWRITEENABLE1
, "D3DRS_COLORWRITEENABLE1"},
298 {SC_RENDERSTATE
, D3DRS_COLORWRITEENABLE2
, "D3DRS_COLORWRITEENABLE2"},
299 {SC_RENDERSTATE
, D3DRS_COLORWRITEENABLE3
, "D3DRS_COLORWRITEENABLE3"},
300 {SC_RENDERSTATE
, D3DRS_BLENDFACTOR
, "D3DRS_BLENDFACTOR"}, /* 0x60 */
301 {SC_RENDERSTATE
, D3DRS_SRGBWRITEENABLE
, "D3DRS_SRGBWRITEENABLE"},
302 {SC_RENDERSTATE
, D3DRS_DEPTHBIAS
, "D3DRS_DEPTHBIAS"},
303 {SC_RENDERSTATE
, D3DRS_SEPARATEALPHABLENDENABLE
, "D3DRS_SEPARATEALPHABLENDENABLE"},
304 {SC_RENDERSTATE
, D3DRS_SRCBLENDALPHA
, "D3DRS_SRCBLENDALPHA"},
305 {SC_RENDERSTATE
, D3DRS_DESTBLENDALPHA
, "D3DRS_DESTBLENDALPHA"},
306 {SC_RENDERSTATE
, D3DRS_BLENDOPALPHA
, "D3DRS_BLENDOPALPHA"},
308 {SC_TEXTURESTAGE
, D3DTSS_COLOROP
, "D3DTSS_COLOROP"},
309 {SC_TEXTURESTAGE
, D3DTSS_COLORARG0
, "D3DTSS_COLORARG0"},
310 {SC_TEXTURESTAGE
, D3DTSS_COLORARG1
, "D3DTSS_COLORARG1"},
311 {SC_TEXTURESTAGE
, D3DTSS_COLORARG2
, "D3DTSS_COLORARG2"},
312 {SC_TEXTURESTAGE
, D3DTSS_ALPHAOP
, "D3DTSS_ALPHAOP"},
313 {SC_TEXTURESTAGE
, D3DTSS_ALPHAARG0
, "D3DTSS_ALPHAARG0"},
314 {SC_TEXTURESTAGE
, D3DTSS_ALPHAARG1
, "D3DTSS_ALPHAARG1"},
315 {SC_TEXTURESTAGE
, D3DTSS_ALPHAARG2
, "D3DTSS_ALPHAARG2"},
316 {SC_TEXTURESTAGE
, D3DTSS_RESULTARG
, "D3DTSS_RESULTARG"},
317 {SC_TEXTURESTAGE
, D3DTSS_BUMPENVMAT00
, "D3DTSS_BUMPENVMAT00"}, /* 0x70 */
318 {SC_TEXTURESTAGE
, D3DTSS_BUMPENVMAT01
, "D3DTSS_BUMPENVMAT01"},
319 {SC_TEXTURESTAGE
, D3DTSS_BUMPENVMAT10
, "D3DTSS_BUMPENVMAT10"},
320 {SC_TEXTURESTAGE
, D3DTSS_BUMPENVMAT11
, "D3DTSS_BUMPENVMAT11"},
321 {SC_TEXTURESTAGE
, D3DTSS_TEXCOORDINDEX
, "D3DTSS_TEXCOORDINDEX"},
322 {SC_TEXTURESTAGE
, D3DTSS_BUMPENVLSCALE
, "D3DTSS_BUMPENVLSCALE"},
323 {SC_TEXTURESTAGE
, D3DTSS_BUMPENVLOFFSET
, "D3DTSS_BUMPENVLOFFSET"},
324 {SC_TEXTURESTAGE
, D3DTSS_TEXTURETRANSFORMFLAGS
, "D3DTSS_TEXTURETRANSFORMFLAGS"},
326 {SC_UNKNOWN
, 0, "UNKNOWN"},
328 {SC_NPATCHMODE
, 0, "NPatchMode"},
330 {SC_UNKNOWN
, 0, "UNKNOWN"},
332 {SC_TRANSFORM
, D3DTS_PROJECTION
, "D3DTS_PROJECTION"},
333 {SC_TRANSFORM
, D3DTS_VIEW
, "D3DTS_VIEW"},
334 {SC_TRANSFORM
, D3DTS_WORLD
, "D3DTS_WORLD"},
335 {SC_TRANSFORM
, D3DTS_TEXTURE0
, "D3DTS_TEXTURE0"},
337 {SC_MATERIAL
, MT_DIFFUSE
, "MaterialDiffuse"},
338 {SC_MATERIAL
, MT_AMBIENT
, "MaterialAmbient"}, /* 0x80 */
339 {SC_MATERIAL
, MT_SPECULAR
, "MaterialSpecular"},
340 {SC_MATERIAL
, MT_EMISSIVE
, "MaterialEmissive"},
341 {SC_MATERIAL
, MT_POWER
, "MaterialPower"},
343 {SC_LIGHT
, LT_TYPE
, "LightType"},
344 {SC_LIGHT
, LT_DIFFUSE
, "LightDiffuse"},
345 {SC_LIGHT
, LT_SPECULAR
, "LightSpecular"},
346 {SC_LIGHT
, LT_AMBIENT
, "LightAmbient"},
347 {SC_LIGHT
, LT_POSITION
, "LightPosition"},
348 {SC_LIGHT
, LT_DIRECTION
, "LightDirection"},
349 {SC_LIGHT
, LT_RANGE
, "LightRange"},
350 {SC_LIGHT
, LT_FALLOFF
, "LightFallOff"},
351 {SC_LIGHT
, LT_ATTENUATION0
, "LightAttenuation0"},
352 {SC_LIGHT
, LT_ATTENUATION1
, "LightAttenuation1"},
353 {SC_LIGHT
, LT_ATTENUATION2
, "LightAttenuation2"},
354 {SC_LIGHT
, LT_THETA
, "LightTheta"},
355 {SC_LIGHT
, LT_PHI
, "LightPhi"}, /* 0x90 */
357 {SC_LIGHTENABLE
, 0, "LightEnable"},
359 {SC_VERTEXSHADER
, 0, "Vertexshader"},
361 {SC_PIXELSHADER
, 0, "Pixelshader"},
362 /* Shader constants */
363 {SC_SHADERCONST
, SCT_VSFLOAT
, "VertexShaderConstantF"},
364 {SC_SHADERCONST
, SCT_VSBOOL
, "VertexShaderConstantB"},
365 {SC_SHADERCONST
, SCT_VSINT
, "VertexShaderConstantI"},
366 {SC_SHADERCONST
, SCT_VSFLOAT
, "VertexShaderConstant"},
367 {SC_SHADERCONST
, SCT_VSFLOAT
, "VertexShaderConstant1"},
368 {SC_SHADERCONST
, SCT_VSFLOAT
, "VertexShaderConstant2"},
369 {SC_SHADERCONST
, SCT_VSFLOAT
, "VertexShaderConstant3"},
370 {SC_SHADERCONST
, SCT_VSFLOAT
, "VertexShaderConstant4"},
371 {SC_SHADERCONST
, SCT_PSFLOAT
, "PixelShaderConstantF"},
372 {SC_SHADERCONST
, SCT_PSBOOL
, "PixelShaderConstantB"},
373 {SC_SHADERCONST
, SCT_PSINT
, "PixelShaderConstantI"},
374 {SC_SHADERCONST
, SCT_PSFLOAT
, "PixelShaderConstant"},
375 {SC_SHADERCONST
, SCT_PSFLOAT
, "PixelShaderConstant1"}, /* 0xa0 */
376 {SC_SHADERCONST
, SCT_PSFLOAT
, "PixelShaderConstant2"},
377 {SC_SHADERCONST
, SCT_PSFLOAT
, "PixelShaderConstant3"},
378 {SC_SHADERCONST
, SCT_PSFLOAT
, "PixelShaderConstant4"},
380 {SC_TEXTURE
, 0, "Texture"},
382 {SC_SAMPLERSTATE
, D3DSAMP_ADDRESSU
, "AddressU"},
383 {SC_SAMPLERSTATE
, D3DSAMP_ADDRESSV
, "AddressV"},
384 {SC_SAMPLERSTATE
, D3DSAMP_ADDRESSW
, "AddressW"},
385 {SC_SAMPLERSTATE
, D3DSAMP_BORDERCOLOR
, "BorderColor"},
386 {SC_SAMPLERSTATE
, D3DSAMP_MAGFILTER
, "MagFilter"},
387 {SC_SAMPLERSTATE
, D3DSAMP_MINFILTER
, "MinFilter"},
388 {SC_SAMPLERSTATE
, D3DSAMP_MIPFILTER
, "MipFilter"},
389 {SC_SAMPLERSTATE
, D3DSAMP_MIPMAPLODBIAS
, "MipMapLodBias"},
390 {SC_SAMPLERSTATE
, D3DSAMP_MAXMIPLEVEL
, "MaxMipLevel"},
391 {SC_SAMPLERSTATE
, D3DSAMP_MAXANISOTROPY
, "MaxAnisotropy"},
392 {SC_SAMPLERSTATE
, D3DSAMP_SRGBTEXTURE
, "SRGBTexture"},
393 {SC_SAMPLERSTATE
, D3DSAMP_ELEMENTINDEX
, "ElementIndex"}, /* 0xb0 */
394 {SC_SAMPLERSTATE
, D3DSAMP_DMAPOFFSET
, "DMAPOffset"},
396 {SC_SETSAMPLER
, 0, "Sampler"},
399 static inline void read_dword(const char **ptr
, DWORD
*d
)
401 memcpy(d
, *ptr
, sizeof(*d
));
405 static void skip_dword_unknown(const char **ptr
, unsigned int count
)
410 FIXME("Skipping %u unknown DWORDs:\n", count
);
411 for (i
= 0; i
< count
; ++i
)
414 FIXME("\t0x%08x\n", d
);
418 static inline struct d3dx_parameter
*get_parameter_struct(D3DXHANDLE handle
)
420 return (struct d3dx_parameter
*) handle
;
423 static inline struct d3dx_pass
*get_pass_struct(D3DXHANDLE handle
)
425 return (struct d3dx_pass
*) handle
;
428 static inline struct d3dx_technique
*get_technique_struct(D3DXHANDLE handle
)
430 return (struct d3dx_technique
*) handle
;
433 static inline D3DXHANDLE
get_parameter_handle(struct d3dx_parameter
*parameter
)
435 return (D3DXHANDLE
) parameter
;
438 static inline D3DXHANDLE
get_technique_handle(struct d3dx_technique
*technique
)
440 return (D3DXHANDLE
) technique
;
443 static inline D3DXHANDLE
get_pass_handle(struct d3dx_pass
*pass
)
445 return (D3DXHANDLE
) pass
;
448 static struct d3dx_technique
*is_valid_technique(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE technique
)
452 for (i
= 0; i
< base
->technique_count
; ++i
)
454 if (base
->technique_handles
[i
] == technique
)
456 return get_technique_struct(technique
);
463 static struct d3dx_pass
*is_valid_pass(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE pass
)
467 for (i
= 0; i
< base
->technique_count
; ++i
)
469 struct d3dx_technique
*technique
= get_technique_struct(base
->technique_handles
[i
]);
471 for (k
= 0; k
< technique
->pass_count
; ++k
)
473 if (technique
->pass_handles
[k
] == pass
)
475 return get_pass_struct(pass
);
483 static struct d3dx_parameter
*is_valid_sub_parameter(struct d3dx_parameter
*param
, D3DXHANDLE parameter
)
485 unsigned int i
, count
;
486 struct d3dx_parameter
*p
;
488 for (i
= 0; i
< param
->annotation_count
; ++i
)
490 if (param
->annotation_handles
[i
] == parameter
)
492 return get_parameter_struct(parameter
);
495 p
= is_valid_sub_parameter(get_parameter_struct(param
->annotation_handles
[i
]), parameter
);
499 if (param
->element_count
) count
= param
->element_count
;
500 else count
= param
->member_count
;
502 for (i
= 0; i
< count
; ++i
)
504 if (param
->member_handles
[i
] == parameter
)
506 return get_parameter_struct(parameter
);
509 p
= is_valid_sub_parameter(get_parameter_struct(param
->member_handles
[i
]), parameter
);
516 static struct d3dx_parameter
*is_valid_parameter(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE parameter
)
518 unsigned int i
, k
, m
;
519 struct d3dx_parameter
*p
;
521 for (i
= 0; i
< base
->parameter_count
; ++i
)
523 if (base
->parameter_handles
[i
] == parameter
)
525 return get_parameter_struct(parameter
);
528 p
= is_valid_sub_parameter(get_parameter_struct(base
->parameter_handles
[i
]), parameter
);
532 for (i
= 0; i
< base
->technique_count
; ++i
)
534 struct d3dx_technique
*technique
= get_technique_struct(base
->technique_handles
[i
]);
536 for (k
= 0; k
< technique
->pass_count
; ++k
)
538 struct d3dx_pass
*pass
= get_pass_struct(technique
->pass_handles
[k
]);
540 for (m
= 0; m
< pass
->annotation_count
; ++m
)
542 if (pass
->annotation_handles
[i
] == parameter
)
544 return get_parameter_struct(parameter
);
547 p
= is_valid_sub_parameter(get_parameter_struct(pass
->annotation_handles
[m
]), parameter
);
552 for (k
= 0; k
< technique
->annotation_count
; ++k
)
554 if (technique
->annotation_handles
[k
] == parameter
)
556 return get_parameter_struct(parameter
);
559 p
= is_valid_sub_parameter(get_parameter_struct(technique
->annotation_handles
[k
]), parameter
);
567 static inline struct d3dx_parameter
*get_valid_parameter(struct ID3DXBaseEffectImpl
*base
, D3DXHANDLE parameter
)
569 struct d3dx_parameter
*param
= is_valid_parameter(base
, parameter
);
571 if (!param
) param
= get_parameter_by_name(base
, NULL
, parameter
);
576 static void free_state(struct d3dx_state
*state
)
578 free_parameter_state(state
->parameter
, FALSE
, FALSE
, state
->type
);
581 static void free_sampler(struct d3dx_sampler
*sampler
)
585 for (i
= 0; i
< sampler
->state_count
; ++i
)
587 free_state(&sampler
->states
[i
]);
589 HeapFree(GetProcessHeap(), 0, sampler
->states
);
592 static void free_parameter(D3DXHANDLE handle
, BOOL element
, BOOL child
)
594 free_parameter_state(handle
, element
, child
, ST_CONSTANT
);
597 static void free_parameter_state(D3DXHANDLE handle
, BOOL element
, BOOL child
, enum STATE_TYPE st
)
600 struct d3dx_parameter
*param
= get_parameter_struct(handle
);
602 TRACE("Free parameter %p, name %s, type %s, child %s, state_type %x\n", param
, param
->name
,
603 debug_d3dxparameter_type(param
->type
), child
? "yes" : "no", st
);
610 if (param
->annotation_handles
)
612 for (i
= 0; i
< param
->annotation_count
; ++i
)
614 free_parameter(param
->annotation_handles
[i
], FALSE
, FALSE
);
616 HeapFree(GetProcessHeap(), 0, param
->annotation_handles
);
619 if (param
->member_handles
)
623 if (param
->element_count
) count
= param
->element_count
;
624 else count
= param
->member_count
;
626 for (i
= 0; i
< count
; ++i
)
628 free_parameter(param
->member_handles
[i
], param
->element_count
!= 0, TRUE
);
630 HeapFree(GetProcessHeap(), 0, param
->member_handles
);
633 if (param
->class == D3DXPC_OBJECT
&& !param
->element_count
)
638 HeapFree(GetProcessHeap(), 0, *(LPSTR
*)param
->data
);
639 if (!child
) HeapFree(GetProcessHeap(), 0, param
->data
);
643 case D3DXPT_TEXTURE1D
:
644 case D3DXPT_TEXTURE2D
:
645 case D3DXPT_TEXTURE3D
:
646 case D3DXPT_TEXTURECUBE
:
647 case D3DXPT_PIXELSHADER
:
648 case D3DXPT_VERTEXSHADER
:
649 if (st
== ST_CONSTANT
)
651 if (*(IUnknown
**)param
->data
) IUnknown_Release(*(IUnknown
**)param
->data
);
655 HeapFree(GetProcessHeap(), 0, *(LPSTR
*)param
->data
);
657 if (!child
) HeapFree(GetProcessHeap(), 0, param
->data
);
661 case D3DXPT_SAMPLER1D
:
662 case D3DXPT_SAMPLER2D
:
663 case D3DXPT_SAMPLER3D
:
664 case D3DXPT_SAMPLERCUBE
:
665 if (st
== ST_CONSTANT
)
667 free_sampler((struct d3dx_sampler
*)param
->data
);
671 HeapFree(GetProcessHeap(), 0, *(LPSTR
*)param
->data
);
673 /* samplers have always own data, so free that */
674 HeapFree(GetProcessHeap(), 0, param
->data
);
678 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
686 if (st
!= ST_CONSTANT
)
688 HeapFree(GetProcessHeap(), 0, *(LPSTR
*)param
->data
);
690 HeapFree(GetProcessHeap(), 0, param
->data
);
694 /* only the parent has to release name and semantic */
697 HeapFree(GetProcessHeap(), 0, param
->name
);
698 HeapFree(GetProcessHeap(), 0, param
->semantic
);
701 HeapFree(GetProcessHeap(), 0, param
);
704 static void free_pass(D3DXHANDLE handle
)
707 struct d3dx_pass
*pass
= get_pass_struct(handle
);
709 TRACE("Free pass %p\n", pass
);
716 if (pass
->annotation_handles
)
718 for (i
= 0; i
< pass
->annotation_count
; ++i
)
720 free_parameter(pass
->annotation_handles
[i
], FALSE
, FALSE
);
722 HeapFree(GetProcessHeap(), 0, pass
->annotation_handles
);
727 for (i
= 0; i
< pass
->state_count
; ++i
)
729 free_state(&pass
->states
[i
]);
731 HeapFree(GetProcessHeap(), 0, pass
->states
);
734 HeapFree(GetProcessHeap(), 0, pass
->name
);
735 HeapFree(GetProcessHeap(), 0, pass
);
738 static void free_technique(D3DXHANDLE handle
)
741 struct d3dx_technique
*technique
= get_technique_struct(handle
);
743 TRACE("Free technique %p\n", technique
);
750 if (technique
->annotation_handles
)
752 for (i
= 0; i
< technique
->annotation_count
; ++i
)
754 free_parameter(technique
->annotation_handles
[i
], FALSE
, FALSE
);
756 HeapFree(GetProcessHeap(), 0, technique
->annotation_handles
);
759 if (technique
->pass_handles
)
761 for (i
= 0; i
< technique
->pass_count
; ++i
)
763 free_pass(technique
->pass_handles
[i
]);
765 HeapFree(GetProcessHeap(), 0, technique
->pass_handles
);
768 HeapFree(GetProcessHeap(), 0, technique
->name
);
769 HeapFree(GetProcessHeap(), 0, technique
);
772 static void free_base_effect(struct ID3DXBaseEffectImpl
*base
)
776 TRACE("Free base effect %p\n", base
);
778 if (base
->parameter_handles
)
780 for (i
= 0; i
< base
->parameter_count
; ++i
)
782 free_parameter(base
->parameter_handles
[i
], FALSE
, FALSE
);
784 HeapFree(GetProcessHeap(), 0, base
->parameter_handles
);
787 if (base
->technique_handles
)
789 for (i
= 0; i
< base
->technique_count
; ++i
)
791 free_technique(base
->technique_handles
[i
]);
793 HeapFree(GetProcessHeap(), 0, base
->technique_handles
);
797 static void free_effect(struct ID3DXEffectImpl
*effect
)
799 TRACE("Free effect %p\n", effect
);
801 if (effect
->base_effect
)
803 effect
->base_effect
->lpVtbl
->Release(effect
->base_effect
);
808 effect
->pool
->lpVtbl
->Release(effect
->pool
);
813 IUnknown_Release(effect
->manager
);
816 IDirect3DDevice9_Release(effect
->device
);
819 static void free_effect_compiler(struct ID3DXEffectCompilerImpl
*compiler
)
821 TRACE("Free effect compiler %p\n", compiler
);
823 if (compiler
->base_effect
)
825 compiler
->base_effect
->lpVtbl
->Release(compiler
->base_effect
);
829 static INT
get_int(D3DXPARAMETER_TYPE type
, LPCVOID data
)
849 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type
));
856 inline static FLOAT
get_float(D3DXPARAMETER_TYPE type
, LPCVOID data
)
876 FIXME("Unhandled type %s. This should not happen!\n", debug_d3dxparameter_type(type
));
883 static inline BOOL
get_bool(LPCVOID data
)
885 return (*(DWORD
*)data
) ? TRUE
: FALSE
;
888 static void get_vector(struct d3dx_parameter
*param
, D3DXVECTOR4
*vector
)
890 vector
->x
= get_float(param
->type
, (float *)param
->data
);
891 vector
->y
= param
->columns
> 1 ? get_float(param
->type
, (float *)param
->data
+ 1) : 0.0f
;
892 vector
->z
= param
->columns
> 2 ? get_float(param
->type
, (float *)param
->data
+ 2) : 0.0f
;
893 vector
->w
= param
->columns
> 3 ? get_float(param
->type
, (float *)param
->data
+ 3) : 0.0f
;
896 static void set_number(LPVOID outdata
, D3DXPARAMETER_TYPE outtype
, LPCVOID indata
, D3DXPARAMETER_TYPE intype
)
898 TRACE("Changing from type %i to type %i\n", intype
, outtype
);
903 *(FLOAT
*)outdata
= get_float(intype
, indata
);
907 *(BOOL
*)outdata
= get_bool(indata
);
911 *(INT
*)outdata
= get_int(intype
, indata
);
915 FIXME("Error converting to type %i\n", outtype
);
921 static void get_matrix(struct d3dx_parameter
*param
, D3DXMATRIX
*matrix
)
925 for (i
= 0; i
< 4; ++i
)
927 for (k
= 0; k
< 4; ++k
)
929 if ((i
< param
->rows
) && (k
< param
->columns
))
930 matrix
->u
.m
[i
][k
] = get_float(param
->type
, (float *)param
->data
+ i
* param
->columns
+ k
);
932 matrix
->u
.m
[i
][k
] = 0.0f
;
937 static struct d3dx_parameter
*get_parameter_element_by_name(struct d3dx_parameter
*parameter
, LPCSTR name
)
940 struct d3dx_parameter
*temp_parameter
;
943 TRACE("parameter %p, name %s\n", parameter
, debugstr_a(name
));
945 if (!name
|| !*name
) return parameter
;
947 element
= atoi(name
);
948 part
= strchr(name
, ']') + 1;
950 if (parameter
->element_count
> element
)
952 temp_parameter
= get_parameter_struct(parameter
->member_handles
[element
]);
957 return get_parameter_by_name(NULL
, temp_parameter
, part
);
960 return get_parameter_annotation_by_name(temp_parameter
, part
);
963 TRACE("Returning parameter %p\n", temp_parameter
);
964 return temp_parameter
;
967 FIXME("Unhandled case \"%c\"\n", *--part
);
972 TRACE("Parameter not found\n");
976 static struct d3dx_parameter
*get_parameter_annotation_by_name(struct d3dx_parameter
*parameter
, LPCSTR name
)
979 struct d3dx_parameter
*temp_parameter
;
982 TRACE("parameter %p, name %s\n", parameter
, debugstr_a(name
));
984 if (!name
|| !*name
) return parameter
;
986 length
= strcspn( name
, "[.@" );
987 part
= name
+ length
;
989 for (i
= 0; i
< parameter
->annotation_count
; ++i
)
991 temp_parameter
= get_parameter_struct(parameter
->annotation_handles
[i
]);
993 if (!strcmp(temp_parameter
->name
, name
))
995 TRACE("Returning parameter %p\n", temp_parameter
);
996 return temp_parameter
;
998 else if (strlen(temp_parameter
->name
) == length
&& !strncmp(temp_parameter
->name
, name
, length
))
1003 return get_parameter_by_name(NULL
, temp_parameter
, part
);
1006 return get_parameter_element_by_name(temp_parameter
, part
);
1009 FIXME("Unhandled case \"%c\"\n", *--part
);
1015 TRACE("Parameter not found\n");
1019 static struct d3dx_parameter
*get_parameter_by_name(struct ID3DXBaseEffectImpl
*base
,
1020 struct d3dx_parameter
*parameter
, LPCSTR name
)
1022 UINT i
, count
, length
;
1023 struct d3dx_parameter
*temp_parameter
;
1024 D3DXHANDLE
*handles
;
1027 TRACE("base %p, parameter %p, name %s\n", base
, parameter
, debugstr_a(name
));
1029 if (!name
|| !*name
) return parameter
;
1033 count
= base
->parameter_count
;
1034 handles
= base
->parameter_handles
;
1038 count
= parameter
->member_count
;
1039 handles
= parameter
->member_handles
;
1042 length
= strcspn( name
, "[.@" );
1043 part
= name
+ length
;
1045 for (i
= 0; i
< count
; i
++)
1047 temp_parameter
= get_parameter_struct(handles
[i
]);
1049 if (!strcmp(temp_parameter
->name
, name
))
1051 TRACE("Returning parameter %p\n", temp_parameter
);
1052 return temp_parameter
;
1054 else if (strlen(temp_parameter
->name
) == length
&& !strncmp(temp_parameter
->name
, name
, length
))
1059 return get_parameter_by_name(NULL
, temp_parameter
, part
);
1062 return get_parameter_annotation_by_name(temp_parameter
, part
);
1065 return get_parameter_element_by_name(temp_parameter
, part
);
1068 FIXME("Unhandled case \"%c\"\n", *--part
);
1074 TRACE("Parameter not found\n");
1078 static inline DWORD
d3dx9_effect_version(DWORD major
, DWORD minor
)
1080 return (0xfeff0000 | ((major
) << 8) | (minor
));
1083 static inline struct ID3DXBaseEffectImpl
*impl_from_ID3DXBaseEffect(ID3DXBaseEffect
*iface
)
1085 return CONTAINING_RECORD(iface
, struct ID3DXBaseEffectImpl
, ID3DXBaseEffect_iface
);
1088 /*** IUnknown methods ***/
1089 static HRESULT WINAPI
ID3DXBaseEffectImpl_QueryInterface(ID3DXBaseEffect
*iface
, REFIID riid
, void **object
)
1091 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1093 TRACE("iface %p, riid %s, object %p\n", This
, debugstr_guid(riid
), object
);
1095 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
1096 IsEqualGUID(riid
, &IID_ID3DXBaseEffect
))
1098 This
->ID3DXBaseEffect_iface
.lpVtbl
->AddRef(iface
);
1103 ERR("Interface %s not found\n", debugstr_guid(riid
));
1105 return E_NOINTERFACE
;
1108 static ULONG WINAPI
ID3DXBaseEffectImpl_AddRef(ID3DXBaseEffect
*iface
)
1110 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1112 TRACE("iface %p: AddRef from %u\n", iface
, This
->ref
);
1114 return InterlockedIncrement(&This
->ref
);
1117 static ULONG WINAPI
ID3DXBaseEffectImpl_Release(ID3DXBaseEffect
*iface
)
1119 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1120 ULONG ref
= InterlockedDecrement(&This
->ref
);
1122 TRACE("iface %p: Release from %u\n", iface
, ref
+ 1);
1126 free_base_effect(This
);
1127 HeapFree(GetProcessHeap(), 0, This
);
1133 /*** ID3DXBaseEffect methods ***/
1134 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetDesc(ID3DXBaseEffect
*iface
, D3DXEFFECT_DESC
*desc
)
1136 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1138 FIXME("iface %p, desc %p partial stub\n", This
, desc
);
1142 WARN("Invalid argument specified.\n");
1143 return D3DERR_INVALIDCALL
;
1146 /* Todo: add creator and function count */
1147 desc
->Creator
= NULL
;
1148 desc
->Functions
= 0;
1149 desc
->Parameters
= This
->parameter_count
;
1150 desc
->Techniques
= This
->technique_count
;
1155 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetParameterDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXPARAMETER_DESC
*desc
)
1157 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1158 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1160 TRACE("iface %p, parameter %p, desc %p\n", This
, parameter
, desc
);
1162 if (!desc
|| !param
)
1164 WARN("Invalid argument specified.\n");
1165 return D3DERR_INVALIDCALL
;
1168 desc
->Name
= param
->name
;
1169 desc
->Semantic
= param
->semantic
;
1170 desc
->Class
= param
->class;
1171 desc
->Type
= param
->type
;
1172 desc
->Rows
= param
->rows
;
1173 desc
->Columns
= param
->columns
;
1174 desc
->Elements
= param
->element_count
;
1175 desc
->Annotations
= param
->annotation_count
;
1176 desc
->StructMembers
= param
->member_count
;
1177 desc
->Flags
= param
->flags
;
1178 desc
->Bytes
= param
->bytes
;
1183 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetTechniqueDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE technique
, D3DXTECHNIQUE_DESC
*desc
)
1185 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1186 struct d3dx_technique
*tech
= technique
? is_valid_technique(This
, technique
) : get_technique_struct(This
->technique_handles
[0]);
1188 TRACE("iface %p, technique %p, desc %p\n", This
, technique
, desc
);
1192 WARN("Invalid argument specified.\n");
1193 return D3DERR_INVALIDCALL
;
1196 desc
->Name
= tech
->name
;
1197 desc
->Passes
= tech
->pass_count
;
1198 desc
->Annotations
= tech
->annotation_count
;
1203 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetPassDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE pass
, D3DXPASS_DESC
*desc
)
1205 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1206 struct d3dx_pass
*p
= is_valid_pass(This
, pass
);
1208 TRACE("iface %p, pass %p, desc %p\n", This
, pass
, desc
);
1212 WARN("Invalid argument specified.\n");
1213 return D3DERR_INVALIDCALL
;
1216 desc
->Name
= p
->name
;
1217 desc
->Annotations
= p
->annotation_count
;
1219 FIXME("Pixel shader and vertex shader are not supported, yet.\n");
1220 desc
->pVertexShaderFunction
= NULL
;
1221 desc
->pPixelShaderFunction
= NULL
;
1226 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetFunctionDesc(ID3DXBaseEffect
*iface
, D3DXHANDLE shader
, D3DXFUNCTION_DESC
*desc
)
1228 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1230 FIXME("iface %p, shader %p, desc %p stub\n", This
, shader
, desc
);
1235 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameter(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
1237 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1238 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1240 TRACE("iface %p, parameter %p, index %u\n", This
, parameter
, index
);
1244 if (index
< This
->parameter_count
)
1246 TRACE("Returning parameter %p\n", This
->parameter_handles
[index
]);
1247 return This
->parameter_handles
[index
];
1252 if (param
&& !param
->element_count
&& index
< param
->member_count
)
1254 TRACE("Returning parameter %p\n", param
->member_handles
[index
]);
1255 return param
->member_handles
[index
];
1259 WARN("Invalid argument specified.\n");
1264 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameterByName(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR name
)
1266 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1267 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1270 TRACE("iface %p, parameter %p, name %s\n", This
, parameter
, debugstr_a(name
));
1274 handle
= get_parameter_handle(param
);
1275 TRACE("Returning parameter %p\n", handle
);
1279 handle
= get_parameter_handle(get_parameter_by_name(This
, param
, name
));
1280 TRACE("Returning parameter %p\n", handle
);
1285 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameterBySemantic(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR semantic
)
1287 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1288 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1289 struct d3dx_parameter
*temp_param
;
1292 TRACE("iface %p, parameter %p, semantic %s\n", This
, parameter
, debugstr_a(semantic
));
1296 for (i
= 0; i
< This
->parameter_count
; ++i
)
1298 temp_param
= get_parameter_struct(This
->parameter_handles
[i
]);
1300 if (!temp_param
->semantic
)
1304 TRACE("Returning parameter %p\n", This
->parameter_handles
[i
]);
1305 return This
->parameter_handles
[i
];
1310 if (!strcasecmp(temp_param
->semantic
, semantic
))
1312 TRACE("Returning parameter %p\n", This
->parameter_handles
[i
]);
1313 return This
->parameter_handles
[i
];
1319 for (i
= 0; i
< param
->member_count
; ++i
)
1321 temp_param
= get_parameter_struct(param
->member_handles
[i
]);
1323 if (!temp_param
->semantic
)
1327 TRACE("Returning parameter %p\n", param
->member_handles
[i
]);
1328 return param
->member_handles
[i
];
1333 if (!strcasecmp(temp_param
->semantic
, semantic
))
1335 TRACE("Returning parameter %p\n", param
->member_handles
[i
]);
1336 return param
->member_handles
[i
];
1341 WARN("Invalid argument specified\n");
1346 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetParameterElement(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
1348 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1349 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1351 TRACE("iface %p, parameter %p, index %u\n", This
, parameter
, index
);
1355 if (index
< This
->parameter_count
)
1357 TRACE("Returning parameter %p\n", This
->parameter_handles
[index
]);
1358 return This
->parameter_handles
[index
];
1363 if (index
< param
->element_count
)
1365 TRACE("Returning parameter %p\n", param
->member_handles
[index
]);
1366 return param
->member_handles
[index
];
1370 WARN("Invalid argument specified\n");
1375 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetTechnique(ID3DXBaseEffect
*iface
, UINT index
)
1377 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1379 TRACE("iface %p, index %u\n", This
, index
);
1381 if (index
>= This
->technique_count
)
1383 WARN("Invalid argument specified.\n");
1387 TRACE("Returning technique %p\n", This
->technique_handles
[index
]);
1389 return This
->technique_handles
[index
];
1392 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetTechniqueByName(ID3DXBaseEffect
*iface
, LPCSTR name
)
1394 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1397 TRACE("iface %p, name %s stub\n", This
, debugstr_a(name
));
1401 WARN("Invalid argument specified.\n");
1405 for (i
= 0; i
< This
->technique_count
; ++i
)
1407 struct d3dx_technique
*tech
= get_technique_struct(This
->technique_handles
[i
]);
1409 if (!strcmp(tech
->name
, name
))
1411 TRACE("Returning technique %p\n", This
->technique_handles
[i
]);
1412 return This
->technique_handles
[i
];
1416 WARN("Invalid argument specified.\n");
1421 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect
*iface
, D3DXHANDLE technique
, UINT index
)
1423 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1424 struct d3dx_technique
*tech
= is_valid_technique(This
, technique
);
1426 TRACE("iface %p, technique %p, index %u\n", This
, technique
, index
);
1428 if (!tech
) tech
= get_technique_struct(iface
->lpVtbl
->GetTechniqueByName(iface
, technique
));
1430 if (tech
&& index
< tech
->pass_count
)
1432 TRACE("Returning pass %p\n", tech
->pass_handles
[index
]);
1433 return tech
->pass_handles
[index
];
1436 WARN("Invalid argument specified.\n");
1441 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect
*iface
, D3DXHANDLE technique
, LPCSTR name
)
1443 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1444 struct d3dx_technique
*tech
= is_valid_technique(This
, technique
);
1446 TRACE("iface %p, technique %p, name %s\n", This
, technique
, debugstr_a(name
));
1448 if (!tech
) tech
= get_technique_struct(iface
->lpVtbl
->GetTechniqueByName(iface
, technique
));
1454 for (i
= 0; i
< tech
->pass_count
; ++i
)
1456 struct d3dx_pass
*pass
= get_pass_struct(tech
->pass_handles
[i
]);
1458 if (!strcmp(pass
->name
, name
))
1460 TRACE("Returning pass %p\n", tech
->pass_handles
[i
]);
1461 return tech
->pass_handles
[i
];
1466 WARN("Invalid argument specified.\n");
1471 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetFunction(ID3DXBaseEffect
*iface
, UINT index
)
1473 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1475 FIXME("iface %p, index %u stub\n", This
, index
);
1480 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetFunctionByName(ID3DXBaseEffect
*iface
, LPCSTR name
)
1482 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1484 FIXME("iface %p, name %s stub\n", This
, debugstr_a(name
));
1489 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetAnnotation(ID3DXBaseEffect
*iface
, D3DXHANDLE object
, UINT index
)
1491 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1492 struct d3dx_parameter
*param
= get_valid_parameter(This
, object
);
1493 struct d3dx_pass
*pass
= is_valid_pass(This
, object
);
1494 struct d3dx_technique
*technique
= is_valid_technique(This
, object
);
1495 UINT annotation_count
= 0;
1496 D3DXHANDLE
*annotation_handles
= NULL
;
1498 FIXME("iface %p, object %p, index %u partial stub\n", This
, object
, index
);
1502 annotation_count
= pass
->annotation_count
;
1503 annotation_handles
= pass
->annotation_handles
;
1507 annotation_count
= technique
->annotation_count
;
1508 annotation_handles
= technique
->annotation_handles
;
1512 annotation_count
= param
->annotation_count
;
1513 annotation_handles
= param
->annotation_handles
;
1515 /* Todo: add funcs */
1517 if (index
< annotation_count
)
1519 TRACE("Returning parameter %p\n", annotation_handles
[index
]);
1520 return annotation_handles
[index
];
1523 WARN("Invalid argument specified\n");
1528 static D3DXHANDLE WINAPI
ID3DXBaseEffectImpl_GetAnnotationByName(ID3DXBaseEffect
*iface
, D3DXHANDLE object
, LPCSTR name
)
1530 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1531 struct d3dx_parameter
*param
= get_valid_parameter(This
, object
);
1532 struct d3dx_pass
*pass
= is_valid_pass(This
, object
);
1533 struct d3dx_technique
*technique
= is_valid_technique(This
, object
);
1534 UINT annotation_count
= 0, i
;
1535 D3DXHANDLE
*annotation_handles
= NULL
;
1537 FIXME("iface %p, object %p, name %s partial stub\n", This
, object
, debugstr_a(name
));
1541 WARN("Invalid argument specified\n");
1547 annotation_count
= pass
->annotation_count
;
1548 annotation_handles
= pass
->annotation_handles
;
1552 annotation_count
= technique
->annotation_count
;
1553 annotation_handles
= technique
->annotation_handles
;
1557 annotation_count
= param
->annotation_count
;
1558 annotation_handles
= param
->annotation_handles
;
1560 /* Todo: add funcs */
1562 for (i
= 0; i
< annotation_count
; i
++)
1564 struct d3dx_parameter
*anno
= get_parameter_struct(annotation_handles
[i
]);
1566 if (!strcmp(anno
->name
, name
))
1568 TRACE("Returning parameter %p\n", anno
);
1569 return get_parameter_handle(anno
);
1573 WARN("Invalid argument specified\n");
1578 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetValue(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT bytes
)
1580 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1582 FIXME("iface %p, parameter %p, data %p, bytes %u stub\n", This
, parameter
, data
, bytes
);
1587 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetValue(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPVOID data
, UINT bytes
)
1589 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1590 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1592 TRACE("iface %p, parameter %p, data %p, bytes %u\n", This
, parameter
, data
, bytes
);
1596 WARN("Invalid parameter %p specified\n", parameter
);
1597 return D3DERR_INVALIDCALL
;
1600 /* samplers don't touch data */
1601 if (param
->class == D3DXPC_OBJECT
&& (param
->type
== D3DXPT_SAMPLER
1602 || param
->type
== D3DXPT_SAMPLER1D
|| param
->type
== D3DXPT_SAMPLER2D
1603 || param
->type
== D3DXPT_SAMPLER3D
|| param
->type
== D3DXPT_SAMPLERCUBE
))
1605 TRACE("Sampler: returning E_FAIL\n");
1609 if (data
&& param
->bytes
<= bytes
)
1611 TRACE("Type %s\n", debug_d3dxparameter_type(param
->type
));
1613 switch (param
->type
)
1622 case D3DXPT_VERTEXSHADER
:
1623 case D3DXPT_PIXELSHADER
:
1624 case D3DXPT_TEXTURE
:
1625 case D3DXPT_TEXTURE1D
:
1626 case D3DXPT_TEXTURE2D
:
1627 case D3DXPT_TEXTURE3D
:
1628 case D3DXPT_TEXTURECUBE
:
1632 for (i
= 0; i
< (param
->element_count
? param
->element_count
: 1); ++i
)
1634 IUnknown
*unk
= ((IUnknown
**)param
->data
)[i
];
1635 if (unk
) IUnknown_AddRef(unk
);
1641 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
1645 TRACE("Copy %u bytes\n", param
->bytes
);
1646 memcpy(data
, param
->data
, param
->bytes
);
1650 WARN("Invalid argument specified\n");
1652 return D3DERR_INVALIDCALL
;
1655 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetBool(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, BOOL b
)
1657 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1659 FIXME("iface %p, parameter %p, b %u stub\n", This
, parameter
, b
);
1664 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetBool(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
)
1666 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1667 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1669 TRACE("iface %p, parameter %p, b %p\n", This
, parameter
, b
);
1671 if (b
&& param
&& !param
->element_count
&& param
->rows
== 1 && param
->columns
== 1)
1673 *b
= get_bool(param
->data
);
1674 TRACE("Returning %s\n", *b
? "TRUE" : "FALSE");
1678 WARN("Invalid argument specified\n");
1680 return D3DERR_INVALIDCALL
;
1683 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetBoolArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST BOOL
*b
, UINT count
)
1685 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1687 FIXME("iface %p, parameter %p, b %p, count %u stub\n", This
, parameter
, b
, count
);
1692 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetBoolArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
, UINT count
)
1694 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1695 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1697 TRACE("iface %p, parameter %p, b %p, count %u\n", This
, parameter
, b
, count
);
1699 if (b
&& param
&& (param
->class == D3DXPC_SCALAR
1700 || param
->class == D3DXPC_VECTOR
1701 || param
->class == D3DXPC_MATRIX_ROWS
1702 || param
->class == D3DXPC_MATRIX_COLUMNS
))
1704 UINT i
, size
= min(count
, param
->bytes
/ sizeof(DWORD
));
1706 for (i
= 0; i
< size
; ++i
)
1708 b
[i
] = get_bool((DWORD
*)param
->data
+ i
);
1713 WARN("Invalid argument specified\n");
1715 return D3DERR_INVALIDCALL
;
1718 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetInt(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, INT n
)
1720 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1722 FIXME("iface %p, parameter %p, n %u stub\n", This
, parameter
, n
);
1727 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetInt(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, INT
*n
)
1729 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1730 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1732 TRACE("iface %p, parameter %p, n %p\n", This
, parameter
, n
);
1734 if (n
&& param
&& !param
->element_count
)
1736 if (param
->columns
== 1 && param
->rows
== 1)
1738 *n
= get_int(param
->type
, param
->data
);
1739 TRACE("Returning %i\n", *n
);
1743 if (param
->type
== D3DXPT_FLOAT
&&
1744 ((param
->class == D3DXPC_VECTOR
&& param
->columns
!= 2)
1745 || (param
->class == D3DXPC_MATRIX_ROWS
&& param
->rows
!= 2 && param
->columns
== 1)))
1747 /* all components (3,4) are clamped (0,255) and put in the INT */
1748 *n
= (INT
)(min(max(0.0f
, *((FLOAT
*)param
->data
+ 2)), 1.0f
) * INT_FLOAT_MULTI
);
1749 *n
+= ((INT
)(min(max(0.0f
, *((FLOAT
*)param
->data
+ 1)), 1.0f
) * INT_FLOAT_MULTI
)) << 8;
1750 *n
+= ((INT
)(min(max(0.0f
, *((FLOAT
*)param
->data
+ 0)), 1.0f
) * INT_FLOAT_MULTI
)) << 16;
1751 if (param
->columns
* param
->rows
> 3)
1753 *n
+= ((INT
)(min(max(0.0f
, *((FLOAT
*)param
->data
+ 3)), 1.0f
) * INT_FLOAT_MULTI
)) << 24;
1756 TRACE("Returning %i\n", *n
);
1761 WARN("Invalid argument specified\n");
1763 return D3DERR_INVALIDCALL
;
1766 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetIntArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST INT
*n
, UINT count
)
1768 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1770 FIXME("iface %p, parameter %p, n %p, count %u stub\n", This
, parameter
, n
, count
);
1775 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetIntArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, INT
*n
, UINT count
)
1777 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1778 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1780 TRACE("iface %p, parameter %p, n %p, count %u\n", This
, parameter
, n
, count
);
1782 if (n
&& param
&& (param
->class == D3DXPC_SCALAR
1783 || param
->class == D3DXPC_VECTOR
1784 || param
->class == D3DXPC_MATRIX_ROWS
1785 || param
->class == D3DXPC_MATRIX_COLUMNS
))
1787 UINT i
, size
= min(count
, param
->bytes
/ sizeof(DWORD
));
1789 for (i
= 0; i
< size
; ++i
)
1791 n
[i
] = get_int(param
->type
, (DWORD
*)param
->data
+ i
);
1796 WARN("Invalid argument specified\n");
1798 return D3DERR_INVALIDCALL
;
1801 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetFloat(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, FLOAT f
)
1803 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1804 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1806 TRACE("iface %p, parameter %p, f %f\n", This
, parameter
, f
);
1808 if (param
&& !param
->element_count
&& param
->rows
== 1 && param
->columns
== 1)
1810 set_number((DWORD
*)param
->data
, param
->type
, &f
, D3DXPT_FLOAT
);
1814 WARN("Invalid argument specified\n");
1816 return D3DERR_INVALIDCALL
;
1819 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetFloat(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
)
1821 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1822 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1824 TRACE("iface %p, parameter %p, f %p\n", This
, parameter
, f
);
1826 if (f
&& param
&& !param
->element_count
&& param
->columns
== 1 && param
->rows
== 1)
1828 *f
= get_float(param
->type
, (DWORD
*)param
->data
);
1829 TRACE("Returning %f\n", *f
);
1833 WARN("Invalid argument specified\n");
1835 return D3DERR_INVALIDCALL
;
1838 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetFloatArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST FLOAT
*f
, UINT count
)
1840 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1841 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1843 TRACE("iface %p, parameter %p, f %p, count %u\n", This
, parameter
, f
, count
);
1847 UINT i
, size
= min(count
, param
->bytes
/ sizeof(DWORD
));
1849 TRACE("Class %s\n", debug_d3dxparameter_class(param
->class));
1851 switch (param
->class)
1855 case D3DXPC_MATRIX_ROWS
:
1856 for (i
= 0; i
< size
; ++i
)
1858 set_number((DWORD
*)param
->data
+ i
, param
->type
, &f
[i
], D3DXPT_FLOAT
);
1867 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
1872 WARN("Invalid argument specified\n");
1874 return D3DERR_INVALIDCALL
;
1877 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetFloatArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
, UINT count
)
1879 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1880 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1882 TRACE("iface %p, parameter %p, f %p, count %u\n", This
, parameter
, f
, count
);
1884 if (f
&& param
&& (param
->class == D3DXPC_SCALAR
1885 || param
->class == D3DXPC_VECTOR
1886 || param
->class == D3DXPC_MATRIX_ROWS
1887 || param
->class == D3DXPC_MATRIX_COLUMNS
))
1889 UINT i
, size
= min(count
, param
->bytes
/ sizeof(DWORD
));
1891 for (i
= 0; i
< size
; ++i
)
1893 f
[i
] = get_float(param
->type
, (DWORD
*)param
->data
+ i
);
1898 WARN("Invalid argument specified\n");
1900 return D3DERR_INVALIDCALL
;
1903 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetVector(ID3DXBaseEffect
* iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
* vector
)
1905 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1907 FIXME("iface %p, parameter %p, vector %p stub\n", This
, parameter
, vector
);
1912 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetVector(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
)
1914 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1916 FIXME("iface %p, parameter %p, vector %p stub\n", This
, parameter
, vector
);
1921 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetVectorArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
, UINT count
)
1923 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1925 FIXME("iface %p, parameter %p, vector %p, count %u stub\n", This
, parameter
, vector
, count
);
1930 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetVectorArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
, UINT count
)
1932 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1933 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1935 TRACE("iface %p, parameter %p, vector %p, count %u\n", This
, parameter
, vector
, count
);
1937 if (!count
) return D3D_OK
;
1939 if (vector
&& param
&& count
<= param
->element_count
)
1943 TRACE("Class %s\n", debug_d3dxparameter_class(param
->class));
1945 switch (param
->class)
1948 for (i
= 0; i
< count
; ++i
)
1950 get_vector(get_parameter_struct(param
->member_handles
[i
]), &vector
[i
]);
1955 case D3DXPC_MATRIX_ROWS
:
1961 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
1966 WARN("Invalid argument specified\n");
1968 return D3DERR_INVALIDCALL
;
1971 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrix(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
1973 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1975 FIXME("iface %p, parameter %p, matrix %p stub\n", This
, parameter
, matrix
);
1980 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrix(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
1982 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
1983 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
1985 TRACE("iface %p, parameter %p, matrix %p\n", This
, parameter
, matrix
);
1987 if (matrix
&& param
&& !param
->element_count
)
1989 TRACE("Class %s\n", debug_d3dxparameter_class(param
->class));
1991 switch (param
->class)
1993 case D3DXPC_MATRIX_ROWS
:
1994 get_matrix(param
, matrix
);
2004 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
2009 WARN("Invalid argument specified\n");
2011 return D3DERR_INVALIDCALL
;
2014 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
2016 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2018 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
2023 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
2025 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2026 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2028 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This
, parameter
, matrix
, count
);
2030 if (!count
) return D3D_OK
;
2032 if (matrix
&& param
&& count
<= param
->element_count
)
2036 TRACE("Class %s\n", debug_d3dxparameter_class(param
->class));
2038 switch (param
->class)
2040 case D3DXPC_MATRIX_ROWS
:
2041 for (i
= 0; i
< count
; ++i
)
2043 get_matrix(get_parameter_struct(param
->member_handles
[i
]), &matrix
[i
]);
2054 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
2059 WARN("Invalid argument specified\n");
2061 return D3DERR_INVALIDCALL
;
2064 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixPointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
2066 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2068 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
2073 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixPointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
2075 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2077 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
2082 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixTranspose(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
2084 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2086 FIXME("iface %p, parameter %p, matrix %p stub\n", This
, parameter
, matrix
);
2091 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixTranspose(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
2093 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2094 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2097 TRACE("iface %p, parameter %p, matrix %p\n", This
, parameter
, matrix
);
2099 if (matrix
&& param
&& !param
->element_count
)
2101 TRACE("Class %s\n", debug_d3dxparameter_class(param
->class));
2103 switch (param
->class)
2107 get_matrix(param
, matrix
);
2110 case D3DXPC_MATRIX_ROWS
:
2111 get_matrix(param
, &m
);
2112 D3DXMatrixTranspose(matrix
, &m
);
2120 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
2125 WARN("Invalid argument specified\n");
2127 return D3DERR_INVALIDCALL
;
2130 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixTransposeArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
2132 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2134 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
2139 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixTransposeArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
2141 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2142 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2144 TRACE("iface %p, parameter %p, matrix %p, count %u\n", This
, parameter
, matrix
, count
);
2146 if (!count
) return D3D_OK
;
2148 if (matrix
&& param
&& count
<= param
->element_count
)
2152 TRACE("Class %s\n", debug_d3dxparameter_class(param
->class));
2154 switch (param
->class)
2156 case D3DXPC_MATRIX_ROWS
:
2157 for (i
= 0; i
< count
; ++i
)
2161 get_matrix(get_parameter_struct(param
->member_handles
[i
]), &m
);
2162 D3DXMatrixTranspose(&matrix
[i
], &m
);
2173 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
2178 WARN("Invalid argument specified\n");
2180 return D3DERR_INVALIDCALL
;
2183 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
2185 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2187 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
2192 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
2194 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2196 FIXME("iface %p, parameter %p, matrix %p, count %u stub\n", This
, parameter
, matrix
, count
);
2201 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetString(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR string
)
2203 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2205 FIXME("iface %p, parameter %p, string %p stub\n", This
, parameter
, string
);
2210 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetString(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPCSTR
*string
)
2212 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2213 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2215 TRACE("iface %p, parameter %p, string %p\n", This
, parameter
, string
);
2217 if (string
&& param
&& !param
->element_count
&& param
->type
== D3DXPT_STRING
)
2219 *string
= *(LPCSTR
*)param
->data
;
2220 TRACE("Returning %s\n", debugstr_a(*string
));
2224 WARN("Invalid argument specified\n");
2226 return D3DERR_INVALIDCALL
;
2229 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetTexture(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9 texture
)
2231 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2232 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2234 TRACE("iface %p, parameter %p, texture %p\n", This
, parameter
, texture
);
2236 if (param
&& !param
->element_count
&&
2237 (param
->type
== D3DXPT_TEXTURE
|| param
->type
== D3DXPT_TEXTURE1D
2238 || param
->type
== D3DXPT_TEXTURE2D
|| param
->type
== D3DXPT_TEXTURE3D
2239 || param
->type
== D3DXPT_TEXTURECUBE
))
2241 LPDIRECT3DBASETEXTURE9 oltexture
= *(LPDIRECT3DBASETEXTURE9
*)param
->data
;
2243 if (texture
) IDirect3DBaseTexture9_AddRef(texture
);
2244 if (oltexture
) IDirect3DBaseTexture9_Release(oltexture
);
2246 *(LPDIRECT3DBASETEXTURE9
*)param
->data
= texture
;
2251 WARN("Invalid argument specified\n");
2253 return D3DERR_INVALIDCALL
;
2256 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetTexture(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9
*texture
)
2258 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2259 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2261 TRACE("iface %p, parameter %p, texture %p\n", This
, parameter
, texture
);
2263 if (texture
&& param
&& !param
->element_count
&&
2264 (param
->type
== D3DXPT_TEXTURE
|| param
->type
== D3DXPT_TEXTURE1D
2265 || param
->type
== D3DXPT_TEXTURE2D
|| param
->type
== D3DXPT_TEXTURE3D
2266 || param
->type
== D3DXPT_TEXTURECUBE
))
2268 *texture
= *(LPDIRECT3DBASETEXTURE9
*)param
->data
;
2269 if (*texture
) IDirect3DBaseTexture9_AddRef(*texture
);
2270 TRACE("Returning %p\n", *texture
);
2274 WARN("Invalid argument specified\n");
2276 return D3DERR_INVALIDCALL
;
2279 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetPixelShader(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DPIXELSHADER9
*pshader
)
2281 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2282 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2284 TRACE("iface %p, parameter %p, pshader %p\n", This
, parameter
, pshader
);
2286 if (pshader
&& param
&& !param
->element_count
&& param
->type
== D3DXPT_PIXELSHADER
)
2288 *pshader
= *(LPDIRECT3DPIXELSHADER9
*)param
->data
;
2289 if (*pshader
) IDirect3DPixelShader9_AddRef(*pshader
);
2290 TRACE("Returning %p\n", *pshader
);
2294 WARN("Invalid argument specified\n");
2296 return D3DERR_INVALIDCALL
;
2299 static HRESULT WINAPI
ID3DXBaseEffectImpl_GetVertexShader(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DVERTEXSHADER9
*vshader
)
2301 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2302 struct d3dx_parameter
*param
= get_valid_parameter(This
, parameter
);
2304 TRACE("iface %p, parameter %p, vshader %p\n", This
, parameter
, vshader
);
2306 if (vshader
&& param
&& !param
->element_count
&& param
->type
== D3DXPT_VERTEXSHADER
)
2308 *vshader
= *(LPDIRECT3DVERTEXSHADER9
*)param
->data
;
2309 if (*vshader
) IDirect3DVertexShader9_AddRef(*vshader
);
2310 TRACE("Returning %p\n", *vshader
);
2314 WARN("Invalid argument specified\n");
2316 return D3DERR_INVALIDCALL
;
2319 static HRESULT WINAPI
ID3DXBaseEffectImpl_SetArrayRange(ID3DXBaseEffect
*iface
, D3DXHANDLE parameter
, UINT start
, UINT end
)
2321 struct ID3DXBaseEffectImpl
*This
= impl_from_ID3DXBaseEffect(iface
);
2323 FIXME("iface %p, parameter %p, start %u, end %u stub\n", This
, parameter
, start
, end
);
2328 static const struct ID3DXBaseEffectVtbl ID3DXBaseEffect_Vtbl
=
2330 /*** IUnknown methods ***/
2331 ID3DXBaseEffectImpl_QueryInterface
,
2332 ID3DXBaseEffectImpl_AddRef
,
2333 ID3DXBaseEffectImpl_Release
,
2334 /*** ID3DXBaseEffect methods ***/
2335 ID3DXBaseEffectImpl_GetDesc
,
2336 ID3DXBaseEffectImpl_GetParameterDesc
,
2337 ID3DXBaseEffectImpl_GetTechniqueDesc
,
2338 ID3DXBaseEffectImpl_GetPassDesc
,
2339 ID3DXBaseEffectImpl_GetFunctionDesc
,
2340 ID3DXBaseEffectImpl_GetParameter
,
2341 ID3DXBaseEffectImpl_GetParameterByName
,
2342 ID3DXBaseEffectImpl_GetParameterBySemantic
,
2343 ID3DXBaseEffectImpl_GetParameterElement
,
2344 ID3DXBaseEffectImpl_GetTechnique
,
2345 ID3DXBaseEffectImpl_GetTechniqueByName
,
2346 ID3DXBaseEffectImpl_GetPass
,
2347 ID3DXBaseEffectImpl_GetPassByName
,
2348 ID3DXBaseEffectImpl_GetFunction
,
2349 ID3DXBaseEffectImpl_GetFunctionByName
,
2350 ID3DXBaseEffectImpl_GetAnnotation
,
2351 ID3DXBaseEffectImpl_GetAnnotationByName
,
2352 ID3DXBaseEffectImpl_SetValue
,
2353 ID3DXBaseEffectImpl_GetValue
,
2354 ID3DXBaseEffectImpl_SetBool
,
2355 ID3DXBaseEffectImpl_GetBool
,
2356 ID3DXBaseEffectImpl_SetBoolArray
,
2357 ID3DXBaseEffectImpl_GetBoolArray
,
2358 ID3DXBaseEffectImpl_SetInt
,
2359 ID3DXBaseEffectImpl_GetInt
,
2360 ID3DXBaseEffectImpl_SetIntArray
,
2361 ID3DXBaseEffectImpl_GetIntArray
,
2362 ID3DXBaseEffectImpl_SetFloat
,
2363 ID3DXBaseEffectImpl_GetFloat
,
2364 ID3DXBaseEffectImpl_SetFloatArray
,
2365 ID3DXBaseEffectImpl_GetFloatArray
,
2366 ID3DXBaseEffectImpl_SetVector
,
2367 ID3DXBaseEffectImpl_GetVector
,
2368 ID3DXBaseEffectImpl_SetVectorArray
,
2369 ID3DXBaseEffectImpl_GetVectorArray
,
2370 ID3DXBaseEffectImpl_SetMatrix
,
2371 ID3DXBaseEffectImpl_GetMatrix
,
2372 ID3DXBaseEffectImpl_SetMatrixArray
,
2373 ID3DXBaseEffectImpl_GetMatrixArray
,
2374 ID3DXBaseEffectImpl_SetMatrixPointerArray
,
2375 ID3DXBaseEffectImpl_GetMatrixPointerArray
,
2376 ID3DXBaseEffectImpl_SetMatrixTranspose
,
2377 ID3DXBaseEffectImpl_GetMatrixTranspose
,
2378 ID3DXBaseEffectImpl_SetMatrixTransposeArray
,
2379 ID3DXBaseEffectImpl_GetMatrixTransposeArray
,
2380 ID3DXBaseEffectImpl_SetMatrixTransposePointerArray
,
2381 ID3DXBaseEffectImpl_GetMatrixTransposePointerArray
,
2382 ID3DXBaseEffectImpl_SetString
,
2383 ID3DXBaseEffectImpl_GetString
,
2384 ID3DXBaseEffectImpl_SetTexture
,
2385 ID3DXBaseEffectImpl_GetTexture
,
2386 ID3DXBaseEffectImpl_GetPixelShader
,
2387 ID3DXBaseEffectImpl_GetVertexShader
,
2388 ID3DXBaseEffectImpl_SetArrayRange
,
2391 static inline struct ID3DXEffectImpl
*impl_from_ID3DXEffect(ID3DXEffect
*iface
)
2393 return CONTAINING_RECORD(iface
, struct ID3DXEffectImpl
, ID3DXEffect_iface
);
2396 /*** IUnknown methods ***/
2397 static HRESULT WINAPI
ID3DXEffectImpl_QueryInterface(ID3DXEffect
*iface
, REFIID riid
, void **object
)
2399 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2401 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), object
);
2403 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
2404 IsEqualGUID(riid
, &IID_ID3DXEffect
))
2406 This
->ID3DXEffect_iface
.lpVtbl
->AddRef(iface
);
2411 ERR("Interface %s not found\n", debugstr_guid(riid
));
2413 return E_NOINTERFACE
;
2416 static ULONG WINAPI
ID3DXEffectImpl_AddRef(ID3DXEffect
*iface
)
2418 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2420 TRACE("(%p)->(): AddRef from %u\n", This
, This
->ref
);
2422 return InterlockedIncrement(&This
->ref
);
2425 static ULONG WINAPI
ID3DXEffectImpl_Release(ID3DXEffect
*iface
)
2427 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2428 ULONG ref
= InterlockedDecrement(&This
->ref
);
2430 TRACE("(%p)->(): Release from %u\n", This
, ref
+ 1);
2435 HeapFree(GetProcessHeap(), 0, This
);
2441 /*** ID3DXBaseEffect methods ***/
2442 static HRESULT WINAPI
ID3DXEffectImpl_GetDesc(ID3DXEffect
*iface
, D3DXEFFECT_DESC
*desc
)
2444 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2445 ID3DXBaseEffect
*base
= This
->base_effect
;
2447 TRACE("Forward iface %p, base %p\n", This
, base
);
2449 return ID3DXBaseEffectImpl_GetDesc(base
, desc
);
2452 static HRESULT WINAPI
ID3DXEffectImpl_GetParameterDesc(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXPARAMETER_DESC
*desc
)
2454 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2455 ID3DXBaseEffect
*base
= This
->base_effect
;
2457 TRACE("Forward iface %p, base %p\n", This
, base
);
2459 return ID3DXBaseEffectImpl_GetParameterDesc(base
, parameter
, desc
);
2462 static HRESULT WINAPI
ID3DXEffectImpl_GetTechniqueDesc(ID3DXEffect
*iface
, D3DXHANDLE technique
, D3DXTECHNIQUE_DESC
*desc
)
2464 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2465 ID3DXBaseEffect
*base
= This
->base_effect
;
2467 TRACE("Forward iface %p, base %p\n", This
, base
);
2469 return ID3DXBaseEffectImpl_GetTechniqueDesc(base
, technique
, desc
);
2472 static HRESULT WINAPI
ID3DXEffectImpl_GetPassDesc(ID3DXEffect
*iface
, D3DXHANDLE pass
, D3DXPASS_DESC
*desc
)
2474 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2475 ID3DXBaseEffect
*base
= This
->base_effect
;
2477 TRACE("Forward iface %p, base %p\n", This
, base
);
2479 return ID3DXBaseEffectImpl_GetPassDesc(base
, pass
, desc
);
2482 static HRESULT WINAPI
ID3DXEffectImpl_GetFunctionDesc(ID3DXEffect
*iface
, D3DXHANDLE shader
, D3DXFUNCTION_DESC
*desc
)
2484 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2485 ID3DXBaseEffect
*base
= This
->base_effect
;
2487 TRACE("Forward iface %p, base %p\n", This
, base
);
2489 return ID3DXBaseEffectImpl_GetFunctionDesc(base
, shader
, desc
);
2492 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameter(ID3DXEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
2494 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2495 ID3DXBaseEffect
*base
= This
->base_effect
;
2497 TRACE("Forward iface %p, base %p\n", This
, base
);
2499 return ID3DXBaseEffectImpl_GetParameter(base
, parameter
, index
);
2502 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameterByName(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR name
)
2504 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2505 ID3DXBaseEffect
*base
= This
->base_effect
;
2507 TRACE("Forward iface %p, base %p\n", This
, base
);
2509 return ID3DXBaseEffectImpl_GetParameterByName(base
, parameter
, name
);
2512 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameterBySemantic(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR semantic
)
2514 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2515 ID3DXBaseEffect
*base
= This
->base_effect
;
2517 TRACE("Forward iface %p, base %p\n", This
, base
);
2519 return ID3DXBaseEffectImpl_GetParameterBySemantic(base
, parameter
, semantic
);
2522 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetParameterElement(ID3DXEffect
*iface
, D3DXHANDLE parameter
, UINT index
)
2524 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2525 ID3DXBaseEffect
*base
= This
->base_effect
;
2527 TRACE("Forward iface %p, base %p\n", This
, base
);
2529 return ID3DXBaseEffectImpl_GetParameterElement(base
, parameter
, index
);
2532 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetTechnique(ID3DXEffect
*iface
, UINT index
)
2534 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2535 ID3DXBaseEffect
*base
= This
->base_effect
;
2537 TRACE("Forward iface %p, base %p\n", This
, base
);
2539 return ID3DXBaseEffectImpl_GetTechnique(base
, index
);
2542 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetTechniqueByName(ID3DXEffect
*iface
, LPCSTR name
)
2544 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2545 ID3DXBaseEffect
*base
= This
->base_effect
;
2547 TRACE("Forward iface %p, base %p\n", This
, base
);
2549 return ID3DXBaseEffectImpl_GetTechniqueByName(base
, name
);
2552 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetPass(ID3DXEffect
*iface
, D3DXHANDLE technique
, UINT index
)
2554 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2555 ID3DXBaseEffect
*base
= This
->base_effect
;
2557 TRACE("Forward iface %p, base %p\n", This
, base
);
2559 return ID3DXBaseEffectImpl_GetPass(base
, technique
, index
);
2562 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetPassByName(ID3DXEffect
*iface
, D3DXHANDLE technique
, LPCSTR name
)
2564 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2565 ID3DXBaseEffect
*base
= This
->base_effect
;
2567 TRACE("Forward iface %p, base %p\n", This
, base
);
2569 return ID3DXBaseEffectImpl_GetPassByName(base
, technique
, name
);
2572 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetFunction(ID3DXEffect
*iface
, UINT index
)
2574 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2575 ID3DXBaseEffect
*base
= This
->base_effect
;
2577 TRACE("Forward iface %p, base %p\n", This
, base
);
2579 return ID3DXBaseEffectImpl_GetFunction(base
, index
);
2582 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetFunctionByName(ID3DXEffect
*iface
, LPCSTR name
)
2584 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2585 ID3DXBaseEffect
*base
= This
->base_effect
;
2587 TRACE("Forward iface %p, base %p\n", This
, base
);
2589 return ID3DXBaseEffectImpl_GetFunctionByName(base
, name
);
2592 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetAnnotation(ID3DXEffect
*iface
, D3DXHANDLE object
, UINT index
)
2594 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2595 ID3DXBaseEffect
*base
= This
->base_effect
;
2597 TRACE("Forward iface %p, base %p\n", This
, base
);
2599 return ID3DXBaseEffectImpl_GetAnnotation(base
, object
, index
);
2602 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetAnnotationByName(ID3DXEffect
*iface
, D3DXHANDLE object
, LPCSTR name
)
2604 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2605 ID3DXBaseEffect
*base
= This
->base_effect
;
2607 TRACE("Forward iface %p, base %p\n", This
, base
);
2609 return ID3DXBaseEffectImpl_GetAnnotationByName(base
, object
, name
);
2612 static HRESULT WINAPI
ID3DXEffectImpl_SetValue(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT bytes
)
2614 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2615 ID3DXBaseEffect
*base
= This
->base_effect
;
2617 TRACE("Forward iface %p, base %p\n", This
, base
);
2619 return ID3DXBaseEffectImpl_SetValue(base
, parameter
, data
, bytes
);
2622 static HRESULT WINAPI
ID3DXEffectImpl_GetValue(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPVOID data
, UINT bytes
)
2624 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2625 ID3DXBaseEffect
*base
= This
->base_effect
;
2627 TRACE("Forward iface %p, base %p\n", This
, base
);
2629 return ID3DXBaseEffectImpl_GetValue(base
, parameter
, data
, bytes
);
2632 static HRESULT WINAPI
ID3DXEffectImpl_SetBool(ID3DXEffect
*iface
, D3DXHANDLE parameter
, BOOL b
)
2634 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2635 ID3DXBaseEffect
*base
= This
->base_effect
;
2637 TRACE("Forward iface %p, base %p\n", This
, base
);
2639 return ID3DXBaseEffectImpl_SetBool(base
, parameter
, b
);
2642 static HRESULT WINAPI
ID3DXEffectImpl_GetBool(ID3DXEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
)
2644 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2645 ID3DXBaseEffect
*base
= This
->base_effect
;
2647 TRACE("Forward iface %p, base %p\n", This
, base
);
2649 return ID3DXBaseEffectImpl_GetBool(base
, parameter
, b
);
2652 static HRESULT WINAPI
ID3DXEffectImpl_SetBoolArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST BOOL
*b
, UINT count
)
2654 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2655 ID3DXBaseEffect
*base
= This
->base_effect
;
2657 TRACE("Forward iface %p, base %p\n", This
, base
);
2659 return ID3DXBaseEffectImpl_SetBoolArray(base
, parameter
, b
, count
);
2662 static HRESULT WINAPI
ID3DXEffectImpl_GetBoolArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, BOOL
*b
, UINT count
)
2664 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2665 ID3DXBaseEffect
*base
= This
->base_effect
;
2667 TRACE("Forward iface %p, base %p\n", This
, base
);
2669 return ID3DXBaseEffectImpl_GetBoolArray(base
, parameter
, b
, count
);
2672 static HRESULT WINAPI
ID3DXEffectImpl_SetInt(ID3DXEffect
*iface
, D3DXHANDLE parameter
, INT n
)
2674 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2675 ID3DXBaseEffect
*base
= This
->base_effect
;
2677 TRACE("Forward iface %p, base %p\n", This
, base
);
2679 return ID3DXBaseEffectImpl_SetInt(base
, parameter
, n
);
2682 static HRESULT WINAPI
ID3DXEffectImpl_GetInt(ID3DXEffect
*iface
, D3DXHANDLE parameter
, INT
*n
)
2684 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2685 ID3DXBaseEffect
*base
= This
->base_effect
;
2687 TRACE("Forward iface %p, base %p\n", This
, base
);
2689 return ID3DXBaseEffectImpl_GetInt(base
, parameter
, n
);
2692 static HRESULT WINAPI
ID3DXEffectImpl_SetIntArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST INT
*n
, UINT count
)
2694 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2695 ID3DXBaseEffect
*base
= This
->base_effect
;
2697 TRACE("Forward iface %p, base %p\n", This
, base
);
2699 return ID3DXBaseEffectImpl_SetIntArray(base
, parameter
, n
, count
);
2702 static HRESULT WINAPI
ID3DXEffectImpl_GetIntArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, INT
*n
, UINT count
)
2704 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2705 ID3DXBaseEffect
*base
= This
->base_effect
;
2707 TRACE("Forward iface %p, base %p\n", This
, base
);
2709 return ID3DXBaseEffectImpl_GetIntArray(base
, parameter
, n
, count
);
2712 static HRESULT WINAPI
ID3DXEffectImpl_SetFloat(ID3DXEffect
*iface
, D3DXHANDLE parameter
, FLOAT f
)
2714 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2715 ID3DXBaseEffect
*base
= This
->base_effect
;
2717 TRACE("Forward iface %p, base %p\n", This
, base
);
2719 return ID3DXBaseEffectImpl_SetFloat(base
, parameter
, f
);
2722 static HRESULT WINAPI
ID3DXEffectImpl_GetFloat(ID3DXEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
)
2724 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2725 ID3DXBaseEffect
*base
= This
->base_effect
;
2727 TRACE("Forward iface %p, base %p\n", This
, base
);
2729 return ID3DXBaseEffectImpl_GetFloat(base
, parameter
, f
);
2732 static HRESULT WINAPI
ID3DXEffectImpl_SetFloatArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST FLOAT
*f
, UINT count
)
2734 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2735 ID3DXBaseEffect
*base
= This
->base_effect
;
2737 TRACE("Forward iface %p, base %p\n", This
, base
);
2739 return ID3DXBaseEffectImpl_SetFloatArray(base
, parameter
, f
, count
);
2742 static HRESULT WINAPI
ID3DXEffectImpl_GetFloatArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, FLOAT
*f
, UINT count
)
2744 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2745 ID3DXBaseEffect
*base
= This
->base_effect
;
2747 TRACE("Forward iface %p, base %p\n", This
, base
);
2749 return ID3DXBaseEffectImpl_GetFloatArray(base
, parameter
, f
, count
);
2752 static HRESULT WINAPI
ID3DXEffectImpl_SetVector(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
)
2754 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2755 ID3DXBaseEffect
*base
= This
->base_effect
;
2757 TRACE("Forward iface %p, base %p\n", This
, base
);
2759 return ID3DXBaseEffectImpl_SetVector(base
, parameter
, vector
);
2762 static HRESULT WINAPI
ID3DXEffectImpl_GetVector(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
)
2764 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2765 ID3DXBaseEffect
*base
= This
->base_effect
;
2767 TRACE("Forward iface %p, base %p\n", This
, base
);
2769 return ID3DXBaseEffectImpl_GetVector(base
, parameter
, vector
);
2772 static HRESULT WINAPI
ID3DXEffectImpl_SetVectorArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
, UINT count
)
2774 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2775 ID3DXBaseEffect
*base
= This
->base_effect
;
2777 TRACE("Forward iface %p, base %p\n", This
, base
);
2779 return ID3DXBaseEffectImpl_SetVectorArray(base
, parameter
, vector
, count
);
2782 static HRESULT WINAPI
ID3DXEffectImpl_GetVectorArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
, UINT count
)
2784 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2785 ID3DXBaseEffect
*base
= This
->base_effect
;
2787 TRACE("Forward iface %p, base %p\n", This
, base
);
2789 return ID3DXBaseEffectImpl_GetVectorArray(base
, parameter
, vector
, count
);
2792 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrix(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
2794 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2795 ID3DXBaseEffect
*base
= This
->base_effect
;
2797 TRACE("Forward iface %p, base %p\n", This
, base
);
2799 return ID3DXBaseEffectImpl_SetMatrix(base
, parameter
, matrix
);
2802 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrix(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
2804 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2805 ID3DXBaseEffect
*base
= This
->base_effect
;
2807 TRACE("Forward iface %p, base %p\n", This
, base
);
2809 return ID3DXBaseEffectImpl_GetMatrix(base
, parameter
, matrix
);
2812 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
2814 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2815 ID3DXBaseEffect
*base
= This
->base_effect
;
2817 TRACE("Forward iface %p, base %p\n", This
, base
);
2819 return ID3DXBaseEffectImpl_SetMatrixArray(base
, parameter
, matrix
, count
);
2822 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
2824 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2825 ID3DXBaseEffect
*base
= This
->base_effect
;
2827 TRACE("Forward iface %p, base %p\n", This
, base
);
2829 return ID3DXBaseEffectImpl_GetMatrixArray(base
, parameter
, matrix
, count
);
2832 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixPointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
2834 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2835 ID3DXBaseEffect
*base
= This
->base_effect
;
2837 TRACE("Forward iface %p, base %p\n", This
, base
);
2839 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base
, parameter
, matrix
, count
);
2842 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixPointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
2844 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2845 ID3DXBaseEffect
*base
= This
->base_effect
;
2847 TRACE("Forward iface %p, base %p\n", This
, base
);
2849 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base
, parameter
, matrix
, count
);
2852 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixTranspose(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
2854 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2855 ID3DXBaseEffect
*base
= This
->base_effect
;
2857 TRACE("Forward iface %p, base %p\n", This
, base
);
2859 return ID3DXBaseEffectImpl_SetMatrixTranspose(base
, parameter
, matrix
);
2862 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixTranspose(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
2864 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2865 ID3DXBaseEffect
*base
= This
->base_effect
;
2867 TRACE("Forward iface %p, base %p\n", This
, base
);
2869 return ID3DXBaseEffectImpl_GetMatrixTranspose(base
, parameter
, matrix
);
2872 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixTransposeArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
2874 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2875 ID3DXBaseEffect
*base
= This
->base_effect
;
2877 TRACE("Forward iface %p, base %p\n", This
, base
);
2879 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base
, parameter
, matrix
, count
);
2882 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixTransposeArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
2884 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2885 ID3DXBaseEffect
*base
= This
->base_effect
;
2887 TRACE("Forward iface %p, base %p\n", This
, base
);
2889 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base
, parameter
, matrix
, count
);
2892 static HRESULT WINAPI
ID3DXEffectImpl_SetMatrixTransposePointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
2894 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2895 ID3DXBaseEffect
*base
= This
->base_effect
;
2897 TRACE("Forward iface %p, base %p\n", This
, base
);
2899 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
2902 static HRESULT WINAPI
ID3DXEffectImpl_GetMatrixTransposePointerArray(ID3DXEffect
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
2904 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2905 ID3DXBaseEffect
*base
= This
->base_effect
;
2907 TRACE("Forward iface %p, base %p\n", This
, base
);
2909 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
2912 static HRESULT WINAPI
ID3DXEffectImpl_SetString(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR string
)
2914 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2915 ID3DXBaseEffect
*base
= This
->base_effect
;
2917 TRACE("Forward iface %p, base %p\n", This
, base
);
2919 return ID3DXBaseEffectImpl_SetString(base
, parameter
, string
);
2922 static HRESULT WINAPI
ID3DXEffectImpl_GetString(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPCSTR
*string
)
2924 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2925 ID3DXBaseEffect
*base
= This
->base_effect
;
2927 TRACE("Forward iface %p, base %p\n", This
, base
);
2929 return ID3DXBaseEffectImpl_GetString(base
, parameter
, string
);
2932 static HRESULT WINAPI
ID3DXEffectImpl_SetTexture(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9 texture
)
2934 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2935 ID3DXBaseEffect
*base
= This
->base_effect
;
2937 TRACE("Forward iface %p, base %p\n", This
, base
);
2939 return ID3DXBaseEffectImpl_SetTexture(base
, parameter
, texture
);
2942 static HRESULT WINAPI
ID3DXEffectImpl_GetTexture(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9
*texture
)
2944 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2945 ID3DXBaseEffect
*base
= This
->base_effect
;
2947 TRACE("Forward iface %p, base %p\n", This
, base
);
2949 return ID3DXBaseEffectImpl_GetTexture(base
, parameter
, texture
);
2952 static HRESULT WINAPI
ID3DXEffectImpl_GetPixelShader(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DPIXELSHADER9
*pshader
)
2954 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2955 ID3DXBaseEffect
*base
= This
->base_effect
;
2957 TRACE("Forward iface %p, base %p\n", This
, base
);
2959 return ID3DXBaseEffectImpl_GetPixelShader(base
, parameter
, pshader
);
2962 static HRESULT WINAPI
ID3DXEffectImpl_GetVertexShader(ID3DXEffect
*iface
, D3DXHANDLE parameter
, LPDIRECT3DVERTEXSHADER9
*vshader
)
2964 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2965 ID3DXBaseEffect
*base
= This
->base_effect
;
2967 TRACE("Forward iface %p, base %p\n", This
, base
);
2969 return ID3DXBaseEffectImpl_GetVertexShader(base
, parameter
, vshader
);
2972 static HRESULT WINAPI
ID3DXEffectImpl_SetArrayRange(ID3DXEffect
*iface
, D3DXHANDLE parameter
, UINT start
, UINT end
)
2974 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2975 ID3DXBaseEffect
*base
= This
->base_effect
;
2977 TRACE("Forward iface %p, base %p\n", This
, base
);
2979 return ID3DXBaseEffectImpl_SetArrayRange(base
, parameter
, start
, end
);
2982 /*** ID3DXEffect methods ***/
2983 static HRESULT WINAPI
ID3DXEffectImpl_GetPool(ID3DXEffect
*iface
, LPD3DXEFFECTPOOL
*pool
)
2985 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
2987 TRACE("iface %p, pool %p\n", This
, pool
);
2991 WARN("Invalid argument supplied.\n");
2992 return D3DERR_INVALIDCALL
;
2997 This
->pool
->lpVtbl
->AddRef(This
->pool
);
3002 TRACE("Returning pool %p\n", *pool
);
3007 static HRESULT WINAPI
ID3DXEffectImpl_SetTechnique(ID3DXEffect
*iface
, D3DXHANDLE technique
)
3009 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3010 struct ID3DXBaseEffectImpl
*base
= impl_from_ID3DXBaseEffect(This
->base_effect
);
3011 struct d3dx_technique
*tech
= is_valid_technique(base
, technique
);
3013 TRACE("iface %p, technique %p\n", This
, technique
);
3015 if (!tech
) tech
= get_technique_struct(iface
->lpVtbl
->GetTechniqueByName(iface
, technique
));
3021 for (i
= 0; i
< base
->technique_count
; ++i
)
3023 struct d3dx_technique
*t
= get_technique_struct(base
->technique_handles
[i
]);
3027 This
->active_technique
= get_technique_handle(t
);
3028 TRACE("Technique %u (%p)\n", i
, tech
);
3034 WARN("Invalid argument supplied.\n");
3036 return D3DERR_INVALIDCALL
;
3039 static D3DXHANDLE WINAPI
ID3DXEffectImpl_GetCurrentTechnique(ID3DXEffect
*iface
)
3041 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3043 TRACE("iface %p\n", This
);
3045 return This
->active_technique
;
3048 static HRESULT WINAPI
ID3DXEffectImpl_ValidateTechnique(ID3DXEffect
* iface
, D3DXHANDLE technique
)
3050 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3052 FIXME("(%p)->(%p): stub\n", This
, technique
);
3057 static HRESULT WINAPI
ID3DXEffectImpl_FindNextValidTechnique(ID3DXEffect
* iface
, D3DXHANDLE technique
, D3DXHANDLE
* next_technique
)
3059 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3061 FIXME("(%p)->(%p, %p): stub\n", This
, technique
, next_technique
);
3066 static BOOL WINAPI
ID3DXEffectImpl_IsParameterUsed(ID3DXEffect
* iface
, D3DXHANDLE parameter
, D3DXHANDLE technique
)
3068 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3070 FIXME("(%p)->(%p, %p): stub\n", This
, parameter
, technique
);
3075 static HRESULT WINAPI
ID3DXEffectImpl_Begin(ID3DXEffect
*iface
, UINT
*passes
, DWORD flags
)
3077 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3078 struct d3dx_technique
*technique
= get_technique_struct(This
->active_technique
);
3080 FIXME("iface %p, passes %p, flags %#x partial stub\n", This
, passes
, flags
);
3082 if (passes
&& technique
)
3084 if (This
->manager
|| flags
& D3DXFX_DONOTSAVESTATE
)
3086 TRACE("State capturing disabled.\n");
3090 FIXME("State capturing not supported, yet!\n");
3093 *passes
= technique
->pass_count
;
3098 WARN("Invalid argument supplied.\n");
3100 return D3DERR_INVALIDCALL
;
3103 static HRESULT WINAPI
ID3DXEffectImpl_BeginPass(ID3DXEffect
*iface
, UINT pass
)
3105 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3106 struct d3dx_technique
*technique
= get_technique_struct(This
->active_technique
);
3108 TRACE("iface %p, pass %u\n", This
, pass
);
3110 if (technique
&& pass
< technique
->pass_count
&& !This
->active_pass
)
3112 This
->active_pass
= technique
->pass_handles
[pass
];
3114 FIXME("No states applied, yet!\n");
3119 WARN("Invalid argument supplied.\n");
3121 return D3DERR_INVALIDCALL
;
3124 static HRESULT WINAPI
ID3DXEffectImpl_CommitChanges(ID3DXEffect
* iface
)
3126 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3128 FIXME("(%p)->(): stub\n", This
);
3133 static HRESULT WINAPI
ID3DXEffectImpl_EndPass(ID3DXEffect
*iface
)
3135 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3137 TRACE("iface %p\n", This
);
3139 if (This
->active_pass
)
3141 This
->active_pass
= NULL
;
3145 WARN("Invalid call.\n");
3147 return D3DERR_INVALIDCALL
;
3150 static HRESULT WINAPI
ID3DXEffectImpl_End(ID3DXEffect
* iface
)
3152 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3154 FIXME("(%p)->(): stub\n", This
);
3159 static HRESULT WINAPI
ID3DXEffectImpl_GetDevice(ID3DXEffect
*iface
, LPDIRECT3DDEVICE9
*device
)
3161 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3163 TRACE("iface %p, device %p\n", This
, device
);
3167 WARN("Invalid argument supplied.\n");
3168 return D3DERR_INVALIDCALL
;
3171 IDirect3DDevice9_AddRef(This
->device
);
3173 *device
= This
->device
;
3175 TRACE("Returning device %p\n", *device
);
3180 static HRESULT WINAPI
ID3DXEffectImpl_OnLostDevice(ID3DXEffect
* iface
)
3182 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3184 FIXME("(%p)->(): stub\n", This
);
3189 static HRESULT WINAPI
ID3DXEffectImpl_OnResetDevice(ID3DXEffect
* iface
)
3191 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3193 FIXME("(%p)->(): stub\n", This
);
3198 static HRESULT WINAPI
ID3DXEffectImpl_SetStateManager(ID3DXEffect
*iface
, LPD3DXEFFECTSTATEMANAGER manager
)
3200 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3202 TRACE("iface %p, manager %p\n", This
, manager
);
3204 if (manager
) IUnknown_AddRef(manager
);
3205 if (This
->manager
) IUnknown_Release(This
->manager
);
3207 This
->manager
= manager
;
3212 static HRESULT WINAPI
ID3DXEffectImpl_GetStateManager(ID3DXEffect
*iface
, LPD3DXEFFECTSTATEMANAGER
*manager
)
3214 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3216 TRACE("iface %p, manager %p\n", This
, manager
);
3220 WARN("Invalid argument supplied.\n");
3221 return D3DERR_INVALIDCALL
;
3224 if (This
->manager
) IUnknown_AddRef(This
->manager
);
3225 *manager
= This
->manager
;
3230 static HRESULT WINAPI
ID3DXEffectImpl_BeginParameterBlock(ID3DXEffect
* iface
)
3232 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3234 FIXME("(%p)->(): stub\n", This
);
3239 static D3DXHANDLE WINAPI
ID3DXEffectImpl_EndParameterBlock(ID3DXEffect
* iface
)
3241 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3243 FIXME("(%p)->(): stub\n", This
);
3248 static HRESULT WINAPI
ID3DXEffectImpl_ApplyParameterBlock(ID3DXEffect
* iface
, D3DXHANDLE parameter_block
)
3250 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3252 FIXME("(%p)->(%p): stub\n", This
, parameter_block
);
3257 static HRESULT WINAPI
ID3DXEffectImpl_DeleteParameterBlock(ID3DXEffect
* iface
, D3DXHANDLE parameter_block
)
3259 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3261 FIXME("(%p)->(%p): stub\n", This
, parameter_block
);
3266 static HRESULT WINAPI
ID3DXEffectImpl_CloneEffect(ID3DXEffect
* iface
, LPDIRECT3DDEVICE9 device
, LPD3DXEFFECT
* effect
)
3268 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3270 FIXME("(%p)->(%p, %p): stub\n", This
, device
, effect
);
3275 static HRESULT WINAPI
ID3DXEffectImpl_SetRawValue(ID3DXEffect
* iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT byte_offset
, UINT bytes
)
3277 struct ID3DXEffectImpl
*This
= impl_from_ID3DXEffect(iface
);
3279 FIXME("(%p)->(%p, %p, %u, %u): stub\n", This
, parameter
, data
, byte_offset
, bytes
);
3284 static const struct ID3DXEffectVtbl ID3DXEffect_Vtbl
=
3286 /*** IUnknown methods ***/
3287 ID3DXEffectImpl_QueryInterface
,
3288 ID3DXEffectImpl_AddRef
,
3289 ID3DXEffectImpl_Release
,
3290 /*** ID3DXBaseEffect methods ***/
3291 ID3DXEffectImpl_GetDesc
,
3292 ID3DXEffectImpl_GetParameterDesc
,
3293 ID3DXEffectImpl_GetTechniqueDesc
,
3294 ID3DXEffectImpl_GetPassDesc
,
3295 ID3DXEffectImpl_GetFunctionDesc
,
3296 ID3DXEffectImpl_GetParameter
,
3297 ID3DXEffectImpl_GetParameterByName
,
3298 ID3DXEffectImpl_GetParameterBySemantic
,
3299 ID3DXEffectImpl_GetParameterElement
,
3300 ID3DXEffectImpl_GetTechnique
,
3301 ID3DXEffectImpl_GetTechniqueByName
,
3302 ID3DXEffectImpl_GetPass
,
3303 ID3DXEffectImpl_GetPassByName
,
3304 ID3DXEffectImpl_GetFunction
,
3305 ID3DXEffectImpl_GetFunctionByName
,
3306 ID3DXEffectImpl_GetAnnotation
,
3307 ID3DXEffectImpl_GetAnnotationByName
,
3308 ID3DXEffectImpl_SetValue
,
3309 ID3DXEffectImpl_GetValue
,
3310 ID3DXEffectImpl_SetBool
,
3311 ID3DXEffectImpl_GetBool
,
3312 ID3DXEffectImpl_SetBoolArray
,
3313 ID3DXEffectImpl_GetBoolArray
,
3314 ID3DXEffectImpl_SetInt
,
3315 ID3DXEffectImpl_GetInt
,
3316 ID3DXEffectImpl_SetIntArray
,
3317 ID3DXEffectImpl_GetIntArray
,
3318 ID3DXEffectImpl_SetFloat
,
3319 ID3DXEffectImpl_GetFloat
,
3320 ID3DXEffectImpl_SetFloatArray
,
3321 ID3DXEffectImpl_GetFloatArray
,
3322 ID3DXEffectImpl_SetVector
,
3323 ID3DXEffectImpl_GetVector
,
3324 ID3DXEffectImpl_SetVectorArray
,
3325 ID3DXEffectImpl_GetVectorArray
,
3326 ID3DXEffectImpl_SetMatrix
,
3327 ID3DXEffectImpl_GetMatrix
,
3328 ID3DXEffectImpl_SetMatrixArray
,
3329 ID3DXEffectImpl_GetMatrixArray
,
3330 ID3DXEffectImpl_SetMatrixPointerArray
,
3331 ID3DXEffectImpl_GetMatrixPointerArray
,
3332 ID3DXEffectImpl_SetMatrixTranspose
,
3333 ID3DXEffectImpl_GetMatrixTranspose
,
3334 ID3DXEffectImpl_SetMatrixTransposeArray
,
3335 ID3DXEffectImpl_GetMatrixTransposeArray
,
3336 ID3DXEffectImpl_SetMatrixTransposePointerArray
,
3337 ID3DXEffectImpl_GetMatrixTransposePointerArray
,
3338 ID3DXEffectImpl_SetString
,
3339 ID3DXEffectImpl_GetString
,
3340 ID3DXEffectImpl_SetTexture
,
3341 ID3DXEffectImpl_GetTexture
,
3342 ID3DXEffectImpl_GetPixelShader
,
3343 ID3DXEffectImpl_GetVertexShader
,
3344 ID3DXEffectImpl_SetArrayRange
,
3345 /*** ID3DXEffect methods ***/
3346 ID3DXEffectImpl_GetPool
,
3347 ID3DXEffectImpl_SetTechnique
,
3348 ID3DXEffectImpl_GetCurrentTechnique
,
3349 ID3DXEffectImpl_ValidateTechnique
,
3350 ID3DXEffectImpl_FindNextValidTechnique
,
3351 ID3DXEffectImpl_IsParameterUsed
,
3352 ID3DXEffectImpl_Begin
,
3353 ID3DXEffectImpl_BeginPass
,
3354 ID3DXEffectImpl_CommitChanges
,
3355 ID3DXEffectImpl_EndPass
,
3356 ID3DXEffectImpl_End
,
3357 ID3DXEffectImpl_GetDevice
,
3358 ID3DXEffectImpl_OnLostDevice
,
3359 ID3DXEffectImpl_OnResetDevice
,
3360 ID3DXEffectImpl_SetStateManager
,
3361 ID3DXEffectImpl_GetStateManager
,
3362 ID3DXEffectImpl_BeginParameterBlock
,
3363 ID3DXEffectImpl_EndParameterBlock
,
3364 ID3DXEffectImpl_ApplyParameterBlock
,
3365 ID3DXEffectImpl_DeleteParameterBlock
,
3366 ID3DXEffectImpl_CloneEffect
,
3367 ID3DXEffectImpl_SetRawValue
3370 static inline struct ID3DXEffectCompilerImpl
*impl_from_ID3DXEffectCompiler(ID3DXEffectCompiler
*iface
)
3372 return CONTAINING_RECORD(iface
, struct ID3DXEffectCompilerImpl
, ID3DXEffectCompiler_iface
);
3375 /*** IUnknown methods ***/
3376 static HRESULT WINAPI
ID3DXEffectCompilerImpl_QueryInterface(ID3DXEffectCompiler
*iface
, REFIID riid
, void **object
)
3378 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3380 TRACE("iface %p, riid %s, object %p\n", This
, debugstr_guid(riid
), object
);
3382 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
3383 IsEqualGUID(riid
, &IID_ID3DXEffectCompiler
))
3385 This
->ID3DXEffectCompiler_iface
.lpVtbl
->AddRef(iface
);
3390 ERR("Interface %s not found\n", debugstr_guid(riid
));
3392 return E_NOINTERFACE
;
3395 static ULONG WINAPI
ID3DXEffectCompilerImpl_AddRef(ID3DXEffectCompiler
*iface
)
3397 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3399 TRACE("iface %p: AddRef from %u\n", iface
, This
->ref
);
3401 return InterlockedIncrement(&This
->ref
);
3404 static ULONG WINAPI
ID3DXEffectCompilerImpl_Release(ID3DXEffectCompiler
*iface
)
3406 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3407 ULONG ref
= InterlockedDecrement(&This
->ref
);
3409 TRACE("iface %p: Release from %u\n", iface
, ref
+ 1);
3413 free_effect_compiler(This
);
3414 HeapFree(GetProcessHeap(), 0, This
);
3420 /*** ID3DXBaseEffect methods ***/
3421 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetDesc(ID3DXEffectCompiler
*iface
, D3DXEFFECT_DESC
*desc
)
3423 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3424 ID3DXBaseEffect
*base
= This
->base_effect
;
3426 TRACE("Forward iface %p, base %p\n", This
, base
);
3428 return ID3DXBaseEffectImpl_GetDesc(base
, desc
);
3431 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetParameterDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXPARAMETER_DESC
*desc
)
3433 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3434 ID3DXBaseEffect
*base
= This
->base_effect
;
3436 TRACE("Forward iface %p, base %p\n", This
, base
);
3438 return ID3DXBaseEffectImpl_GetParameterDesc(base
, parameter
, desc
);
3441 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetTechniqueDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE technique
, D3DXTECHNIQUE_DESC
*desc
)
3443 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3444 ID3DXBaseEffect
*base
= This
->base_effect
;
3446 TRACE("Forward iface %p, base %p\n", This
, base
);
3448 return ID3DXBaseEffectImpl_GetTechniqueDesc(base
, technique
, desc
);
3451 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetPassDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE pass
, D3DXPASS_DESC
*desc
)
3453 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3454 ID3DXBaseEffect
*base
= This
->base_effect
;
3456 TRACE("Forward iface %p, base %p\n", This
, base
);
3458 return ID3DXBaseEffectImpl_GetPassDesc(base
, pass
, desc
);
3461 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetFunctionDesc(ID3DXEffectCompiler
*iface
, D3DXHANDLE shader
, D3DXFUNCTION_DESC
*desc
)
3463 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3464 ID3DXBaseEffect
*base
= This
->base_effect
;
3466 TRACE("Forward iface %p, base %p\n", This
, base
);
3468 return ID3DXBaseEffectImpl_GetFunctionDesc(base
, shader
, desc
);
3471 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameter(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, UINT index
)
3473 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3474 ID3DXBaseEffect
*base
= This
->base_effect
;
3476 TRACE("Forward iface %p, base %p\n", This
, base
);
3478 return ID3DXBaseEffectImpl_GetParameter(base
, parameter
, index
);
3481 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameterByName(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR name
)
3483 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3484 ID3DXBaseEffect
*base
= This
->base_effect
;
3486 TRACE("Forward iface %p, base %p\n", This
, base
);
3488 return ID3DXBaseEffectImpl_GetParameterByName(base
, parameter
, name
);
3491 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameterBySemantic(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR semantic
)
3493 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3494 ID3DXBaseEffect
*base
= This
->base_effect
;
3496 TRACE("Forward iface %p, base %p\n", This
, base
);
3498 return ID3DXBaseEffectImpl_GetParameterBySemantic(base
, parameter
, semantic
);
3501 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetParameterElement(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, UINT index
)
3503 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3504 ID3DXBaseEffect
*base
= This
->base_effect
;
3506 TRACE("Forward iface %p, base %p\n", This
, base
);
3508 return ID3DXBaseEffectImpl_GetParameterElement(base
, parameter
, index
);
3511 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetTechnique(ID3DXEffectCompiler
*iface
, UINT index
)
3513 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3514 ID3DXBaseEffect
*base
= This
->base_effect
;
3516 TRACE("Forward iface %p, base %p\n", This
, base
);
3518 return ID3DXBaseEffectImpl_GetTechnique(base
, index
);
3521 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetTechniqueByName(ID3DXEffectCompiler
*iface
, LPCSTR name
)
3523 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3524 ID3DXBaseEffect
*base
= This
->base_effect
;
3526 TRACE("Forward iface %p, base %p\n", This
, base
);
3528 return ID3DXBaseEffectImpl_GetTechniqueByName(base
, name
);
3531 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetPass(ID3DXEffectCompiler
*iface
, D3DXHANDLE technique
, UINT index
)
3533 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3534 ID3DXBaseEffect
*base
= This
->base_effect
;
3536 TRACE("Forward iface %p, base %p\n", This
, base
);
3538 return ID3DXBaseEffectImpl_GetPass(base
, technique
, index
);
3541 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetPassByName(ID3DXEffectCompiler
*iface
, D3DXHANDLE technique
, LPCSTR name
)
3543 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3544 ID3DXBaseEffect
*base
= This
->base_effect
;
3546 TRACE("Forward iface %p, base %p\n", This
, base
);
3548 return ID3DXBaseEffectImpl_GetPassByName(base
, technique
, name
);
3551 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetFunction(ID3DXEffectCompiler
*iface
, UINT index
)
3553 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3554 ID3DXBaseEffect
*base
= This
->base_effect
;
3556 TRACE("Forward iface %p, base %p\n", This
, base
);
3558 return ID3DXBaseEffectImpl_GetFunction(base
, index
);
3561 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetFunctionByName(ID3DXEffectCompiler
*iface
, LPCSTR name
)
3563 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3564 ID3DXBaseEffect
*base
= This
->base_effect
;
3566 TRACE("Forward iface %p, base %p\n", This
, base
);
3568 return ID3DXBaseEffectImpl_GetFunctionByName(base
, name
);
3571 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetAnnotation(ID3DXEffectCompiler
*iface
, D3DXHANDLE object
, UINT index
)
3573 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3574 ID3DXBaseEffect
*base
= This
->base_effect
;
3576 TRACE("Forward iface %p, base %p\n", This
, base
);
3578 return ID3DXBaseEffectImpl_GetAnnotation(base
, object
, index
);
3581 static D3DXHANDLE WINAPI
ID3DXEffectCompilerImpl_GetAnnotationByName(ID3DXEffectCompiler
*iface
, D3DXHANDLE object
, LPCSTR name
)
3583 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3584 ID3DXBaseEffect
*base
= This
->base_effect
;
3586 TRACE("Forward iface %p, base %p\n", This
, base
);
3588 return ID3DXBaseEffectImpl_GetAnnotationByName(base
, object
, name
);
3591 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetValue(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCVOID data
, UINT bytes
)
3593 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3594 ID3DXBaseEffect
*base
= This
->base_effect
;
3596 TRACE("Forward iface %p, base %p\n", This
, base
);
3598 return ID3DXBaseEffectImpl_SetValue(base
, parameter
, data
, bytes
);
3601 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetValue(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPVOID data
, UINT bytes
)
3603 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3604 ID3DXBaseEffect
*base
= This
->base_effect
;
3606 TRACE("Forward iface %p, base %p\n", This
, base
);
3608 return ID3DXBaseEffectImpl_GetValue(base
, parameter
, data
, bytes
);
3611 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetBool(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL b
)
3613 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3614 ID3DXBaseEffect
*base
= This
->base_effect
;
3616 TRACE("Forward iface %p, base %p\n", This
, base
);
3618 return ID3DXBaseEffectImpl_SetBool(base
, parameter
, b
);
3621 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetBool(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL
*b
)
3623 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3624 ID3DXBaseEffect
*base
= This
->base_effect
;
3626 TRACE("Forward iface %p, base %p\n", This
, base
);
3628 return ID3DXBaseEffectImpl_GetBool(base
, parameter
, b
);
3631 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetBoolArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST BOOL
*b
, UINT count
)
3633 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3634 ID3DXBaseEffect
*base
= This
->base_effect
;
3636 TRACE("Forward iface %p, base %p\n", This
, base
);
3638 return ID3DXBaseEffectImpl_SetBoolArray(base
, parameter
, b
, count
);
3641 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetBoolArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL
*b
, UINT count
)
3643 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3644 ID3DXBaseEffect
*base
= This
->base_effect
;
3646 TRACE("Forward iface %p, base %p\n", This
, base
);
3648 return ID3DXBaseEffectImpl_GetBoolArray(base
, parameter
, b
, count
);
3651 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetInt(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, INT n
)
3653 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3654 ID3DXBaseEffect
*base
= This
->base_effect
;
3656 TRACE("Forward iface %p, base %p\n", This
, base
);
3658 return ID3DXBaseEffectImpl_SetInt(base
, parameter
, n
);
3661 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetInt(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, INT
*n
)
3663 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3664 ID3DXBaseEffect
*base
= This
->base_effect
;
3666 TRACE("Forward iface %p, base %p\n", This
, base
);
3668 return ID3DXBaseEffectImpl_GetInt(base
, parameter
, n
);
3671 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetIntArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST INT
*n
, UINT count
)
3673 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3674 ID3DXBaseEffect
*base
= This
->base_effect
;
3676 TRACE("Forward iface %p, base %p\n", This
, base
);
3678 return ID3DXBaseEffectImpl_SetIntArray(base
, parameter
, n
, count
);
3681 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetIntArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, INT
*n
, UINT count
)
3683 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3684 ID3DXBaseEffect
*base
= This
->base_effect
;
3686 TRACE("Forward iface %p, base %p\n", This
, base
);
3688 return ID3DXBaseEffectImpl_GetIntArray(base
, parameter
, n
, count
);
3691 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetFloat(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, FLOAT f
)
3693 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3694 ID3DXBaseEffect
*base
= This
->base_effect
;
3696 TRACE("Forward iface %p, base %p\n", This
, base
);
3698 return ID3DXBaseEffectImpl_SetFloat(base
, parameter
, f
);
3701 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetFloat(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, FLOAT
*f
)
3703 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3704 ID3DXBaseEffect
*base
= This
->base_effect
;
3706 TRACE("Forward iface %p, base %p\n", This
, base
);
3708 return ID3DXBaseEffectImpl_GetFloat(base
, parameter
, f
);
3711 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetFloatArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST FLOAT
*f
, UINT count
)
3713 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3714 ID3DXBaseEffect
*base
= This
->base_effect
;
3716 TRACE("Forward iface %p, base %p\n", This
, base
);
3718 return ID3DXBaseEffectImpl_SetFloatArray(base
, parameter
, f
, count
);
3721 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetFloatArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, FLOAT
*f
, UINT count
)
3723 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3724 ID3DXBaseEffect
*base
= This
->base_effect
;
3726 TRACE("Forward iface %p, base %p\n", This
, base
);
3728 return ID3DXBaseEffectImpl_GetFloatArray(base
, parameter
, f
, count
);
3731 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetVector(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
)
3733 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3734 ID3DXBaseEffect
*base
= This
->base_effect
;
3736 TRACE("Forward iface %p, base %p\n", This
, base
);
3738 return ID3DXBaseEffectImpl_SetVector(base
, parameter
, vector
);
3741 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetVector(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
)
3743 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3744 ID3DXBaseEffect
*base
= This
->base_effect
;
3746 TRACE("Forward iface %p, base %p\n", This
, base
);
3748 return ID3DXBaseEffectImpl_GetVector(base
, parameter
, vector
);
3751 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetVectorArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXVECTOR4
*vector
, UINT count
)
3753 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3754 ID3DXBaseEffect
*base
= This
->base_effect
;
3756 TRACE("Forward iface %p, base %p\n", This
, base
);
3758 return ID3DXBaseEffectImpl_SetVectorArray(base
, parameter
, vector
, count
);
3761 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetVectorArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXVECTOR4
*vector
, UINT count
)
3763 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3764 ID3DXBaseEffect
*base
= This
->base_effect
;
3766 TRACE("Forward iface %p, base %p\n", This
, base
);
3768 return ID3DXBaseEffectImpl_GetVectorArray(base
, parameter
, vector
, count
);
3771 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrix(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
3773 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3774 ID3DXBaseEffect
*base
= This
->base_effect
;
3776 TRACE("Forward iface %p, base %p\n", This
, base
);
3778 return ID3DXBaseEffectImpl_SetMatrix(base
, parameter
, matrix
);
3781 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrix(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
3783 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3784 ID3DXBaseEffect
*base
= This
->base_effect
;
3786 TRACE("Forward iface %p, base %p\n", This
, base
);
3788 return ID3DXBaseEffectImpl_GetMatrix(base
, parameter
, matrix
);
3791 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
3793 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3794 ID3DXBaseEffect
*base
= This
->base_effect
;
3796 TRACE("Forward iface %p, base %p\n", This
, base
);
3798 return ID3DXBaseEffectImpl_SetMatrixArray(base
, parameter
, matrix
, count
);
3801 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
3803 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3804 ID3DXBaseEffect
*base
= This
->base_effect
;
3806 TRACE("Forward iface %p, base %p\n", This
, base
);
3808 return ID3DXBaseEffectImpl_GetMatrixArray(base
, parameter
, matrix
, count
);
3811 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixPointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
3813 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3814 ID3DXBaseEffect
*base
= This
->base_effect
;
3816 TRACE("Forward iface %p, base %p\n", This
, base
);
3818 return ID3DXBaseEffectImpl_SetMatrixPointerArray(base
, parameter
, matrix
, count
);
3821 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixPointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
3823 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3824 ID3DXBaseEffect
*base
= This
->base_effect
;
3826 TRACE("Forward iface %p, base %p\n", This
, base
);
3828 return ID3DXBaseEffectImpl_GetMatrixPointerArray(base
, parameter
, matrix
, count
);
3831 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixTranspose(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
)
3833 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3834 ID3DXBaseEffect
*base
= This
->base_effect
;
3836 TRACE("Forward iface %p, base %p\n", This
, base
);
3838 return ID3DXBaseEffectImpl_SetMatrixTranspose(base
, parameter
, matrix
);
3841 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixTranspose(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
)
3843 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3844 ID3DXBaseEffect
*base
= This
->base_effect
;
3846 TRACE("Forward iface %p, base %p\n", This
, base
);
3848 return ID3DXBaseEffectImpl_GetMatrixTranspose(base
, parameter
, matrix
);
3851 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixTransposeArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
*matrix
, UINT count
)
3853 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3854 ID3DXBaseEffect
*base
= This
->base_effect
;
3856 TRACE("Forward iface %p, base %p\n", This
, base
);
3858 return ID3DXBaseEffectImpl_SetMatrixTransposeArray(base
, parameter
, matrix
, count
);
3861 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixTransposeArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
*matrix
, UINT count
)
3863 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3864 ID3DXBaseEffect
*base
= This
->base_effect
;
3866 TRACE("Forward iface %p, base %p\n", This
, base
);
3868 return ID3DXBaseEffectImpl_GetMatrixTransposeArray(base
, parameter
, matrix
, count
);
3871 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, CONST D3DXMATRIX
**matrix
, UINT count
)
3873 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3874 ID3DXBaseEffect
*base
= This
->base_effect
;
3876 TRACE("Forward iface %p, base %p\n", This
, base
);
3878 return ID3DXBaseEffectImpl_SetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
3881 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, D3DXMATRIX
**matrix
, UINT count
)
3883 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3884 ID3DXBaseEffect
*base
= This
->base_effect
;
3886 TRACE("Forward iface %p, base %p\n", This
, base
);
3888 return ID3DXBaseEffectImpl_GetMatrixTransposePointerArray(base
, parameter
, matrix
, count
);
3891 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetString(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR string
)
3893 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3894 ID3DXBaseEffect
*base
= This
->base_effect
;
3896 TRACE("Forward iface %p, base %p\n", This
, base
);
3898 return ID3DXBaseEffectImpl_SetString(base
, parameter
, string
);
3901 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetString(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPCSTR
*string
)
3903 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3904 ID3DXBaseEffect
*base
= This
->base_effect
;
3906 TRACE("Forward iface %p, base %p\n", This
, base
);
3908 return ID3DXBaseEffectImpl_GetString(base
, parameter
, string
);
3911 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetTexture(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9 texture
)
3913 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3914 ID3DXBaseEffect
*base
= This
->base_effect
;
3916 TRACE("Forward iface %p, base %p\n", This
, base
);
3918 return ID3DXBaseEffectImpl_SetTexture(base
, parameter
, texture
);
3921 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetTexture(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DBASETEXTURE9
*texture
)
3923 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3924 ID3DXBaseEffect
*base
= This
->base_effect
;
3926 TRACE("Forward iface %p, base %p\n", This
, base
);
3928 return ID3DXBaseEffectImpl_GetTexture(base
, parameter
, texture
);
3931 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetPixelShader(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DPIXELSHADER9
*pshader
)
3933 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3934 ID3DXBaseEffect
*base
= This
->base_effect
;
3936 TRACE("Forward iface %p, base %p\n", This
, base
);
3938 return ID3DXBaseEffectImpl_GetPixelShader(base
, parameter
, pshader
);
3941 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetVertexShader(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, LPDIRECT3DVERTEXSHADER9
*vshader
)
3943 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3944 ID3DXBaseEffect
*base
= This
->base_effect
;
3946 TRACE("Forward iface %p, base %p\n", This
, base
);
3948 return ID3DXBaseEffectImpl_GetVertexShader(base
, parameter
, vshader
);
3951 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetArrayRange(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, UINT start
, UINT end
)
3953 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3954 ID3DXBaseEffect
*base
= This
->base_effect
;
3956 TRACE("Forward iface %p, base %p\n", This
, base
);
3958 return ID3DXBaseEffectImpl_SetArrayRange(base
, parameter
, start
, end
);
3961 /*** ID3DXEffectCompiler methods ***/
3962 static HRESULT WINAPI
ID3DXEffectCompilerImpl_SetLiteral(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL literal
)
3964 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3966 FIXME("iface %p, parameter %p, literal %u\n", This
, parameter
, literal
);
3971 static HRESULT WINAPI
ID3DXEffectCompilerImpl_GetLiteral(ID3DXEffectCompiler
*iface
, D3DXHANDLE parameter
, BOOL
*literal
)
3973 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3975 FIXME("iface %p, parameter %p, literal %p\n", This
, parameter
, literal
);
3980 static HRESULT WINAPI
ID3DXEffectCompilerImpl_CompileEffect(ID3DXEffectCompiler
*iface
, DWORD flags
,
3981 LPD3DXBUFFER
*effect
, LPD3DXBUFFER
*error_msgs
)
3983 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3985 FIXME("iface %p, flags %#x, effect %p, error_msgs %p stub\n", This
, flags
, effect
, error_msgs
);
3990 static HRESULT WINAPI
ID3DXEffectCompilerImpl_CompileShader(ID3DXEffectCompiler
*iface
, D3DXHANDLE function
,
3991 LPCSTR target
, DWORD flags
, LPD3DXBUFFER
*shader
, LPD3DXBUFFER
*error_msgs
, LPD3DXCONSTANTTABLE
*constant_table
)
3993 struct ID3DXEffectCompilerImpl
*This
= impl_from_ID3DXEffectCompiler(iface
);
3995 FIXME("iface %p, function %p, target %p, flags %#x, shader %p, error_msgs %p, constant_table %p stub\n",
3996 This
, function
, target
, flags
, shader
, error_msgs
, constant_table
);
4001 static const struct ID3DXEffectCompilerVtbl ID3DXEffectCompiler_Vtbl
=
4003 /*** IUnknown methods ***/
4004 ID3DXEffectCompilerImpl_QueryInterface
,
4005 ID3DXEffectCompilerImpl_AddRef
,
4006 ID3DXEffectCompilerImpl_Release
,
4007 /*** ID3DXBaseEffect methods ***/
4008 ID3DXEffectCompilerImpl_GetDesc
,
4009 ID3DXEffectCompilerImpl_GetParameterDesc
,
4010 ID3DXEffectCompilerImpl_GetTechniqueDesc
,
4011 ID3DXEffectCompilerImpl_GetPassDesc
,
4012 ID3DXEffectCompilerImpl_GetFunctionDesc
,
4013 ID3DXEffectCompilerImpl_GetParameter
,
4014 ID3DXEffectCompilerImpl_GetParameterByName
,
4015 ID3DXEffectCompilerImpl_GetParameterBySemantic
,
4016 ID3DXEffectCompilerImpl_GetParameterElement
,
4017 ID3DXEffectCompilerImpl_GetTechnique
,
4018 ID3DXEffectCompilerImpl_GetTechniqueByName
,
4019 ID3DXEffectCompilerImpl_GetPass
,
4020 ID3DXEffectCompilerImpl_GetPassByName
,
4021 ID3DXEffectCompilerImpl_GetFunction
,
4022 ID3DXEffectCompilerImpl_GetFunctionByName
,
4023 ID3DXEffectCompilerImpl_GetAnnotation
,
4024 ID3DXEffectCompilerImpl_GetAnnotationByName
,
4025 ID3DXEffectCompilerImpl_SetValue
,
4026 ID3DXEffectCompilerImpl_GetValue
,
4027 ID3DXEffectCompilerImpl_SetBool
,
4028 ID3DXEffectCompilerImpl_GetBool
,
4029 ID3DXEffectCompilerImpl_SetBoolArray
,
4030 ID3DXEffectCompilerImpl_GetBoolArray
,
4031 ID3DXEffectCompilerImpl_SetInt
,
4032 ID3DXEffectCompilerImpl_GetInt
,
4033 ID3DXEffectCompilerImpl_SetIntArray
,
4034 ID3DXEffectCompilerImpl_GetIntArray
,
4035 ID3DXEffectCompilerImpl_SetFloat
,
4036 ID3DXEffectCompilerImpl_GetFloat
,
4037 ID3DXEffectCompilerImpl_SetFloatArray
,
4038 ID3DXEffectCompilerImpl_GetFloatArray
,
4039 ID3DXEffectCompilerImpl_SetVector
,
4040 ID3DXEffectCompilerImpl_GetVector
,
4041 ID3DXEffectCompilerImpl_SetVectorArray
,
4042 ID3DXEffectCompilerImpl_GetVectorArray
,
4043 ID3DXEffectCompilerImpl_SetMatrix
,
4044 ID3DXEffectCompilerImpl_GetMatrix
,
4045 ID3DXEffectCompilerImpl_SetMatrixArray
,
4046 ID3DXEffectCompilerImpl_GetMatrixArray
,
4047 ID3DXEffectCompilerImpl_SetMatrixPointerArray
,
4048 ID3DXEffectCompilerImpl_GetMatrixPointerArray
,
4049 ID3DXEffectCompilerImpl_SetMatrixTranspose
,
4050 ID3DXEffectCompilerImpl_GetMatrixTranspose
,
4051 ID3DXEffectCompilerImpl_SetMatrixTransposeArray
,
4052 ID3DXEffectCompilerImpl_GetMatrixTransposeArray
,
4053 ID3DXEffectCompilerImpl_SetMatrixTransposePointerArray
,
4054 ID3DXEffectCompilerImpl_GetMatrixTransposePointerArray
,
4055 ID3DXEffectCompilerImpl_SetString
,
4056 ID3DXEffectCompilerImpl_GetString
,
4057 ID3DXEffectCompilerImpl_SetTexture
,
4058 ID3DXEffectCompilerImpl_GetTexture
,
4059 ID3DXEffectCompilerImpl_GetPixelShader
,
4060 ID3DXEffectCompilerImpl_GetVertexShader
,
4061 ID3DXEffectCompilerImpl_SetArrayRange
,
4062 /*** ID3DXEffectCompiler methods ***/
4063 ID3DXEffectCompilerImpl_SetLiteral
,
4064 ID3DXEffectCompilerImpl_GetLiteral
,
4065 ID3DXEffectCompilerImpl_CompileEffect
,
4066 ID3DXEffectCompilerImpl_CompileShader
,
4069 static HRESULT
d3dx9_parse_sampler(struct d3dx_sampler
*sampler
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4073 struct d3dx_state
*states
;
4075 read_dword(ptr
, &sampler
->state_count
);
4076 TRACE("Count: %u\n", sampler
->state_count
);
4078 states
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*states
) * sampler
->state_count
);
4081 ERR("Out of memory\n");
4082 return E_OUTOFMEMORY
;
4085 for (i
= 0; i
< sampler
->state_count
; ++i
)
4087 hr
= d3dx9_parse_state(&states
[i
], data
, ptr
, objects
);
4090 WARN("Failed to parse state\n");
4095 sampler
->states
= states
;
4101 for (i
= 0; i
< sampler
->state_count
; ++i
)
4103 free_state(&states
[i
]);
4106 HeapFree(GetProcessHeap(), 0, states
);
4111 static HRESULT
d3dx9_parse_value(struct d3dx_parameter
*param
, void *value
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4118 if (param
->element_count
)
4120 param
->data
= value
;
4122 for (i
= 0; i
< param
->element_count
; ++i
)
4124 struct d3dx_parameter
*member
= get_parameter_struct(param
->member_handles
[i
]);
4126 hr
= d3dx9_parse_value(member
, value
? (char *)value
+ old_size
: NULL
, data
, ptr
, objects
);
4129 WARN("Failed to parse value\n");
4133 old_size
+= member
->bytes
;
4139 switch(param
->class)
4143 case D3DXPC_MATRIX_ROWS
:
4144 case D3DXPC_MATRIX_COLUMNS
:
4145 param
->data
= value
;
4149 param
->data
= value
;
4151 for (i
= 0; i
< param
->member_count
; ++i
)
4153 struct d3dx_parameter
*member
= get_parameter_struct(param
->member_handles
[i
]);
4155 hr
= d3dx9_parse_value(member
, (char *)value
+ old_size
, data
, ptr
, objects
);
4158 WARN("Failed to parse value\n");
4162 old_size
+= member
->bytes
;
4167 switch (param
->type
)
4170 case D3DXPT_TEXTURE
:
4171 case D3DXPT_TEXTURE1D
:
4172 case D3DXPT_TEXTURE2D
:
4173 case D3DXPT_TEXTURE3D
:
4174 case D3DXPT_TEXTURECUBE
:
4175 case D3DXPT_PIXELSHADER
:
4176 case D3DXPT_VERTEXSHADER
:
4177 read_dword(ptr
, &id
);
4178 TRACE("Id: %u\n", id
);
4179 objects
[id
] = get_parameter_handle(param
);
4180 param
->data
= value
;
4183 case D3DXPT_SAMPLER
:
4184 case D3DXPT_SAMPLER1D
:
4185 case D3DXPT_SAMPLER2D
:
4186 case D3DXPT_SAMPLER3D
:
4187 case D3DXPT_SAMPLERCUBE
:
4189 struct d3dx_sampler
*sampler
;
4191 sampler
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*sampler
));
4194 ERR("Out of memory\n");
4195 return E_OUTOFMEMORY
;
4198 hr
= d3dx9_parse_sampler(sampler
, data
, ptr
, objects
);
4201 HeapFree(GetProcessHeap(), 0, sampler
);
4202 WARN("Failed to parse sampler\n");
4206 param
->data
= sampler
;
4211 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
4217 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
4224 static HRESULT
d3dx9_parse_init_value(struct d3dx_parameter
*param
, const char *data
, const char *ptr
, D3DXHANDLE
*objects
)
4226 UINT size
= param
->bytes
;
4230 TRACE("param size: %u\n", size
);
4234 value
= HeapAlloc(GetProcessHeap(), 0, size
);
4237 ERR("Failed to allocate data memory.\n");
4238 return E_OUTOFMEMORY
;
4241 TRACE("Data: %s.\n", debugstr_an(ptr
, size
));
4242 memcpy(value
, ptr
, size
);
4245 hr
= d3dx9_parse_value(param
, value
, data
, &ptr
, objects
);
4248 WARN("Failed to parse value\n");
4249 HeapFree(GetProcessHeap(), 0, value
);
4256 static HRESULT
d3dx9_parse_name(char **name
, const char *ptr
)
4260 read_dword(&ptr
, &size
);
4261 TRACE("Name size: %#x\n", size
);
4268 *name
= HeapAlloc(GetProcessHeap(), 0, size
);
4271 ERR("Failed to allocate name memory.\n");
4272 return E_OUTOFMEMORY
;
4275 TRACE("Name: %s.\n", debugstr_an(ptr
, size
));
4276 memcpy(*name
, ptr
, size
);
4281 static HRESULT
d3dx9_copy_data(char **str
, const char **ptr
)
4285 read_dword(ptr
, &size
);
4286 TRACE("Data size: %#x\n", size
);
4288 *str
= HeapAlloc(GetProcessHeap(), 0, size
);
4291 ERR("Failed to allocate name memory.\n");
4292 return E_OUTOFMEMORY
;
4295 TRACE("Data: %s.\n", debugstr_an(*ptr
, size
));
4296 memcpy(*str
, *ptr
, size
);
4298 *ptr
+= ((size
+ 3) & ~3);
4303 static HRESULT
d3dx9_parse_data(struct d3dx_parameter
*param
, const char **ptr
, LPDIRECT3DDEVICE9 device
)
4308 TRACE("Parse data for parameter %s, type %s\n", debugstr_a(param
->name
), debug_d3dxparameter_type(param
->type
));
4310 read_dword(ptr
, &size
);
4311 TRACE("Data size: %#x\n", size
);
4315 TRACE("Size is 0\n");
4316 *(void **)param
->data
= NULL
;
4320 switch (param
->type
)
4323 /* re-read with size (sizeof(DWORD) = 4) */
4324 hr
= d3dx9_parse_name((LPSTR
*)param
->data
, *ptr
- 4);
4327 WARN("Failed to parse string data\n");
4332 case D3DXPT_VERTEXSHADER
:
4333 hr
= IDirect3DDevice9_CreateVertexShader(device
, (DWORD
*)*ptr
, (LPDIRECT3DVERTEXSHADER9
*)param
->data
);
4336 WARN("Failed to create vertex shader\n");
4341 case D3DXPT_PIXELSHADER
:
4342 hr
= IDirect3DDevice9_CreatePixelShader(device
, (DWORD
*)*ptr
, (LPDIRECT3DPIXELSHADER9
*)param
->data
);
4345 WARN("Failed to create pixel shader\n");
4351 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
4356 *ptr
+= ((size
+ 3) & ~3);
4361 static HRESULT
d3dx9_parse_effect_typedef(struct d3dx_parameter
*param
, const char *data
, const char **ptr
,
4362 struct d3dx_parameter
*parent
, UINT flags
)
4366 D3DXHANDLE
*member_handles
= NULL
;
4369 param
->flags
= flags
;
4373 read_dword(ptr
, ¶m
->type
);
4374 TRACE("Type: %s\n", debug_d3dxparameter_type(param
->type
));
4376 read_dword(ptr
, ¶m
->class);
4377 TRACE("Class: %s\n", debug_d3dxparameter_class(param
->class));
4379 read_dword(ptr
, &offset
);
4380 TRACE("Type name offset: %#x\n", offset
);
4381 hr
= d3dx9_parse_name(¶m
->name
, data
+ offset
);
4384 WARN("Failed to parse name\n");
4388 read_dword(ptr
, &offset
);
4389 TRACE("Type semantic offset: %#x\n", offset
);
4390 hr
= d3dx9_parse_name(¶m
->semantic
, data
+ offset
);
4393 WARN("Failed to parse semantic\n");
4397 read_dword(ptr
, ¶m
->element_count
);
4398 TRACE("Elements: %u\n", param
->element_count
);
4400 switch (param
->class)
4403 read_dword(ptr
, ¶m
->columns
);
4404 TRACE("Columns: %u\n", param
->columns
);
4406 read_dword(ptr
, ¶m
->rows
);
4407 TRACE("Rows: %u\n", param
->rows
);
4409 /* sizeof(DWORD) * rows * columns */
4410 param
->bytes
= 4 * param
->rows
* param
->columns
;
4414 case D3DXPC_MATRIX_ROWS
:
4415 case D3DXPC_MATRIX_COLUMNS
:
4416 read_dword(ptr
, ¶m
->rows
);
4417 TRACE("Rows: %u\n", param
->rows
);
4419 read_dword(ptr
, ¶m
->columns
);
4420 TRACE("Columns: %u\n", param
->columns
);
4422 /* sizeof(DWORD) * rows * columns */
4423 param
->bytes
= 4 * param
->rows
* param
->columns
;
4427 read_dword(ptr
, ¶m
->member_count
);
4428 TRACE("Members: %u\n", param
->member_count
);
4432 switch (param
->type
)
4435 param
->bytes
= sizeof(LPCSTR
);
4438 case D3DXPT_PIXELSHADER
:
4439 param
->bytes
= sizeof(LPDIRECT3DPIXELSHADER9
);
4442 case D3DXPT_VERTEXSHADER
:
4443 param
->bytes
= sizeof(LPDIRECT3DVERTEXSHADER9
);
4446 case D3DXPT_TEXTURE
:
4447 case D3DXPT_TEXTURE1D
:
4448 case D3DXPT_TEXTURE2D
:
4449 case D3DXPT_TEXTURE3D
:
4450 case D3DXPT_TEXTURECUBE
:
4451 param
->bytes
= sizeof(LPDIRECT3DBASETEXTURE9
);
4454 case D3DXPT_SAMPLER
:
4455 case D3DXPT_SAMPLER1D
:
4456 case D3DXPT_SAMPLER2D
:
4457 case D3DXPT_SAMPLER3D
:
4458 case D3DXPT_SAMPLERCUBE
:
4463 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
4469 FIXME("Unhandled class %s\n", debug_d3dxparameter_class(param
->class));
4476 param
->type
= parent
->type
;
4477 param
->class = parent
->class;
4478 param
->name
= parent
->name
;
4479 param
->semantic
= parent
->semantic
;
4480 param
->element_count
= 0;
4481 param
->annotation_count
= 0;
4482 param
->member_count
= parent
->member_count
;
4483 param
->bytes
= parent
->bytes
;
4484 param
->rows
= parent
->rows
;
4485 param
->columns
= parent
->columns
;
4488 if (param
->element_count
)
4490 unsigned int param_bytes
= 0;
4491 const char *save_ptr
= *ptr
;
4493 member_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member_handles
) * param
->element_count
);
4494 if (!member_handles
)
4496 ERR("Out of memory\n");
4501 for (i
= 0; i
< param
->element_count
; ++i
)
4503 struct d3dx_parameter
*member
;
4506 member
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member
));
4509 ERR("Out of memory\n");
4514 member_handles
[i
] = get_parameter_handle(member
);
4516 hr
= d3dx9_parse_effect_typedef(member
, data
, ptr
, param
, flags
);
4519 WARN("Failed to parse member\n");
4523 param_bytes
+= member
->bytes
;
4526 param
->bytes
= param_bytes
;
4528 else if (param
->member_count
)
4530 member_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member_handles
) * param
->member_count
);
4531 if (!member_handles
)
4533 ERR("Out of memory\n");
4538 for (i
= 0; i
< param
->member_count
; ++i
)
4540 struct d3dx_parameter
*member
;
4542 member
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*member
));
4545 ERR("Out of memory\n");
4550 member_handles
[i
] = get_parameter_handle(member
);
4552 hr
= d3dx9_parse_effect_typedef(member
, data
, ptr
, NULL
, flags
);
4555 WARN("Failed to parse member\n");
4559 param
->bytes
+= member
->bytes
;
4563 param
->member_handles
= member_handles
;
4573 if (param
->element_count
) count
= param
->element_count
;
4574 else count
= param
->member_count
;
4576 for (i
= 0; i
< count
; ++i
)
4578 free_parameter(member_handles
[i
], param
->element_count
!= 0, TRUE
);
4580 HeapFree(GetProcessHeap(), 0, member_handles
);
4585 HeapFree(GetProcessHeap(), 0, param
->name
);
4586 HeapFree(GetProcessHeap(), 0, param
->semantic
);
4589 param
->semantic
= NULL
;
4594 static HRESULT
d3dx9_parse_effect_annotation(struct d3dx_parameter
*anno
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4600 anno
->flags
= D3DX_PARAMETER_ANNOTATION
;
4602 read_dword(ptr
, &offset
);
4603 TRACE("Typedef offset: %#x\n", offset
);
4604 ptr2
= data
+ offset
;
4605 hr
= d3dx9_parse_effect_typedef(anno
, data
, &ptr2
, NULL
, D3DX_PARAMETER_ANNOTATION
);
4608 WARN("Failed to parse type definition\n");
4612 read_dword(ptr
, &offset
);
4613 TRACE("Value offset: %#x\n", offset
);
4614 hr
= d3dx9_parse_init_value(anno
, data
, data
+ offset
, objects
);
4617 WARN("Failed to parse value\n");
4624 static HRESULT
d3dx9_parse_state(struct d3dx_state
*state
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4629 struct d3dx_parameter
*parameter
;
4631 parameter
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*parameter
));
4634 ERR("Out of memory\n");
4635 return E_OUTOFMEMORY
;
4638 state
->type
= ST_CONSTANT
;
4640 read_dword(ptr
, &state
->operation
);
4641 TRACE("Operation: %#x (%s)\n", state
->operation
, state_table
[state
->operation
].name
);
4643 read_dword(ptr
, &state
->index
);
4644 TRACE("Index: %#x\n", state
->index
);
4646 read_dword(ptr
, &offset
);
4647 TRACE("Typedef offset: %#x\n", offset
);
4648 ptr2
= data
+ offset
;
4649 hr
= d3dx9_parse_effect_typedef(parameter
, data
, &ptr2
, NULL
, 0);
4652 WARN("Failed to parse type definition\n");
4656 read_dword(ptr
, &offset
);
4657 TRACE("Value offset: %#x\n", offset
);
4658 hr
= d3dx9_parse_init_value(parameter
, data
, data
+ offset
, objects
);
4661 WARN("Failed to parse value\n");
4665 state
->parameter
= get_parameter_handle(parameter
);
4671 free_parameter(get_parameter_handle(parameter
), FALSE
, FALSE
);
4676 static HRESULT
d3dx9_parse_effect_parameter(struct d3dx_parameter
*param
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4681 D3DXHANDLE
*annotation_handles
= NULL
;
4684 read_dword(ptr
, &offset
);
4685 TRACE("Typedef offset: %#x\n", offset
);
4686 ptr2
= data
+ offset
;
4688 read_dword(ptr
, &offset
);
4689 TRACE("Value offset: %#x\n", offset
);
4691 read_dword(ptr
, ¶m
->flags
);
4692 TRACE("Flags: %#x\n", param
->flags
);
4694 read_dword(ptr
, ¶m
->annotation_count
);
4695 TRACE("Annotation count: %u\n", param
->annotation_count
);
4697 hr
= d3dx9_parse_effect_typedef(param
, data
, &ptr2
, NULL
, param
->flags
);
4700 WARN("Failed to parse type definition\n");
4704 hr
= d3dx9_parse_init_value(param
, data
, data
+ offset
, objects
);
4707 WARN("Failed to parse value\n");
4711 if (param
->annotation_count
)
4713 annotation_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation_handles
) * param
->annotation_count
);
4714 if (!annotation_handles
)
4716 ERR("Out of memory\n");
4721 for (i
= 0; i
< param
->annotation_count
; ++i
)
4723 struct d3dx_parameter
*annotation
;
4725 annotation
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation
));
4728 ERR("Out of memory\n");
4733 annotation_handles
[i
] = get_parameter_handle(annotation
);
4735 hr
= d3dx9_parse_effect_annotation(annotation
, data
, ptr
, objects
);
4738 WARN("Failed to parse annotation\n");
4744 param
->annotation_handles
= annotation_handles
;
4750 if (annotation_handles
)
4752 for (i
= 0; i
< param
->annotation_count
; ++i
)
4754 free_parameter(annotation_handles
[i
], FALSE
, FALSE
);
4756 HeapFree(GetProcessHeap(), 0, annotation_handles
);
4762 static HRESULT
d3dx9_parse_effect_pass(struct d3dx_pass
*pass
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4767 D3DXHANDLE
*annotation_handles
= NULL
;
4768 struct d3dx_state
*states
= NULL
;
4771 read_dword(ptr
, &offset
);
4772 TRACE("Pass name offset: %#x\n", offset
);
4773 hr
= d3dx9_parse_name(&name
, data
+ offset
);
4776 WARN("Failed to parse name\n");
4780 read_dword(ptr
, &pass
->annotation_count
);
4781 TRACE("Annotation count: %u\n", pass
->annotation_count
);
4783 read_dword(ptr
, &pass
->state_count
);
4784 TRACE("State count: %u\n", pass
->state_count
);
4786 if (pass
->annotation_count
)
4788 annotation_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation_handles
) * pass
->annotation_count
);
4789 if (!annotation_handles
)
4791 ERR("Out of memory\n");
4796 for (i
= 0; i
< pass
->annotation_count
; ++i
)
4798 struct d3dx_parameter
*annotation
;
4800 annotation
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation
));
4803 ERR("Out of memory\n");
4808 annotation_handles
[i
] = get_parameter_handle(annotation
);
4810 hr
= d3dx9_parse_effect_annotation(annotation
, data
, ptr
, objects
);
4813 WARN("Failed to parse annotations\n");
4819 if (pass
->state_count
)
4821 states
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*states
) * pass
->state_count
);
4824 ERR("Out of memory\n");
4829 for (i
= 0; i
< pass
->state_count
; ++i
)
4831 hr
= d3dx9_parse_state(&states
[i
], data
, ptr
, objects
);
4834 WARN("Failed to parse annotations\n");
4841 pass
->annotation_handles
= annotation_handles
;
4842 pass
->states
= states
;
4848 if (annotation_handles
)
4850 for (i
= 0; i
< pass
->annotation_count
; ++i
)
4852 free_parameter(annotation_handles
[i
], FALSE
, FALSE
);
4854 HeapFree(GetProcessHeap(), 0, annotation_handles
);
4859 for (i
= 0; i
< pass
->state_count
; ++i
)
4861 free_state(&states
[i
]);
4863 HeapFree(GetProcessHeap(), 0, states
);
4866 HeapFree(GetProcessHeap(), 0, name
);
4871 static HRESULT
d3dx9_parse_effect_technique(struct d3dx_technique
*technique
, const char *data
, const char **ptr
, D3DXHANDLE
*objects
)
4876 D3DXHANDLE
*annotation_handles
= NULL
;
4877 D3DXHANDLE
*pass_handles
= NULL
;
4880 read_dword(ptr
, &offset
);
4881 TRACE("Technique name offset: %#x\n", offset
);
4882 hr
= d3dx9_parse_name(&name
, data
+ offset
);
4885 WARN("Failed to parse name\n");
4889 read_dword(ptr
, &technique
->annotation_count
);
4890 TRACE("Annotation count: %u\n", technique
->annotation_count
);
4892 read_dword(ptr
, &technique
->pass_count
);
4893 TRACE("Pass count: %u\n", technique
->pass_count
);
4895 if (technique
->annotation_count
)
4897 annotation_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation_handles
) * technique
->annotation_count
);
4898 if (!annotation_handles
)
4900 ERR("Out of memory\n");
4905 for (i
= 0; i
< technique
->annotation_count
; ++i
)
4907 struct d3dx_parameter
*annotation
;
4909 annotation
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*annotation
));
4912 ERR("Out of memory\n");
4917 annotation_handles
[i
] = get_parameter_handle(annotation
);
4919 hr
= d3dx9_parse_effect_annotation(annotation
, data
, ptr
, objects
);
4922 WARN("Failed to parse annotations\n");
4928 if (technique
->pass_count
)
4930 pass_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*pass_handles
) * technique
->pass_count
);
4933 ERR("Out of memory\n");
4938 for (i
= 0; i
< technique
->pass_count
; ++i
)
4940 struct d3dx_pass
*pass
;
4942 pass
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*pass
));
4945 ERR("Out of memory\n");
4950 pass_handles
[i
] = get_pass_handle(pass
);
4952 hr
= d3dx9_parse_effect_pass(pass
, data
, ptr
, objects
);
4955 WARN("Failed to parse passes\n");
4961 technique
->name
= name
;
4962 technique
->pass_handles
= pass_handles
;
4963 technique
->annotation_handles
= annotation_handles
;
4971 for (i
= 0; i
< technique
->pass_count
; ++i
)
4973 free_pass(pass_handles
[i
]);
4975 HeapFree(GetProcessHeap(), 0, pass_handles
);
4978 if (annotation_handles
)
4980 for (i
= 0; i
< technique
->annotation_count
; ++i
)
4982 free_parameter(annotation_handles
[i
], FALSE
, FALSE
);
4984 HeapFree(GetProcessHeap(), 0, annotation_handles
);
4987 HeapFree(GetProcessHeap(), 0, name
);
4992 static HRESULT
d3dx9_parse_resource(struct ID3DXBaseEffectImpl
*base
, const char *data
, const char **ptr
)
4994 DWORD technique_index
;
4995 DWORD index
, state_index
, usage
, element_index
;
4996 struct d3dx_state
*state
;
4997 struct d3dx_parameter
*param
;
4998 HRESULT hr
= E_FAIL
;
5000 read_dword(ptr
, &technique_index
);
5001 TRACE("techn: %u\n", technique_index
);
5003 read_dword(ptr
, &index
);
5004 TRACE("index: %u\n", index
);
5006 read_dword(ptr
, &element_index
);
5007 TRACE("element_index: %u\n", element_index
);
5009 read_dword(ptr
, &state_index
);
5010 TRACE("state_index: %u\n", state_index
);
5012 read_dword(ptr
, &usage
);
5013 TRACE("usage: %u\n", usage
);
5015 if (technique_index
== 0xffffffff)
5017 struct d3dx_parameter
*parameter
;
5018 struct d3dx_sampler
*sampler
;
5020 if (index
>= base
->parameter_count
)
5022 FIXME("Index out of bounds: index %u >= parameter_count %u\n", index
, base
->parameter_count
);
5026 parameter
= get_parameter_struct(base
->parameter_handles
[index
]);
5027 if (element_index
!= 0xffffffff)
5029 if (element_index
>= parameter
->element_count
&& parameter
->element_count
!= 0)
5031 FIXME("Index out of bounds: element_index %u >= element_count %u\n", element_index
, parameter
->element_count
);
5035 if (parameter
->element_count
!= 0) parameter
= get_parameter_struct(parameter
->member_handles
[element_index
]);
5038 sampler
= parameter
->data
;
5039 if (state_index
>= sampler
->state_count
)
5041 FIXME("Index out of bounds: state_index %u >= state_count %u\n", state_index
, sampler
->state_count
);
5045 state
= &sampler
->states
[state_index
];
5049 struct d3dx_technique
*technique
;
5050 struct d3dx_pass
*pass
;
5052 if (technique_index
>= base
->technique_count
)
5054 FIXME("Index out of bounds: technique_index %u >= technique_count %u\n", technique_index
, base
->technique_count
);
5058 technique
= get_technique_struct(base
->technique_handles
[technique_index
]);
5059 if (index
>= technique
->pass_count
)
5061 FIXME("Index out of bounds: index %u >= pass_count %u\n", index
, technique
->pass_count
);
5065 pass
= get_pass_struct(technique
->pass_handles
[index
]);
5066 if (state_index
>= pass
->state_count
)
5068 FIXME("Index out of bounds: state_index %u >= state_count %u\n", state_index
, pass
->state_count
);
5072 state
= &pass
->states
[state_index
];
5075 param
= get_parameter_struct(state
->parameter
);
5080 TRACE("usage 0: type %s\n", debug_d3dxparameter_type(param
->type
));
5081 switch (param
->type
)
5083 case D3DXPT_VERTEXSHADER
:
5084 case D3DXPT_PIXELSHADER
:
5085 state
->type
= ST_CONSTANT
;
5086 hr
= d3dx9_parse_data(param
, ptr
, base
->effect
->device
);
5093 state
->type
= ST_FXLC
;
5094 hr
= d3dx9_copy_data(param
->data
, ptr
);
5098 FIXME("Unhandled type %s\n", debug_d3dxparameter_type(param
->type
));
5104 state
->type
= ST_PARAMETER
;
5105 hr
= d3dx9_copy_data(param
->data
, ptr
);
5108 TRACE("Mapping to parameter %s\n", *(char **)param
->data
);
5113 FIXME("Unknown usage %x\n", usage
);
5120 static HRESULT
d3dx9_parse_effect(struct ID3DXBaseEffectImpl
*base
, const char *data
, UINT data_size
, DWORD start
)
5122 const char *ptr
= data
+ start
;
5123 D3DXHANDLE
*parameter_handles
= NULL
;
5124 D3DXHANDLE
*technique_handles
= NULL
;
5125 D3DXHANDLE
*objects
= NULL
;
5126 UINT stringcount
, objectcount
, resourcecount
;
5130 read_dword(&ptr
, &base
->parameter_count
);
5131 TRACE("Parameter count: %u\n", base
->parameter_count
);
5133 read_dword(&ptr
, &base
->technique_count
);
5134 TRACE("Technique count: %u\n", base
->technique_count
);
5136 skip_dword_unknown(&ptr
, 1);
5138 read_dword(&ptr
, &objectcount
);
5139 TRACE("Object count: %u\n", objectcount
);
5141 objects
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*objects
) * objectcount
);
5144 ERR("Out of memory\n");
5149 if (base
->parameter_count
)
5151 parameter_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*parameter_handles
) * base
->parameter_count
);
5152 if (!parameter_handles
)
5154 ERR("Out of memory\n");
5159 for (i
= 0; i
< base
->parameter_count
; ++i
)
5161 struct d3dx_parameter
*parameter
;
5163 parameter
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*parameter
));
5166 ERR("Out of memory\n");
5171 parameter_handles
[i
] = get_parameter_handle(parameter
);
5173 hr
= d3dx9_parse_effect_parameter(parameter
, data
, &ptr
, objects
);
5176 WARN("Failed to parse parameter\n");
5182 if (base
->technique_count
)
5184 technique_handles
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*technique_handles
) * base
->technique_count
);
5185 if (!technique_handles
)
5187 ERR("Out of memory\n");
5192 for (i
= 0; i
< base
->technique_count
; ++i
)
5194 struct d3dx_technique
*technique
;
5196 technique
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*technique
));
5199 ERR("Out of memory\n");
5204 technique_handles
[i
] = get_technique_handle(technique
);
5206 hr
= d3dx9_parse_effect_technique(technique
, data
, &ptr
, objects
);
5209 WARN("Failed to parse technique\n");
5215 /* needed for further parsing */
5216 base
->technique_handles
= technique_handles
;
5217 base
->parameter_handles
= parameter_handles
;
5219 read_dword(&ptr
, &stringcount
);
5220 TRACE("String count: %u\n", stringcount
);
5222 read_dword(&ptr
, &resourcecount
);
5223 TRACE("Resource count: %u\n", resourcecount
);
5225 for (i
= 0; i
< stringcount
; ++i
)
5228 struct d3dx_parameter
*param
;
5230 read_dword(&ptr
, &id
);
5231 TRACE("Id: %u\n", id
);
5233 param
= get_parameter_struct(objects
[id
]);
5235 hr
= d3dx9_parse_data(param
, &ptr
, base
->effect
->device
);
5238 WARN("Failed to parse data\n");
5243 for (i
= 0; i
< resourcecount
; ++i
)
5245 TRACE("parse resource %u\n", i
);
5247 hr
= d3dx9_parse_resource(base
, data
, &ptr
);
5250 WARN("Failed to parse data\n");
5255 HeapFree(GetProcessHeap(), 0, objects
);
5261 if (technique_handles
)
5263 for (i
= 0; i
< base
->technique_count
; ++i
)
5265 free_technique(technique_handles
[i
]);
5267 HeapFree(GetProcessHeap(), 0, technique_handles
);
5270 if (parameter_handles
)
5272 for (i
= 0; i
< base
->parameter_count
; ++i
)
5274 free_parameter(parameter_handles
[i
], FALSE
, FALSE
);
5276 HeapFree(GetProcessHeap(), 0, parameter_handles
);
5279 base
->technique_handles
= NULL
;
5280 base
->parameter_handles
= NULL
;
5282 HeapFree(GetProcessHeap(), 0, objects
);
5287 static HRESULT
d3dx9_base_effect_init(struct ID3DXBaseEffectImpl
*base
,
5288 const char *data
, SIZE_T data_size
, struct ID3DXEffectImpl
*effect
)
5291 const char *ptr
= data
;
5294 TRACE("base %p, data %p, data_size %lu, effect %p\n", base
, data
, data_size
, effect
);
5296 base
->ID3DXBaseEffect_iface
.lpVtbl
= &ID3DXBaseEffect_Vtbl
;
5298 base
->effect
= effect
;
5300 read_dword(&ptr
, &tag
);
5301 TRACE("Tag: %x\n", tag
);
5303 if (tag
!= d3dx9_effect_version(9, 1))
5305 /* todo: compile hlsl ascii code */
5306 FIXME("HLSL ascii effects not supported, yet\n");
5308 /* Show the start of the shader for debugging info. */
5309 TRACE("effect:\n%s\n", debugstr_an(data
, data_size
> 40 ? 40 : data_size
));
5313 read_dword(&ptr
, &offset
);
5314 TRACE("Offset: %x\n", offset
);
5316 hr
= d3dx9_parse_effect(base
, ptr
, data_size
, offset
);
5319 FIXME("Failed to parse effect.\n");
5327 static HRESULT
d3dx9_effect_init(struct ID3DXEffectImpl
*effect
, LPDIRECT3DDEVICE9 device
,
5328 const char *data
, SIZE_T data_size
, LPD3DXEFFECTPOOL pool
)
5331 struct ID3DXBaseEffectImpl
*object
= NULL
;
5333 TRACE("effect %p, device %p, data %p, data_size %lu, pool %p\n", effect
, device
, data
, data_size
, pool
);
5335 effect
->ID3DXEffect_iface
.lpVtbl
= &ID3DXEffect_Vtbl
;
5338 if (pool
) pool
->lpVtbl
->AddRef(pool
);
5339 effect
->pool
= pool
;
5341 IDirect3DDevice9_AddRef(device
);
5342 effect
->device
= device
;
5344 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5347 ERR("Out of memory\n");
5352 hr
= d3dx9_base_effect_init(object
, data
, data_size
, effect
);
5355 FIXME("Failed to parse effect.\n");
5359 effect
->base_effect
= &object
->ID3DXBaseEffect_iface
;
5361 /* initialize defaults - check because of unsupported ascii effects */
5362 if (object
->technique_handles
)
5364 effect
->active_technique
= object
->technique_handles
[0];
5365 effect
->active_pass
= NULL
;
5372 HeapFree(GetProcessHeap(), 0, object
);
5373 free_effect(effect
);
5378 HRESULT WINAPI
D3DXCreateEffectEx(LPDIRECT3DDEVICE9 device
,
5381 CONST D3DXMACRO
* defines
,
5382 LPD3DXINCLUDE include
,
5383 LPCSTR skip_constants
,
5385 LPD3DXEFFECTPOOL pool
,
5386 LPD3DXEFFECT
* effect
,
5387 LPD3DXBUFFER
* compilation_errors
)
5389 struct ID3DXEffectImpl
*object
;
5392 FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device
, srcdata
, srcdatalen
, defines
, include
,
5393 skip_constants
, flags
, pool
, effect
, compilation_errors
);
5395 if (!device
|| !srcdata
)
5396 return D3DERR_INVALIDCALL
;
5401 /* Native dll allows effect to be null so just return D3D_OK after doing basic checks */
5405 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5408 ERR("Out of memory\n");
5409 return E_OUTOFMEMORY
;
5412 hr
= d3dx9_effect_init(object
, device
, srcdata
, srcdatalen
, pool
);
5415 WARN("Failed to initialize shader reflection\n");
5416 HeapFree(GetProcessHeap(), 0, object
);
5420 *effect
= &object
->ID3DXEffect_iface
;
5422 TRACE("Created ID3DXEffect %p\n", object
);
5427 HRESULT WINAPI
D3DXCreateEffect(LPDIRECT3DDEVICE9 device
,
5430 CONST D3DXMACRO
* defines
,
5431 LPD3DXINCLUDE include
,
5433 LPD3DXEFFECTPOOL pool
,
5434 LPD3DXEFFECT
* effect
,
5435 LPD3DXBUFFER
* compilation_errors
)
5437 TRACE("(%p, %p, %u, %p, %p, %#x, %p, %p, %p): Forwarded to D3DXCreateEffectEx\n", device
, srcdata
, srcdatalen
, defines
,
5438 include
, flags
, pool
, effect
, compilation_errors
);
5440 return D3DXCreateEffectEx(device
, srcdata
, srcdatalen
, defines
, include
, NULL
, flags
, pool
, effect
, compilation_errors
);
5443 static HRESULT
d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl
*compiler
, const char *data
, SIZE_T data_size
)
5446 struct ID3DXBaseEffectImpl
*object
= NULL
;
5448 TRACE("effect %p, data %p, data_size %lu\n", compiler
, data
, data_size
);
5450 compiler
->ID3DXEffectCompiler_iface
.lpVtbl
= &ID3DXEffectCompiler_Vtbl
;
5453 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5456 ERR("Out of memory\n");
5461 hr
= d3dx9_base_effect_init(object
, data
, data_size
, NULL
);
5464 FIXME("Failed to parse effect.\n");
5468 compiler
->base_effect
= &object
->ID3DXBaseEffect_iface
;
5474 HeapFree(GetProcessHeap(), 0, object
);
5475 free_effect_compiler(compiler
);
5480 HRESULT WINAPI
D3DXCreateEffectCompiler(LPCSTR srcdata
,
5482 CONST D3DXMACRO
*defines
,
5483 LPD3DXINCLUDE include
,
5485 LPD3DXEFFECTCOMPILER
*compiler
,
5486 LPD3DXBUFFER
*parse_errors
)
5488 struct ID3DXEffectCompilerImpl
*object
;
5491 TRACE("srcdata %p, srcdatalen %u, defines %p, include %p, flags %#x, compiler %p, parse_errors %p\n",
5492 srcdata
, srcdatalen
, defines
, include
, flags
, compiler
, parse_errors
);
5494 if (!srcdata
|| !compiler
)
5496 WARN("Invalid arguments supplied\n");
5497 return D3DERR_INVALIDCALL
;
5500 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5503 ERR("Out of memory\n");
5504 return E_OUTOFMEMORY
;
5507 hr
= d3dx9_effect_compiler_init(object
, srcdata
, srcdatalen
);
5510 WARN("Failed to initialize effect compiler\n");
5511 HeapFree(GetProcessHeap(), 0, object
);
5515 *compiler
= &object
->ID3DXEffectCompiler_iface
;
5517 TRACE("Created ID3DXEffectCompiler %p\n", object
);
5522 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl
;
5524 struct ID3DXEffectPoolImpl
5526 ID3DXEffectPool ID3DXEffectPool_iface
;
5530 static inline struct ID3DXEffectPoolImpl
*impl_from_ID3DXEffectPool(ID3DXEffectPool
*iface
)
5532 return CONTAINING_RECORD(iface
, struct ID3DXEffectPoolImpl
, ID3DXEffectPool_iface
);
5535 /*** IUnknown methods ***/
5536 static HRESULT WINAPI
ID3DXEffectPoolImpl_QueryInterface(ID3DXEffectPool
*iface
, REFIID riid
, void **object
)
5538 struct ID3DXEffectPoolImpl
*This
= impl_from_ID3DXEffectPool(iface
);
5540 TRACE("(%p)->(%s, %p)\n", This
, debugstr_guid(riid
), object
);
5542 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
5543 IsEqualGUID(riid
, &IID_ID3DXEffectPool
))
5545 This
->ID3DXEffectPool_iface
.lpVtbl
->AddRef(iface
);
5550 WARN("Interface %s not found\n", debugstr_guid(riid
));
5552 return E_NOINTERFACE
;
5555 static ULONG WINAPI
ID3DXEffectPoolImpl_AddRef(ID3DXEffectPool
*iface
)
5557 struct ID3DXEffectPoolImpl
*This
= impl_from_ID3DXEffectPool(iface
);
5559 TRACE("(%p)->(): AddRef from %u\n", This
, This
->ref
);
5561 return InterlockedIncrement(&This
->ref
);
5564 static ULONG WINAPI
ID3DXEffectPoolImpl_Release(ID3DXEffectPool
*iface
)
5566 struct ID3DXEffectPoolImpl
*This
= impl_from_ID3DXEffectPool(iface
);
5567 ULONG ref
= InterlockedDecrement(&This
->ref
);
5569 TRACE("(%p)->(): Release from %u\n", This
, ref
+ 1);
5572 HeapFree(GetProcessHeap(), 0, This
);
5577 static const struct ID3DXEffectPoolVtbl ID3DXEffectPool_Vtbl
=
5579 /*** IUnknown methods ***/
5580 ID3DXEffectPoolImpl_QueryInterface
,
5581 ID3DXEffectPoolImpl_AddRef
,
5582 ID3DXEffectPoolImpl_Release
5585 HRESULT WINAPI
D3DXCreateEffectPool(LPD3DXEFFECTPOOL
*pool
)
5587 struct ID3DXEffectPoolImpl
*object
;
5589 TRACE("(%p)\n", pool
);
5592 return D3DERR_INVALIDCALL
;
5594 object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
));
5597 ERR("Out of memory\n");
5598 return E_OUTOFMEMORY
;
5601 object
->ID3DXEffectPool_iface
.lpVtbl
= &ID3DXEffectPool_Vtbl
;
5604 *pool
= &object
->ID3DXEffectPool_iface
;
5609 HRESULT WINAPI
D3DXCreateEffectFromFileExW(LPDIRECT3DDEVICE9 device
, LPCWSTR srcfile
,
5610 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
5611 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5617 TRACE("(%s): relay\n", debugstr_w(srcfile
));
5619 if (!device
|| !srcfile
)
5620 return D3DERR_INVALIDCALL
;
5622 ret
= map_view_of_file(srcfile
, &buffer
, &size
);
5625 return D3DXERR_INVALIDDATA
;
5627 ret
= D3DXCreateEffectEx(device
, buffer
, size
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
5628 UnmapViewOfFile(buffer
);
5633 HRESULT WINAPI
D3DXCreateEffectFromFileExA(LPDIRECT3DDEVICE9 device
, LPCSTR srcfile
,
5634 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
5635 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5641 TRACE("(void): relay\n");
5644 return D3DERR_INVALIDCALL
;
5646 len
= MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, NULL
, 0);
5647 srcfileW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(*srcfileW
));
5648 MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, srcfileW
, len
);
5650 ret
= D3DXCreateEffectFromFileExW(device
, srcfileW
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
5651 HeapFree(GetProcessHeap(), 0, srcfileW
);
5656 HRESULT WINAPI
D3DXCreateEffectFromFileW(LPDIRECT3DDEVICE9 device
, LPCWSTR srcfile
,
5657 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
5658 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5660 TRACE("(void): relay\n");
5661 return D3DXCreateEffectFromFileExW(device
, srcfile
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
5664 HRESULT WINAPI
D3DXCreateEffectFromFileA(LPDIRECT3DDEVICE9 device
, LPCSTR srcfile
,
5665 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
5666 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5668 TRACE("(void): relay\n");
5669 return D3DXCreateEffectFromFileExA(device
, srcfile
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
5672 HRESULT WINAPI
D3DXCreateEffectFromResourceExW(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCWSTR srcresource
,
5673 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
5674 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5678 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_w(srcresource
));
5681 return D3DERR_INVALIDCALL
;
5683 resinfo
= FindResourceW(srcmodule
, srcresource
, (LPCWSTR
) RT_RCDATA
);
5691 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
5694 return D3DXERR_INVALIDDATA
;
5696 return D3DXCreateEffectEx(device
, buffer
, size
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
5699 return D3DXERR_INVALIDDATA
;
5702 HRESULT WINAPI
D3DXCreateEffectFromResourceExA(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCSTR srcresource
,
5703 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, LPCSTR skipconstants
, DWORD flags
,
5704 LPD3DXEFFECTPOOL pool
, LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5708 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_a(srcresource
));
5711 return D3DERR_INVALIDCALL
;
5713 resinfo
= FindResourceA(srcmodule
, srcresource
, (LPCSTR
) RT_RCDATA
);
5721 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
5724 return D3DXERR_INVALIDDATA
;
5726 return D3DXCreateEffectEx(device
, buffer
, size
, defines
, include
, skipconstants
, flags
, pool
, effect
, compilationerrors
);
5729 return D3DXERR_INVALIDDATA
;
5732 HRESULT WINAPI
D3DXCreateEffectFromResourceW(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCWSTR srcresource
,
5733 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
5734 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5736 TRACE("(void): relay\n");
5737 return D3DXCreateEffectFromResourceExW(device
, srcmodule
, srcresource
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
5740 HRESULT WINAPI
D3DXCreateEffectFromResourceA(LPDIRECT3DDEVICE9 device
, HMODULE srcmodule
, LPCSTR srcresource
,
5741 const D3DXMACRO
*defines
, LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTPOOL pool
,
5742 LPD3DXEFFECT
*effect
, LPD3DXBUFFER
*compilationerrors
)
5744 TRACE("(void): relay\n");
5745 return D3DXCreateEffectFromResourceExA(device
, srcmodule
, srcresource
, defines
, include
, NULL
, flags
, pool
, effect
, compilationerrors
);
5748 HRESULT WINAPI
D3DXCreateEffectCompilerFromFileW(LPCWSTR srcfile
, const D3DXMACRO
*defines
, LPD3DXINCLUDE include
,
5749 DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
5755 TRACE("(%s): relay\n", debugstr_w(srcfile
));
5758 return D3DERR_INVALIDCALL
;
5760 ret
= map_view_of_file(srcfile
, &buffer
, &size
);
5763 return D3DXERR_INVALIDDATA
;
5765 ret
= D3DXCreateEffectCompiler(buffer
, size
, defines
, include
, flags
, effectcompiler
, parseerrors
);
5766 UnmapViewOfFile(buffer
);
5771 HRESULT WINAPI
D3DXCreateEffectCompilerFromFileA(LPCSTR srcfile
, const D3DXMACRO
*defines
, LPD3DXINCLUDE include
,
5772 DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
5778 TRACE("(void): relay\n");
5781 return D3DERR_INVALIDCALL
;
5783 len
= MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, NULL
, 0);
5784 srcfileW
= HeapAlloc(GetProcessHeap(), 0, len
* sizeof(*srcfileW
));
5785 MultiByteToWideChar(CP_ACP
, 0, srcfile
, -1, srcfileW
, len
);
5787 ret
= D3DXCreateEffectCompilerFromFileW(srcfileW
, defines
, include
, flags
, effectcompiler
, parseerrors
);
5788 HeapFree(GetProcessHeap(), 0, srcfileW
);
5793 HRESULT WINAPI
D3DXCreateEffectCompilerFromResourceA(HMODULE srcmodule
, LPCSTR srcresource
, const D3DXMACRO
*defines
,
5794 LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
5798 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_a(srcresource
));
5800 resinfo
= FindResourceA(srcmodule
, srcresource
, (LPCSTR
) RT_RCDATA
);
5808 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
5811 return D3DXERR_INVALIDDATA
;
5813 return D3DXCreateEffectCompiler(buffer
, size
, defines
, include
, flags
, effectcompiler
, parseerrors
);
5816 return D3DXERR_INVALIDDATA
;
5819 HRESULT WINAPI
D3DXCreateEffectCompilerFromResourceW(HMODULE srcmodule
, LPCWSTR srcresource
, const D3DXMACRO
*defines
,
5820 LPD3DXINCLUDE include
, DWORD flags
, LPD3DXEFFECTCOMPILER
*effectcompiler
, LPD3DXBUFFER
*parseerrors
)
5824 TRACE("(%p, %s): relay\n", srcmodule
, debugstr_w(srcresource
));
5826 resinfo
= FindResourceW(srcmodule
, srcresource
, (LPCWSTR
) RT_RCDATA
);
5834 ret
= load_resource_into_memory(srcmodule
, resinfo
, &buffer
, &size
);
5837 return D3DXERR_INVALIDDATA
;
5839 return D3DXCreateEffectCompiler(buffer
, size
, defines
, include
, flags
, effectcompiler
, parseerrors
);
5842 return D3DXERR_INVALIDDATA
;