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

ddraw: Return D3DERR_INBEGINSTATEBLOCK when BeginStateBlock() is called while recording.

parent 7df47016
......@@ -346,6 +346,8 @@ struct d3d_device
D3DMATRIXHANDLE world, proj, view;
struct wined3d_vec4 user_clip_planes[D3DMAXUSERCLIPPLANES];
BOOL recording;
};
HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUnknown *rt_iface,
......
......@@ -5644,7 +5644,14 @@ static HRESULT d3d_device7_BeginStateBlock(IDirect3DDevice7 *iface)
TRACE("iface %p.\n", iface);
wined3d_mutex_lock();
hr = wined3d_device_begin_stateblock(device->wined3d_device);
if (device->recording)
{
wined3d_mutex_unlock();
WARN("Trying to begin a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n");
return D3DERR_INBEGINSTATEBLOCK;
}
if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device)))
device->recording = TRUE;
wined3d_mutex_unlock();
return hr_ddraw_from_wined3d(hr);
......@@ -5705,6 +5712,7 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl
*stateblock = 0;
return hr_ddraw_from_wined3d(hr);
}
device->recording = FALSE;
h = ddraw_allocate_handle(&device->handle_table, wined3d_sb, DDRAW_HANDLE_STATEBLOCK);
if (h == DDRAW_INVALID_HANDLE)
......
......@@ -15863,7 +15863,7 @@ static void test_begin_end_state_block(void)
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_BeginStateBlock(device);
todo_wine ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice7_ApplyStateBlock(device, stateblock);
todo_wine ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
......
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