From e084211c08fda7dbbcacceb2d74cbeca5191143b Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Mon, 15 Jul 2019 19:24:15 +0200 Subject: [PATCH] zink: fixup boolean queries Acked-by: Jordan Justen --- src/gallium/drivers/zink/zink_query.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index 3d83d76d88e..ee9837332ba 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -6,6 +6,7 @@ #include "util/u_dump.h" struct zink_query { + enum pipe_query_type type; VkQueryPool queryPool; VkQueryType vkqtype; bool use_64bit; @@ -47,6 +48,7 @@ zink_create_query(struct pipe_context *pctx, if (!query) return NULL; + query->type = query_type; query->vkqtype = convert_query_type(query_type, &query->use_64bit, &query->precise); if (query->vkqtype == -1) return NULL; @@ -127,10 +129,25 @@ zink_get_query_result(struct pipe_context *pctx, if (query->use_64bit) flags |= VK_QUERY_RESULT_64_BIT; - VkResult status = vkGetQueryPoolResults(screen->dev, query->queryPool, - 0, 1, sizeof(*result), result, - 0, flags); - return status == VK_SUCCESS; + if (vkGetQueryPoolResults(screen->dev, query->queryPool, + 0, 1, sizeof(*result), result, + 0, flags) != VK_SUCCESS) + return false; + + switch (query->type) { + case PIPE_QUERY_OCCLUSION_PREDICATE: + case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE: + case PIPE_QUERY_SO_OVERFLOW_PREDICATE: + case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE: + case PIPE_QUERY_GPU_FINISHED: + /* fixup bool-queries */ + result->b = result->u32 != 0; + break; + default: + ; /* nothing */ + } + + return TRUE; } void -- 2.30.2