From 2b18cd43215144e3c81e10fb05b792b47c5f9467 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 10 Apr 2017 20:45:44 +0200 Subject: [PATCH] d3dx9: Preserve states regardless of state manager presence. Signed-off-by: Paul Gofman Signed-off-by: Matteo Bruni Signed-off-by: Alexandre Julliard --- dlls/d3dx9_36/effect.c | 9 +++++++-- dlls/d3dx9_36/tests/effect.c | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 49409ae0967..813b57e1ea6 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -3788,7 +3788,7 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW if (flags & ~(D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESAMPLERSTATE | D3DXFX_DONOTSAVESHADERSTATE)) WARN("Invalid flags (%#x) specified.\n", flags); - if (effect->manager || flags & D3DXFX_DONOTSAVESTATE) + if (flags & D3DXFX_DONOTSAVESTATE) { TRACE("State capturing disabled.\n"); } @@ -3799,12 +3799,17 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW if (!technique->saved_state) { + ID3DXEffectStateManager *manager; + + manager = effect->manager; + effect->manager = NULL; if (FAILED(hr = IDirect3DDevice9_BeginStateBlock(effect->device))) ERR("BeginStateBlock failed, hr %#x.\n", hr); for (i = 0; i < technique->pass_count; i++) d3dx9_apply_pass_states(effect, &technique->passes[i], TRUE); if (FAILED(hr = IDirect3DDevice9_EndStateBlock(effect->device, &technique->saved_state))) ERR("EndStateBlock failed, hr %#x.\n", hr); + effect->manager = manager; } if (FAILED(hr = IDirect3DStateBlock9_Capture(technique->saved_state))) ERR("StateBlock Capture failed, hr %#x.\n", hr); @@ -3883,7 +3888,7 @@ static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect *iface) if (!effect->started) return D3D_OK; - if (effect->manager || effect->flags & D3DXFX_DONOTSAVESTATE) + if (effect->flags & D3DXFX_DONOTSAVESTATE) { TRACE("State restoring disabled.\n"); } diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index fd4115667e2..de5ae69ec9e 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -5673,7 +5673,6 @@ static void test_effect_state_manager(IDirect3DDevice9 *device) hr = IDirect3DDevice9_GetLight(device, i, &light); ok(hr == D3D_OK, "Got result %#x.\n", hr); - todo_wine ok(!memcmp(&light, &light_filler, sizeof(light)), "Light %u mismatch.\n", i); }