Module: wine Branch: master Commit: 3fcec2b7566c2e58f5b430e9e596a610e39c90bd URL: https://source.winehq.org/git/wine.git/?a=commit;h=3fcec2b7566c2e58f5b430e9e... Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Tue Apr 2 12:42:46 2019 -0500 d3d9: Forbid applying a stateblock while recording. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/d3d9/stateblock.c | 8 +++++++- dlls/d3d9/tests/device.c | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c index 14f47d9..124e1ef 100644 --- a/dlls/d3d9/stateblock.c +++ b/dlls/d3d9/stateblock.c @@ -121,8 +121,14 @@ static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - wined3d_stateblock_apply(stateblock->wined3d_stateblock); device = impl_from_IDirect3DDevice9Ex(stateblock->parent_device); + if (device->recording) + { + wined3d_mutex_unlock(); + WARN("Trying to apply stateblock while recording, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + wined3d_stateblock_apply(stateblock->wined3d_stateblock); device->sysmem_vb = 0; for (i = 0; i < D3D9_MAX_STREAMS; ++i) { diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 652b81a..639c26d 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -10596,7 +10596,7 @@ static void test_begin_end_state_block(void) ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); hr = IDirect3DStateBlock9_Apply(stateblock); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); hr = IDirect3DStateBlock9_Capture(stateblock); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); @@ -10616,7 +10616,7 @@ static void test_begin_end_state_block(void) hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(value == TRUE, "Got unexpected value %#x.\n", value); + ok(value == TRUE, "Got unexpected value %#x.\n", value); IDirect3DStateBlock9_Release(stateblock); IDirect3DStateBlock9_Release(stateblock2);