From 908bfb2ac97c367b4919773f2e9416395215a185 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 28 Aug 2023 17:49:41 -0700 Subject: [PATCH] nir: Add support for load_frag_coord_zw to nir_opt_fragdepth. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir_opt_fragdepth.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_opt_fragdepth.c b/src/compiler/nir/nir_opt_fragdepth.c index 2c29501d614..4b3e0de16ca 100644 --- a/src/compiler/nir/nir_opt_fragdepth.c +++ b/src/compiler/nir/nir_opt_fragdepth.c @@ -40,11 +40,15 @@ nir_def_is_frag_coord_z(nir_def *def) return false; nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); - if (intrin->intrinsic != nir_intrinsic_load_frag_coord) + switch (intrin->intrinsic) { + case nir_intrinsic_load_frag_coord: + /* Depth is gl_FragCoord.z */ + return scalar.comp == 2; + case nir_intrinsic_load_frag_coord_z: + return true; + default: return false; - - /* Depth is gl_FragCoord.z */ - return scalar.comp == 2; + } } bool