nir: Ignore ray query ranges that don't start with rq_initialize
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Handles is a rare edge case where the ray query is used "before"
there is a rq_initialize.

cc: mesa-stable

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38850>
This commit is contained in:
Konstantin Seurer 2025-12-08 15:34:38 +01:00 committed by Marge Bot
parent 5e03d09eb5
commit 034f58c7e3

View file

@ -300,6 +300,19 @@ nir_opt_ray_query_ranges(nir_shader *shader)
struct hash_entry *index_entry = struct hash_entry *index_entry =
_mesa_hash_table_search(range_indices, ray_query_deref->var); _mesa_hash_table_search(range_indices, ray_query_deref->var);
if (!index_entry) {
/* The range doesn't exist yet which means that the first instruction
* isn't the initialize. Ignore it.
*/
for (uint32_t i = 0; i < ray_query_count; i++) {
if (ray_queries[i] == ray_query_deref->var) {
ray_queries[i] = NULL;
break;
}
}
continue;
}
struct rq_range *range = ranges + (uintptr_t)index_entry->data; struct rq_range *range = ranges + (uintptr_t)index_entry->data;
if (intrinsic->intrinsic != nir_intrinsic_rq_initialize) { if (intrinsic->intrinsic != nir_intrinsic_rq_initialize) {