nvk: Implement VK_EXT_primitives_generated_query

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26324>
This commit is contained in:
Mary Guillemard 2023-11-21 19:26:49 +01:00 committed by Marge Bot
parent 7bda83bdfc
commit 5b45304624
3 changed files with 29 additions and 2 deletions

View file

@ -593,7 +593,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_pipeline_robustness DONE (anv, radv, v3dv)
VK_EXT_post_depth_coverage DONE (anv/gfx10+, lvp, radv/gfx10+)
VK_EXT_primitive_topology_list_restart DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn)
VK_EXT_primitives_generated_query DONE (anv, hasvk, lvp, radv, tu, vn)
VK_EXT_primitives_generated_query DONE (anv, hasvk, lvp, nvk, radv, tu, vn)
VK_EXT_provoking_vertex DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn)
VK_EXT_queue_family_foreign DONE (anv, hasvk, radv, tu, vn)
VK_EXT_rasterization_order_attachment_access DONE (lvp, tu, vn)

View file

@ -127,6 +127,7 @@ nvk_get_device_extensions(const struct nv_device_info *info,
.EXT_physical_device_drm = true,
.EXT_primitive_topology_list_restart = true,
.EXT_private_data = true,
.EXT_primitives_generated_query = true,
.EXT_provoking_vertex = true,
.EXT_robustness2 = true,
.EXT_sample_locations = info->cls_eng3d >= MAXWELL_B,
@ -379,6 +380,11 @@ nvk_get_device_features(const struct nv_device_info *info,
.primitiveTopologyListRestart = true,
.primitiveTopologyPatchListRestart = true,
/* VK_EXT_primitives_generated_query */
.primitivesGeneratedQuery = true,
.primitivesGeneratedQueryWithNonZeroStreams = true,
.primitivesGeneratedQueryWithRasterizerDiscard = true,
/* VK_EXT_provoking_vertex */
.provokingVertexLast = true,
.transformFeedbackPreservesProvokingVertex = true,

View file

@ -55,6 +55,7 @@ nvk_CreateQueryPool(VkDevice device,
uint32_t reports_per_query;
switch (pCreateInfo->queryType) {
case VK_QUERY_TYPE_OCCLUSION:
case VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT:
reports_per_query = 2;
break;
case VK_QUERY_TYPE_TIMESTAMP:
@ -174,7 +175,8 @@ emit_zero_queries(struct nvk_cmd_buffer *cmd, struct nvk_query_pool *pool,
switch (pool->vk.query_type) {
case VK_QUERY_TYPE_OCCLUSION:
case VK_QUERY_TYPE_TIMESTAMP:
case VK_QUERY_TYPE_PIPELINE_STATISTICS: {
case VK_QUERY_TYPE_PIPELINE_STATISTICS:
case VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT: {
for (uint32_t i = 0; i < num_queries; i++) {
uint64_t addr = nvk_query_available_addr(pool, first_index + i);
@ -483,6 +485,24 @@ nvk_cmd_begin_end_query(struct nvk_cmd_buffer *cmd,
}
break;
}
case VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT:
p = nvk_cmd_buffer_push(cmd, 5 + end_size);
P_MTHD(p, NV9097, SET_REPORT_SEMAPHORE_A);
P_NV9097_SET_REPORT_SEMAPHORE_A(p, report_addr >> 32);
P_NV9097_SET_REPORT_SEMAPHORE_B(p, report_addr);
P_NV9097_SET_REPORT_SEMAPHORE_C(p, 1);
P_NV9097_SET_REPORT_SEMAPHORE_D(p, {
.operation = OPERATION_REPORT_ONLY,
.pipeline_location = PIPELINE_LOCATION_STREAMING_OUTPUT,
.report = REPORT_VTG_PRIMITIVES_OUT,
.sub_report = index,
.structure_size = STRUCTURE_SIZE_FOUR_WORDS,
.flush_disable = true,
});
break;
default:
unreachable("Unsupported query type");
}
@ -637,6 +657,7 @@ nvk_GetQueryPoolResults(VkDevice device,
uint32_t available_dst_idx = 1;
switch (pool->vk.query_type) {
case VK_QUERY_TYPE_OCCLUSION:
case VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT:
if (write_results)
cpu_get_query_delta(dst, src, 0, flags);
break;