From a63be635fcceed3b08bec53963b5daddb93586f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rico=20Sch=C3=BCller?= Date: Mon, 27 Jun 2011 11:58:20 +0200 Subject: [PATCH] d3dx9: Implement ID3DXEffect::Begin(). --- dlls/d3dx9_36/effect.c | 32 +++++++++++++++++++++++++++++--- include/d3dx9effect.h | 6 ++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 4b320fdf325..a1bdc5d0f11 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -165,6 +165,7 @@ struct ID3DXEffectImpl LPD3DXEFFECTSTATEMANAGER manager; LPDIRECT3DDEVICE9 device; LPD3DXEFFECTPOOL pool; + D3DXHANDLE active_technique; ID3DXBaseEffect *base_effect; }; @@ -2790,13 +2791,32 @@ static BOOL WINAPI ID3DXEffectImpl_IsParameterUsed(ID3DXEffect* iface, D3DXHANDL return FALSE; } -static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect* iface, UINT *passes, DWORD flags) +static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DWORD flags) { struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); + struct d3dx_technique *technique = get_technique_struct(This->active_technique); - FIXME("(%p)->(%p, %#x): stub\n", This, passes, flags); + FIXME("iface %p, passes %p, flags %#x partial stub\n", This, passes, flags); - return E_NOTIMPL; + if (passes && technique) + { + if (This->manager || flags & D3DXFX_DONOTSAVESTATE) + { + TRACE("State capturing disabled.\n"); + } + else + { + FIXME("State capturing not supported, yet!\n"); + } + + *passes = technique->pass_count; + + return D3D_OK; + } + + WARN("Invalid argument supplied.\n"); + + return D3DERR_INVALIDCALL; } static HRESULT WINAPI ID3DXEffectImpl_BeginPass(ID3DXEffect* iface, UINT pass) @@ -4988,6 +5008,12 @@ static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, LPDIRECT3DDEVIC effect->base_effect = &object->ID3DXBaseEffect_iface; + /* initialize defaults - check because of unsupported ascii effects */ + if (object->technique_handles) + { + effect->active_technique = object->technique_handles[0]; + } + return D3D_OK; err_out: diff --git a/include/d3dx9effect.h b/include/d3dx9effect.h index e0d1de5efe8..035f4d662b3 100644 --- a/include/d3dx9effect.h +++ b/include/d3dx9effect.h @@ -21,6 +21,12 @@ #ifndef __D3DX9EFFECT_H__ #define __D3DX9EFFECT_H__ +#define D3DXFX_DONOTSAVESTATE (1 << 0) +#define D3DXFX_DONOTSAVESHADERSTATE (1 << 1) +#define D3DXFX_DONOTSAVESAMPLERSTATE (1 << 2) +#define D3DXFX_NOT_CLONEABLE (1 << 11) +#define D3DXFX_LARGEADDRESSAWARE (1 << 17) + #define D3DX_PARAMETER_SHARED 1 #define D3DX_PARAMETER_LITERAL 2 #define D3DX_PARAMETER_ANNOTATION 4 -- 2.11.4.GIT