From 5ffa4d879c3008fdae50ea77e0c245206653a0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 30 Dec 2023 16:43:35 -0500 Subject: [PATCH] nir: add a lower_mediump_io callback into options This will be called by the GLSL linker before nir_opt_varyings. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/nir/nir.h | 5 +++++ src/compiler/nir/nir_lower_io.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index c34a8ba99a6..ee48b7c2135 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4063,6 +4063,11 @@ typedef struct nir_shader_compiler_options { /** Options determining lowering and behavior of inputs and outputs. */ nir_io_options io_options; + + /** Driver callback where drivers can define how to lower mediump. + * Used by nir_lower_io_passes. + */ + void (*lower_mediump_io)(struct nir_shader *nir); } nir_shader_compiler_options; typedef struct nir_shader { diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 247282d8e9e..2f388abae80 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -3259,5 +3259,8 @@ nir_lower_io_passes(nir_shader *nir, bool renumber_vs_inputs) if (nir->xfb_info) NIR_PASS_V(nir, nir_io_add_intrinsic_xfb_info); + if (nir->options->lower_mediump_io) + nir->options->lower_mediump_io(nir); + nir->info.io_lowered = true; }