From 70f18499e54d7cac9ff7057789b35c5d5cec37b7 Mon Sep 17 00:00:00 2001 From: Niklas Haas <git@haasn.xyz> Date: Mon, 25 May 2020 13:25:32 +0200 Subject: [PATCH] vulkan: don't try retrieving pending timers I think that in theory, vkGetQueryPoolResults shouldn't have been allowed to report VK_SUCCESS in this case, but at least AMDVLK still does so. Explicitly check to see if the time is pending before attempting to read from it. --- src/vulkan/gpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vulkan/gpu.c b/src/vulkan/gpu.c index 2e7140e94..62e2df8b9 100644 --- a/src/vulkan/gpu.c +++ b/src/vulkan/gpu.c @@ -3143,8 +3143,12 @@ static uint64_t vk_timer_query(const struct pl_gpu *gpu, struct pl_timer *timer) if (timer->index_read == timer->index_write) return 0; // no more unprocessed results + vk_poll_commands(vk, 0); + if (timer->pending & timer_bit(timer->index_read)) + return 0; // still waiting for results + VkResult res; - uint64_t ts[2]; + uint64_t ts[2] = {0}; res = vk->GetQueryPoolResults(vk->dev, timer->qpool, timer->index_read, 2, sizeof(ts), &ts[0], sizeof(uint64_t), VK_QUERY_RESULT_64_BIT); -- GitLab