d3d11/tests: Add a test for deferred context state management.
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:
parent
8130475d14
commit
932bc89995
|
@ -30164,6 +30164,79 @@ static void test_dual_source_blend(void)
|
|||
release_test_context(&test_context);
|
||||
}
|
||||
|
||||
static void test_deferred_context_state(void)
|
||||
{
|
||||
ID3D11Buffer *green_buffer, *blue_buffer, *ret_buffer;
|
||||
ID3D11DeviceContext *immediate, *deferred;
|
||||
struct d3d11_test_context test_context;
|
||||
ID3D11CommandList *list1, *list2;
|
||||
ID3D11Device *device;
|
||||
HRESULT hr;
|
||||
|
||||
static const float green[] = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
static const float blue[] = {0.0f, 0.0f, 1.0f, 1.0f};
|
||||
|
||||
if (!init_test_context(&test_context, NULL))
|
||||
return;
|
||||
|
||||
device = test_context.device;
|
||||
immediate = test_context.immediate_context;
|
||||
|
||||
green_buffer = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(green), &green);
|
||||
blue_buffer = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(blue), &blue);
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
|
||||
|
||||
hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred);
|
||||
todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr);
|
||||
if (hr != S_OK)
|
||||
{
|
||||
ID3D11Buffer_Release(blue_buffer);
|
||||
ID3D11Buffer_Release(green_buffer);
|
||||
release_test_context(&test_context);
|
||||
return;
|
||||
}
|
||||
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
|
||||
ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(deferred, 0, 1, &blue_buffer);
|
||||
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
|
||||
ok(ret_buffer == blue_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
ID3D11Buffer_Release(ret_buffer);
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
|
||||
ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
|
||||
ok(ret_buffer == blue_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
ID3D11Buffer_Release(ret_buffer);
|
||||
|
||||
hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list2);
|
||||
ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
|
||||
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
|
||||
ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer);
|
||||
ok(ret_buffer == green_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
ID3D11Buffer_Release(ret_buffer);
|
||||
|
||||
ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
|
||||
ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE);
|
||||
ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer);
|
||||
ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
|
||||
|
||||
ID3D11CommandList_Release(list2);
|
||||
ID3D11CommandList_Release(list1);
|
||||
ID3D11DeviceContext_Release(deferred);
|
||||
ID3D11Buffer_Release(blue_buffer);
|
||||
ID3D11Buffer_Release(green_buffer);
|
||||
release_test_context(&test_context);
|
||||
}
|
||||
|
||||
START_TEST(d3d11)
|
||||
{
|
||||
unsigned int argc, i;
|
||||
|
@ -30327,6 +30400,7 @@ START_TEST(d3d11)
|
|||
queue_test(test_color_mask);
|
||||
queue_test(test_independent_blend);
|
||||
queue_test(test_dual_source_blend);
|
||||
queue_test(test_deferred_context_state);
|
||||
|
||||
run_queued_tests();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue