asahi: Identify depth clip mode bit

Setting this bit (at the batch level, not the draw level!) switches to
[-1, 1] clipping instead of Metal's preferred [0, 1] clipping. Using
this bit allows us to drop the clip_halfz lowering we had before, saving
2 instructions in every vertex shader.

Fixes dEQP-GLES2.functional.depth_range.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17948>
This commit is contained in:
Alyssa Rosenzweig
2022-08-07 19:17:40 -04:00
committed by Marge Bot
parent a6f88863f6
commit 5fd8ae1541
5 changed files with 5 additions and 17 deletions

View File

@@ -1673,13 +1673,6 @@ agx_compile_shader_nir(nir_shader *nir,
NIR_PASS_V(nir, nir_lower_vars_to_scratch, nir_var_function_temp, 16,
glsl_get_natural_size_align_bytes);
NIR_PASS_V(nir, nir_lower_indirect_derefs, nir_var_function_temp, ~0);
if (ctx->stage == MESA_SHADER_VERTEX) {
/* Lower from OpenGL [-1, 1] to [0, 1] if half-z is not set */
if (!key->vs.clip_halfz)
NIR_PASS_V(nir, nir_lower_clip_halfz);
}
NIR_PASS_V(nir, nir_split_var_copies);
NIR_PASS_V(nir, nir_lower_global_vars_to_local);
NIR_PASS_V(nir, nir_lower_var_copies);