ddraw: Return D3DERR_NOTINBEGINSTATEBLOCK when EndStateBlock() is called while not 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-04 18:37:57 -05:00 committed by Alexandre Julliard
parent f9b9004f81
commit 90af51d041
2 changed files with 8 additions and 3 deletions

View File

@ -5703,7 +5703,12 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
if (!device->recording)
{
wined3d_mutex_unlock();
WARN("Trying to end a stateblock, but no stateblock is being recorded.\n");
return D3DERR_NOTINBEGINSTATEBLOCK;
}
hr = wined3d_device_end_stateblock(device->wined3d_device, &wined3d_sb);
if (FAILED(hr))
{

View File

@ -15852,8 +15852,8 @@ static void test_begin_end_state_block(void)
stateblock2 = 0xdeadbeef;
hr = IDirect3DDevice7_EndStateBlock(device, &stateblock2);
todo_wine ok(hr == D3DERR_NOTINBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
todo_wine ok(stateblock2 == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock2);
ok(hr == D3DERR_NOTINBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
ok(stateblock2 == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock2);
hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_LIGHTING, &value);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);