d3dx9: Preserve states regardless of state manager presence.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2017-04-10 20:45:44 +02:00 committed by Alexandre Julliard
parent d6ab655a09
commit 2b18cd4321
2 changed files with 7 additions and 3 deletions

View File

@ -3788,7 +3788,7 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW
if (flags & ~(D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESAMPLERSTATE | D3DXFX_DONOTSAVESHADERSTATE)) if (flags & ~(D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESAMPLERSTATE | D3DXFX_DONOTSAVESHADERSTATE))
WARN("Invalid flags (%#x) specified.\n", flags); WARN("Invalid flags (%#x) specified.\n", flags);
if (effect->manager || flags & D3DXFX_DONOTSAVESTATE) if (flags & D3DXFX_DONOTSAVESTATE)
{ {
TRACE("State capturing disabled.\n"); TRACE("State capturing disabled.\n");
} }
@ -3799,12 +3799,17 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW
if (!technique->saved_state) if (!technique->saved_state)
{ {
ID3DXEffectStateManager *manager;
manager = effect->manager;
effect->manager = NULL;
if (FAILED(hr = IDirect3DDevice9_BeginStateBlock(effect->device))) if (FAILED(hr = IDirect3DDevice9_BeginStateBlock(effect->device)))
ERR("BeginStateBlock failed, hr %#x.\n", hr); ERR("BeginStateBlock failed, hr %#x.\n", hr);
for (i = 0; i < technique->pass_count; i++) for (i = 0; i < technique->pass_count; i++)
d3dx9_apply_pass_states(effect, &technique->passes[i], TRUE); d3dx9_apply_pass_states(effect, &technique->passes[i], TRUE);
if (FAILED(hr = IDirect3DDevice9_EndStateBlock(effect->device, &technique->saved_state))) if (FAILED(hr = IDirect3DDevice9_EndStateBlock(effect->device, &technique->saved_state)))
ERR("EndStateBlock failed, hr %#x.\n", hr); ERR("EndStateBlock failed, hr %#x.\n", hr);
effect->manager = manager;
} }
if (FAILED(hr = IDirect3DStateBlock9_Capture(technique->saved_state))) if (FAILED(hr = IDirect3DStateBlock9_Capture(technique->saved_state)))
ERR("StateBlock Capture failed, hr %#x.\n", hr); ERR("StateBlock Capture failed, hr %#x.\n", hr);
@ -3883,7 +3888,7 @@ static HRESULT WINAPI ID3DXEffectImpl_End(ID3DXEffect *iface)
if (!effect->started) if (!effect->started)
return D3D_OK; return D3D_OK;
if (effect->manager || effect->flags & D3DXFX_DONOTSAVESTATE) if (effect->flags & D3DXFX_DONOTSAVESTATE)
{ {
TRACE("State restoring disabled.\n"); TRACE("State restoring disabled.\n");
} }

View File

@ -5673,7 +5673,6 @@ static void test_effect_state_manager(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_GetLight(device, i, &light); hr = IDirect3DDevice9_GetLight(device, i, &light);
ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(hr == D3D_OK, "Got result %#x.\n", hr);
todo_wine
ok(!memcmp(&light, &light_filler, sizeof(light)), "Light %u mismatch.\n", i); ok(!memcmp(&light, &light_filler, sizeof(light)), "Light %u mismatch.\n", i);
} }