From 269fbcb144c5b8642c2b5f560e3cdb955d9c3dd1 Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Fri, 21 Feb 2025 10:49:58 -0800 Subject: [PATCH] intel/elk: Use pixel_z for gl_FragCoord.z on pre-gen6. Unless I've seriously missed something, we have the Z in the payload (which we can always request if we need access to it and it's not already passed to us due other WM IZ settings). total instructions in shared programs: 4408303 -> 4408186 (<.01%) instructions in affected programs: 1164 -> 1047 (-10.05%) total cycles in shared programs: 142485036 -> 142484566 (<.01%) cycles in affected programs: 26820 -> 26350 (-1.75%) Reviewed-by: Alyssa Rosenzweig Part-of: --- src/intel/compiler/elk/elk_fs_nir.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/intel/compiler/elk/elk_fs_nir.cpp b/src/intel/compiler/elk/elk_fs_nir.cpp index 721a66ead5c..c4458e35eb4 100644 --- a/src/intel/compiler/elk/elk_fs_nir.cpp +++ b/src/intel/compiler/elk/elk_fs_nir.cpp @@ -3920,13 +3920,7 @@ fs_nir_emit_fs_intrinsic(nir_to_elk_state &ntb, break; case nir_intrinsic_load_frag_coord_z: - if (devinfo->ver >= 6) { - bld.MOV(dest, s.pixel_z); - } else { - bld.emit(ELK_FS_OPCODE_LINTERP, dest, - s.delta_xy[ELK_BARYCENTRIC_PERSPECTIVE_PIXEL], - s.interp_reg(bld, VARYING_SLOT_POS, 2, 0)); - } + bld.MOV(dest, s.pixel_z); break; case nir_intrinsic_load_frag_coord_w: