diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 4a41443e849..bad9211f453 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -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; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 40ccdc46259..e7366b19771 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -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); }