Module: wine Branch: master Commit: 0c456ac8666cad127d381d6fdcffaf3439b6dc66 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0c456ac8666cad127d381d6fdc...
Author: Józef Kucia jkucia@codeweavers.com Date: Fri Jun 9 13:00:06 2017 +0200
d3d10core/tests: Port test_pipeline_statistics_query() from d3d11.
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d10core/tests/device.c | 73 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index bd8cf57..5159bad 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -4048,6 +4048,78 @@ static void test_occlusion_query(void) release_test_context(&test_context); }
+static void test_pipeline_statistics_query(void) +{ + static const struct vec4 red = {1.0f, 0.0f, 0.0f, 1.0f}; + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + + struct d3d10core_test_context test_context; + D3D10_QUERY_DATA_PIPELINE_STATISTICS data; + D3D10_QUERY_DESC query_desc; + ID3D10Asynchronous *query; + unsigned int data_size; + ID3D10Device *device; + HRESULT hr; + + if (!init_test_context(&test_context)) + return; + + device = test_context.device; + + ID3D10Device_ClearRenderTargetView(device, test_context.backbuffer_rtv, white); + + query_desc.Query = D3D10_QUERY_PIPELINE_STATISTICS; + query_desc.MiscFlags = 0; + hr = ID3D10Device_CreateQuery(device, &query_desc, (ID3D10Query **)&query); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + data_size = ID3D10Asynchronous_GetDataSize(query); + ok(data_size == sizeof(data), "Got unexpected data size %u.\n", data_size); + + hr = ID3D10Asynchronous_GetData(query, NULL, 0, 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + hr = ID3D10Asynchronous_GetData(query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + ID3D10Asynchronous_End(query); + ID3D10Asynchronous_Begin(query); + ID3D10Asynchronous_Begin(query); + + hr = ID3D10Asynchronous_GetData(query, NULL, 0, 0); + todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + hr = ID3D10Asynchronous_GetData(query, &data, sizeof(data), 0); + todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + draw_quad(&test_context); + + ID3D10Asynchronous_End(query); + get_query_data(query, &data, sizeof(data)); + ok(data.IAVertices == 4, "Got unexpected IAVertices count: %u.\n", (unsigned int)data.IAVertices); + ok(data.IAPrimitives == 2, "Got unexpected IAPrimitives count: %u.\n", (unsigned int)data.IAPrimitives); + ok(data.VSInvocations == 4, "Got unexpected VSInvocations count: %u.\n", (unsigned int)data.VSInvocations); + ok(!data.GSInvocations, "Got unexpected GSInvocations count: %u.\n", (unsigned int)data.GSInvocations); + ok(!data.GSPrimitives, "Got unexpected GSPrimitives count: %u.\n", (unsigned int)data.GSPrimitives); + ok(data.CInvocations == 2, "Got unexpected CInvocations count: %u.\n", (unsigned int)data.CInvocations); + ok(data.CPrimitives == 2, "Got unexpected CPrimitives count: %u.\n", (unsigned int)data.CPrimitives); + todo_wine + ok(!data.PSInvocations, "Got unexpected PSInvocations count: %u.\n", (unsigned int)data.PSInvocations); + + ID3D10Asynchronous_Begin(query); + draw_color_quad(&test_context, &red); + ID3D10Asynchronous_End(query); + get_query_data(query, &data, sizeof(data)); + ok(data.IAVertices == 4, "Got unexpected IAVertices count: %u.\n", (unsigned int)data.IAVertices); + ok(data.IAPrimitives == 2, "Got unexpected IAPrimitives count: %u.\n", (unsigned int)data.IAPrimitives); + ok(data.VSInvocations == 4, "Got unexpected VSInvocations count: %u.\n", (unsigned int)data.VSInvocations); + ok(!data.GSInvocations, "Got unexpected GSInvocations count: %u.\n", (unsigned int)data.GSInvocations); + ok(!data.GSPrimitives, "Got unexpected GSPrimitives count: %u.\n", (unsigned int)data.GSPrimitives); + ok(data.CInvocations == 2, "Got unexpected CInvocations count: %u.\n", (unsigned int)data.CInvocations); + ok(data.CPrimitives == 2, "Got unexpected CPrimitives count: %u.\n", (unsigned int)data.CPrimitives); + ok(data.PSInvocations >= 640 * 480, "Got unexpected PSInvocations count: %u.\n", (unsigned int)data.PSInvocations); + + ID3D10Asynchronous_Release(query); + release_test_context(&test_context); +} + static void test_timestamp_query(void) { static const struct vec4 red = {1.0f, 0.0f, 0.0f, 1.0f}; @@ -12525,6 +12597,7 @@ START_TEST(device) test_create_rasterizer_state(); test_create_query(); test_occlusion_query(); + test_pipeline_statistics_query(); test_timestamp_query(); test_device_removed_reason(); test_scissor();