Commit dd0bed46 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3d9: Forbid creating a stateblock while recording.

parent 3e87746e
...@@ -2313,6 +2313,15 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface, ...@@ -2313,6 +2313,15 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface,
return D3DERR_INVALIDCALL; 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)))) if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -10602,7 +10602,7 @@ static void test_begin_end_state_block(void) ...@@ -10602,7 +10602,7 @@ static void test_begin_end_state_block(void)
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateStateBlock(device, D3DSBT_ALL, &stateblock2); 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); hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
...@@ -10621,7 +10621,7 @@ static void test_begin_end_state_block(void) ...@@ -10621,7 +10621,7 @@ static void test_begin_end_state_block(void)
IDirect3DStateBlock9_Release(stateblock); IDirect3DStateBlock9_Release(stateblock);
IDirect3DStateBlock9_Release(stateblock2); IDirect3DStateBlock9_Release(stateblock2);
refcount = IDirect3DDevice9_Release(device); 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); IDirect3D9_Release(d3d);
DestroyWindow(window); DestroyWindow(window);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment