nir: Add support for load_frag_coord_zw to nir_opt_fragdepth.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25190>
This commit is contained in:
Emma Anholt 2023-08-28 17:49:41 -07:00 committed by Marge Bot
parent 3b28604be2
commit 908bfb2ac9

View file

@ -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