Commit 856210b6 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11: Add support for D3D11_QUERY_SO_STATISTICS_STREAM{0, 1, 2, 3} queries.

parent 1eb642aa
...@@ -398,14 +398,22 @@ static HRESULT d3d_query_init(struct d3d_query *query, struct d3d_device *device ...@@ -398,14 +398,22 @@ static HRESULT d3d_query_init(struct d3d_query *query, struct d3d_device *device
static const enum wined3d_query_type query_type_map[] = static const enum wined3d_query_type query_type_map[] =
{ {
/* D3D11_QUERY_EVENT */ WINED3D_QUERY_TYPE_EVENT, /* D3D11_QUERY_EVENT */ WINED3D_QUERY_TYPE_EVENT,
/* D3D11_QUERY_OCCLUSION */ WINED3D_QUERY_TYPE_OCCLUSION, /* D3D11_QUERY_OCCLUSION */ WINED3D_QUERY_TYPE_OCCLUSION,
/* D3D11_QUERY_TIMESTAMP */ WINED3D_QUERY_TYPE_TIMESTAMP, /* D3D11_QUERY_TIMESTAMP */ WINED3D_QUERY_TYPE_TIMESTAMP,
/* D3D11_QUERY_TIMESTAMP_DISJOINT */ WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT, /* D3D11_QUERY_TIMESTAMP_DISJOINT */ WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT,
/* D3D11_QUERY_PIPELINE_STATISTICS */ WINED3D_QUERY_TYPE_PIPELINE_STATISTICS, /* D3D11_QUERY_PIPELINE_STATISTICS */ WINED3D_QUERY_TYPE_PIPELINE_STATISTICS,
/* D3D11_QUERY_OCCLUSION_PREDICATE */ WINED3D_QUERY_TYPE_OCCLUSION, /* D3D11_QUERY_OCCLUSION_PREDICATE */ WINED3D_QUERY_TYPE_OCCLUSION,
/* D3D11_QUERY_SO_STATISTICS */ WINED3D_QUERY_TYPE_SO_STATISTICS, /* D3D11_QUERY_SO_STATISTICS */ WINED3D_QUERY_TYPE_SO_STATISTICS,
/* D3D11_QUERY_SO_OVERFLOW_PREDICATE */ WINED3D_QUERY_TYPE_SO_OVERFLOW, /* D3D11_QUERY_SO_OVERFLOW_PREDICATE */ WINED3D_QUERY_TYPE_SO_OVERFLOW,
/* D3D11_QUERY_SO_STATISTICS_STREAM0 */ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0,
/* D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 */ WINED3D_QUERY_TYPE_SO_OVERFLOW_STREAM0,
/* D3D11_QUERY_SO_STATISTICS_STREAM1 */ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1,
/* D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 */ WINED3D_QUERY_TYPE_SO_OVERFLOW_STREAM1,
/* D3D11_QUERY_SO_STATISTICS_STREAM2 */ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM2,
/* D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 */ WINED3D_QUERY_TYPE_SO_OVERFLOW_STREAM2,
/* D3D11_QUERY_SO_STATISTICS_STREAM3 */ WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3,
/* D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 */ WINED3D_QUERY_TYPE_SO_OVERFLOW_STREAM3,
}; };
if (desc->Query >= ARRAY_SIZE(query_type_map)) if (desc->Query >= ARRAY_SIZE(query_type_map))
......
...@@ -4602,13 +4602,13 @@ static void test_create_query(void) ...@@ -4602,13 +4602,13 @@ static void test_create_query(void)
{D3D11_QUERY_OCCLUSION_PREDICATE, D3D_FEATURE_LEVEL_10_0, TRUE, TRUE, FALSE}, {D3D11_QUERY_OCCLUSION_PREDICATE, D3D_FEATURE_LEVEL_10_0, TRUE, TRUE, FALSE},
{D3D11_QUERY_SO_STATISTICS, D3D_FEATURE_LEVEL_10_0, FALSE, FALSE, TRUE}, {D3D11_QUERY_SO_STATISTICS, D3D_FEATURE_LEVEL_10_0, FALSE, FALSE, TRUE},
{D3D11_QUERY_SO_OVERFLOW_PREDICATE, D3D_FEATURE_LEVEL_10_0, TRUE, TRUE, TRUE}, {D3D11_QUERY_SO_OVERFLOW_PREDICATE, D3D_FEATURE_LEVEL_10_0, TRUE, TRUE, TRUE},
{D3D11_QUERY_SO_STATISTICS_STREAM0, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE}, {D3D11_QUERY_SO_STATISTICS_STREAM0, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, FALSE},
{D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE}, {D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE},
{D3D11_QUERY_SO_STATISTICS_STREAM1, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE}, {D3D11_QUERY_SO_STATISTICS_STREAM1, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, FALSE},
{D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE}, {D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE},
{D3D11_QUERY_SO_STATISTICS_STREAM2, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE}, {D3D11_QUERY_SO_STATISTICS_STREAM2, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, FALSE},
{D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE}, {D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE},
{D3D11_QUERY_SO_STATISTICS_STREAM3, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, TRUE}, {D3D11_QUERY_SO_STATISTICS_STREAM3, D3D_FEATURE_LEVEL_11_0, FALSE, FALSE, FALSE},
{D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE}, {D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3, D3D_FEATURE_LEVEL_11_0, TRUE, FALSE, TRUE},
}; };
...@@ -18665,11 +18665,9 @@ static void test_quad_tessellation(void) ...@@ -18665,11 +18665,9 @@ static void test_quad_tessellation(void)
ID3D11DeviceContext_SOSetTargets(context, 1, &so_buffer, &offset); ID3D11DeviceContext_SOSetTargets(context, 1, &so_buffer, &offset);
query_desc.Query = D3D11_QUERY_SO_STATISTICS_STREAM0; query_desc.Query = D3D11_QUERY_SO_STATISTICS_STREAM0;
query_desc.MiscFlags = 0; query_desc.MiscFlags = 0;
query = NULL;
hr = ID3D11Device_CreateQuery(device, &query_desc, (ID3D11Query **)&query); hr = ID3D11Device_CreateQuery(device, &query_desc, (ID3D11Query **)&query);
todo_wine ok(hr == S_OK, "Failed to create query, hr %#x.\n", hr); ok(hr == S_OK, "Failed to create query, hr %#x.\n", hr);
if (query) ID3D11DeviceContext_Begin(context, query);
ID3D11DeviceContext_Begin(context, query);
set_quad_color(&test_context, &white); set_quad_color(&test_context, &white);
for (i = 0; i < ARRAY_SIZE(constant.tess_factors); ++i) for (i = 0; i < ARRAY_SIZE(constant.tess_factors); ++i)
...@@ -18684,48 +18682,42 @@ static void test_quad_tessellation(void) ...@@ -18684,48 +18682,42 @@ static void test_quad_tessellation(void)
ID3D11DeviceContext_Draw(context, 4, 0); ID3D11DeviceContext_Draw(context, 4, 0);
check_texture_color(test_context.backbuffer, 0xffffffff, 0); check_texture_color(test_context.backbuffer, 0xffffffff, 0);
if (query) ID3D11DeviceContext_End(context, query);
for (i = 0; i < 500; ++i)
{ {
ID3D11DeviceContext_End(context, query); if ((hr = ID3D11DeviceContext_GetData(context, query, NULL, 0, 0)) != S_FALSE)
for (i = 0; i < 500; ++i) break;
{ Sleep(10);
if ((hr = ID3D11DeviceContext_GetData(context, query, NULL, 0, 0)) != S_FALSE)
break;
Sleep(10);
}
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3D11DeviceContext_GetData(context, query, &so_statistics, sizeof(so_statistics), 0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(so_statistics.NumPrimitivesWritten == 8, "Got unexpected primitives written %u.\n",
(unsigned int)so_statistics.NumPrimitivesWritten);
ok(so_statistics.PrimitivesStorageNeeded == 8, "Got unexpected primitives storage needed %u.\n",
(unsigned int)so_statistics.PrimitivesStorageNeeded);
ID3D11DeviceContext_Begin(context, query);
} }
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3D11DeviceContext_GetData(context, query, &so_statistics, sizeof(so_statistics), 0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(so_statistics.NumPrimitivesWritten == 8, "Got unexpected primitives written %u.\n",
(unsigned int)so_statistics.NumPrimitivesWritten);
ok(so_statistics.PrimitivesStorageNeeded == 8, "Got unexpected primitives storage needed %u.\n",
(unsigned int)so_statistics.PrimitivesStorageNeeded);
ID3D11DeviceContext_Begin(context, query);
constant.tess_factors[0] = 5.0f; constant.tess_factors[0] = 5.0f;
ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &constant, 0, 0); ID3D11DeviceContext_UpdateSubresource(context, (ID3D11Resource *)cb, 0, NULL, &constant, 0, 0);
ID3D11DeviceContext_Draw(context, 4, 0); ID3D11DeviceContext_Draw(context, 4, 0);
check_texture_color(test_context.backbuffer, 0xff00ff00, 0); check_texture_color(test_context.backbuffer, 0xff00ff00, 0);
if (query) ID3D11DeviceContext_End(context, query);
for (i = 0; i < 500; ++i)
{ {
ID3D11DeviceContext_End(context, query); if ((hr = ID3D11DeviceContext_GetData(context, query, NULL, 0, 0)) != S_FALSE)
for (i = 0; i < 500; ++i) break;
{ Sleep(10);
if ((hr = ID3D11DeviceContext_GetData(context, query, NULL, 0, 0)) != S_FALSE)
break;
Sleep(10);
}
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3D11DeviceContext_GetData(context, query, &so_statistics, sizeof(so_statistics), 0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(so_statistics.NumPrimitivesWritten == 11, "Got unexpected primitives written %u.\n",
(unsigned int)so_statistics.NumPrimitivesWritten);
ok(so_statistics.PrimitivesStorageNeeded == 11, "Got unexpected primitives storage needed %u.\n",
(unsigned int)so_statistics.PrimitivesStorageNeeded);
ID3D11Asynchronous_Release(query);
} }
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
hr = ID3D11DeviceContext_GetData(context, query, &so_statistics, sizeof(so_statistics), 0);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(so_statistics.NumPrimitivesWritten == 11, "Got unexpected primitives written %u.\n",
(unsigned int)so_statistics.NumPrimitivesWritten);
ok(so_statistics.PrimitivesStorageNeeded == 11, "Got unexpected primitives storage needed %u.\n",
(unsigned int)so_statistics.PrimitivesStorageNeeded);
ID3D11Asynchronous_Release(query);
ID3D11Buffer_Release(so_buffer); ID3D11Buffer_Release(so_buffer);
ID3D11GeometryShader_Release(gs); ID3D11GeometryShader_Release(gs);
......
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