From 63fc489471232b4b41640987bd252b8b1a546491 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 21 Apr 2022 07:32:51 -0700 Subject: [PATCH] intel/nir: fix potential invalid function impl ptr usage We keep the nir_builder::impl value around, but we've run some passes that might have change the main function. Signed-off-by: Lionel Landwerlin Fixes: 96fde5518b5c ("intel/rt: Add a helper to create the raygen trampoline shader") Acked-by: Caio Oliveira Part-of: (cherry picked from commit 8d580de4a9dd6ce859a9f0aeadb83cc3c3d4ce5a) --- .pick_status.json | 2 +- src/intel/compiler/brw_nir_rt.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index c52a0bc8fd7..4747f8dcc40 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -481,7 +481,7 @@ "description": "intel/nir: fix potential invalid function impl ptr usage", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "96fde5518b5c47550f0f42f3a0504ccbdc4a4e92" }, diff --git a/src/intel/compiler/brw_nir_rt.c b/src/intel/compiler/brw_nir_rt.c index ad529cdfcce..b124928b293 100644 --- a/src/intel/compiler/brw_nir_rt.c +++ b/src/intel/compiler/brw_nir_rt.c @@ -489,6 +489,7 @@ brw_nir_create_raygen_trampoline(const struct brw_compiler *compiler, NIR_PASS_V(nir, brw_nir_lower_rt_intrinsics, devinfo); + nir_builder_init(&b, nir_shader_get_entrypoint(b.shader)); /* brw_nir_lower_rt_intrinsics will leave us with a btd_global_arg_addr * intrinsic which doesn't exist in compute shaders. We also created one * above when we generated the BTD spawn intrinsic. Now we go through and