mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
wined3d: Implement stream output queries for the Vulkan adapter.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cee2e53c3b
commit
e1e28fe60d
3 changed files with 55 additions and 2 deletions
|
@ -1240,6 +1240,14 @@ bool wined3d_context_vk_allocate_query(struct wined3d_context_vk *context_vk,
|
|||
free_pools = &context_vk->free_pipeline_statistics_query_pools;
|
||||
break;
|
||||
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM2:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3:
|
||||
free_pools = &context_vk->free_stream_output_statistics_query_pools;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled query type %#x.\n", type);
|
||||
return false;
|
||||
|
@ -1303,6 +1311,7 @@ void wined3d_context_vk_cleanup(struct wined3d_context_vk *context_vk)
|
|||
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_occlusion_query_pools);
|
||||
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_timestamp_query_pools);
|
||||
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_pipeline_statistics_query_pools);
|
||||
wined3d_context_vk_destroy_query_pools(context_vk, &context_vk->free_stream_output_statistics_query_pools);
|
||||
wine_rb_destroy(&context_vk->bo_slab_available, wined3d_context_vk_destroy_bo_slab, context_vk);
|
||||
heap_free(context_vk->pending_queries.queries);
|
||||
heap_free(context_vk->submitted.buffers);
|
||||
|
@ -3159,6 +3168,7 @@ HRESULT wined3d_context_vk_init(struct wined3d_context_vk *context_vk, struct wi
|
|||
list_init(&context_vk->free_occlusion_query_pools);
|
||||
list_init(&context_vk->free_timestamp_query_pools);
|
||||
list_init(&context_vk->free_pipeline_statistics_query_pools);
|
||||
list_init(&context_vk->free_stream_output_statistics_query_pools);
|
||||
|
||||
wine_rb_init(&context_vk->render_passes, wined3d_render_pass_vk_compare);
|
||||
wine_rb_init(&context_vk->pipeline_layouts, wined3d_pipeline_layout_vk_compare);
|
||||
|
|
|
@ -1423,6 +1423,15 @@ bool wined3d_query_pool_vk_init(struct wined3d_query_pool_vk *pool_vk,
|
|||
| VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT;
|
||||
break;
|
||||
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM2:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3:
|
||||
pool_info.queryType = VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT;
|
||||
pool_info.pipelineStatistics = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled query type %#x.\n", type);
|
||||
return false;
|
||||
|
@ -1452,6 +1461,7 @@ bool wined3d_query_vk_accumulate_data(struct wined3d_query_vk *query_vk,
|
|||
uint64_t occlusion;
|
||||
uint64_t timestamp;
|
||||
struct wined3d_query_data_pipeline_statistics pipeline_statistics;
|
||||
struct wined3d_query_data_so_statistics so_statistics;
|
||||
} tmp, *result;
|
||||
|
||||
if ((vr = VK_CALL(vkGetQueryPoolResults(device_vk->vk_device, pool_idx->pool_vk->vk_query_pool,
|
||||
|
@ -1491,6 +1501,15 @@ bool wined3d_query_vk_accumulate_data(struct wined3d_query_vk *query_vk,
|
|||
ps_result->cs_invocations += ps_tmp->cs_invocations;
|
||||
break;
|
||||
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM2:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3:
|
||||
result->so_statistics.primitives_written += tmp.so_statistics.primitives_written;
|
||||
result->so_statistics.primitives_generated += tmp.so_statistics.primitives_generated;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled query type %#x.\n", query_vk->q.type);
|
||||
return false;
|
||||
|
@ -1516,7 +1535,12 @@ static void wined3d_query_vk_begin(struct wined3d_query_vk *query_vk,
|
|||
idx = query_vk->pool_idx.idx;
|
||||
|
||||
VK_CALL(vkCmdResetQueryPool(vk_command_buffer, pool_vk->vk_query_pool, idx, 1));
|
||||
VK_CALL(vkCmdBeginQuery(vk_command_buffer, pool_vk->vk_query_pool, idx, query_vk->control_flags));
|
||||
if (query_vk->q.type >= WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1
|
||||
&& query_vk->q.type <= WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3)
|
||||
VK_CALL(vkCmdBeginQueryIndexedEXT(vk_command_buffer, pool_vk->vk_query_pool, idx,
|
||||
query_vk->control_flags, query_vk->q.type - WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0));
|
||||
else
|
||||
VK_CALL(vkCmdBeginQuery(vk_command_buffer, pool_vk->vk_query_pool, idx, query_vk->control_flags));
|
||||
wined3d_context_vk_reference_query(context_vk, query_vk);
|
||||
}
|
||||
|
||||
|
@ -1530,7 +1554,12 @@ static void wined3d_query_vk_end(struct wined3d_query_vk *query_vk,
|
|||
pool_vk = query_vk->pool_idx.pool_vk;
|
||||
idx = query_vk->pool_idx.idx;
|
||||
|
||||
VK_CALL(vkCmdEndQuery(vk_command_buffer, pool_vk->vk_query_pool, idx));
|
||||
if (query_vk->q.type >= WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1
|
||||
&& query_vk->q.type <= WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3)
|
||||
VK_CALL(vkCmdEndQueryIndexedEXT(vk_command_buffer, pool_vk->vk_query_pool,
|
||||
idx, query_vk->q.type - WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0));
|
||||
else
|
||||
VK_CALL(vkCmdEndQuery(vk_command_buffer, pool_vk->vk_query_pool, idx));
|
||||
}
|
||||
|
||||
void wined3d_query_vk_resume(struct wined3d_query_vk *query_vk, struct wined3d_context_vk *context_vk)
|
||||
|
@ -1803,6 +1832,19 @@ HRESULT wined3d_query_vk_create(struct wined3d_device *device, enum wined3d_quer
|
|||
data_size = sizeof(struct wined3d_query_data_pipeline_statistics);
|
||||
break;
|
||||
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM0:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM1:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM2:
|
||||
case WINED3D_QUERY_TYPE_SO_STATISTICS_STREAM3:
|
||||
if (!wined3d_adapter_vk(device->adapter)->vk_info.supported[WINED3D_VK_EXT_TRANSFORM_FEEDBACK])
|
||||
{
|
||||
WARN("Stream output queries not supported.\n");
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
data_size = sizeof(struct wined3d_query_data_so_statistics);
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled query type %#x.\n", type);
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
|
|
@ -2515,6 +2515,7 @@ struct wined3d_context_vk
|
|||
struct list free_occlusion_query_pools;
|
||||
struct list free_timestamp_query_pools;
|
||||
struct list free_pipeline_statistics_query_pools;
|
||||
struct list free_stream_output_statistics_query_pools;
|
||||
|
||||
struct wined3d_retired_objects_vk retired;
|
||||
struct wine_rb_tree render_passes;
|
||||
|
|
Loading…
Reference in a new issue