d3d9: Forbid creating a stateblock while recording.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-04-02 12:42:48 -05:00 committed by Alexandre Julliard
parent 3e87746eb7
commit dd0bed46a5
2 changed files with 11 additions and 2 deletions

View File

@ -2313,6 +2313,15 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface,
return D3DERR_INVALIDCALL;
}
wined3d_mutex_lock();
if (device->recording)
{
wined3d_mutex_unlock();
WARN("Trying to create a stateblock while recording, returning D3DERR_INVALIDCALL.\n");
return D3DERR_INVALIDCALL;
}
wined3d_mutex_unlock();
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;

View File

@ -10602,7 +10602,7 @@ static void test_begin_end_state_block(void)
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateStateBlock(device, D3DSBT_ALL, &stateblock2);
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@ -10621,7 +10621,7 @@ static void test_begin_end_state_block(void)
IDirect3DStateBlock9_Release(stateblock);
IDirect3DStateBlock9_Release(stateblock2);
refcount = IDirect3DDevice9_Release(device);
todo_wine ok(!refcount, "Device has %u references left.\n", refcount);
ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D9_Release(d3d);
DestroyWindow(window);
}