lavapipe: Check the pool type in handle_reset_query_pool

Avoids a segmentation fault when resetting acceleration structure
queries.

Fixes: 897ccbd ("lavapipe: Implement VK_KHR_acceleration_structure")
Closes: #12289
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
(cherry picked from commit 23a96b1537)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33113>
This commit is contained in:
Konstantin Seurer
2024-12-12 21:34:41 +01:00
committed by Dylan Baker
parent 1eb956e7f9
commit b1d574c8f3
2 changed files with 5 additions and 1 deletions

View File

@@ -1414,7 +1414,7 @@
"description": "lavapipe: Check the pool type in handle_reset_query_pool",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "897ccbd180ae2e0e6a60173e0511bc25a4f5a118",
"notes": null

View File

@@ -2955,6 +2955,10 @@ static void handle_reset_query_pool(struct vk_cmd_queue_entry *cmd,
{
struct vk_cmd_reset_query_pool *qcmd = &cmd->u.reset_query_pool;
LVP_FROM_HANDLE(lvp_query_pool, pool, qcmd->query_pool);
if (pool->base_type >= PIPE_QUERY_TYPES)
return;
for (unsigned i = qcmd->first_query; i < qcmd->first_query + qcmd->query_count; i++) {
if (pool->queries[i]) {
state->pctx->destroy_query(state->pctx, pool->queries[i]);