From 763ddd0fd3f2e437935279f33f2080a01c2be881 Mon Sep 17 00:00:00 2001 From: Danylo Piliaiev Date: Thu, 20 Feb 2025 17:36:28 +0100 Subject: [PATCH] nir/nir_lower_multiview: Don't assert if load_deref doesn't have var If deref chain has nir_deref_type_cast nir_intrinsic_get_var will return null, which is valid for e.g. shader inputs, since the pass only care about outputs. NIR excerpt that caused issues: ``` 32x3 %6 = deref_cast (block *)%5 (ubo block) (ptr_stride=0, align_mul=0, align_offset=0) 32x3 %7 = deref_struct &%6->field0 (ubo vec4[4]) // &((block *)%5)->field0 32 %8 = load_const (0x00000001) 32x3 %9 = deref_array &(*%7)[1] (ubo vec4) // &((block *)%5)->field0[1] 32x4 %10 = @load_deref (%9) (access=none) ``` Signed-off-by: Danylo Piliaiev Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_lower_multiview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_multiview.c b/src/compiler/nir/nir_lower_multiview.c index ec412771201..07c90f2fc23 100644 --- a/src/compiler/nir/nir_lower_multiview.c +++ b/src/compiler/nir/nir_lower_multiview.c @@ -306,7 +306,7 @@ nir_lower_multiview(nir_shader *shader, nir_lower_multiview_options options) case nir_intrinsic_load_deref: { nir_variable *var = nir_intrinsic_get_var(intrin, 0); - if (_mesa_hash_table_search(out_derefs, var)) { + if (var && _mesa_hash_table_search(out_derefs, var)) { unreachable("Should have lowered I/O to temporaries " "so no load_deref on output is expected."); }