From 264ab6ffcdab90fd0295a06a697a78beb39aedbd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 22 Jul 2019 21:20:29 -0400 Subject: [PATCH] radeonsi/nir: set tgsi_shader_info::uses_fbfetch for KHR_blend_equation_adv. This doesn't implement the color buffer load. Reviewed-by: Pierre-Eric Pelloux-Prayer --- src/gallium/drivers/radeonsi/si_shader_nir.c | 28 ++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 0f964bda88f..db40c04eb66 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -52,10 +52,10 @@ static nir_variable* intrinsic_get_var(nir_intrinsic_instr *instr) return nir_deref_instr_get_variable(nir_src_as_deref(instr->src[0])); } -static void gather_intrinsic_load_deref_info(const nir_shader *nir, - const nir_intrinsic_instr *instr, - nir_variable *var, - struct tgsi_shader_info *info) +static void gather_intrinsic_load_deref_input_info(const nir_shader *nir, + const nir_intrinsic_instr *instr, + nir_variable *var, + struct tgsi_shader_info *info) { assert(var && var->data.mode == nir_var_shader_in); @@ -89,6 +89,22 @@ static void gather_intrinsic_load_deref_info(const nir_shader *nir, } } +static void gather_intrinsic_load_deref_output_info(const nir_shader *nir, + const nir_intrinsic_instr *instr, + nir_variable *var, + struct tgsi_shader_info *info) +{ + assert(var && var->data.mode == nir_var_shader_out); + + switch (nir->info.stage) { + case MESA_SHADER_FRAGMENT: + if (var->data.fb_fetch_output) + info->uses_fbfetch = true; + break; + default:; + } +} + static void scan_instruction(const struct nir_shader *nir, struct tgsi_shader_info *info, nir_instr *instr) @@ -257,7 +273,7 @@ static void scan_instruction(const struct nir_shader *nir, glsl_get_base_type(glsl_without_array(var->type)); if (mode == nir_var_shader_in) { - gather_intrinsic_load_deref_info(nir, intr, var, info); + gather_intrinsic_load_deref_input_info(nir, intr, var, info); switch (var->data.interpolation) { case INTERP_MODE_NONE: @@ -283,6 +299,8 @@ static void scan_instruction(const struct nir_shader *nir, info->uses_linear_center = true; break; } + } else if (mode == nir_var_shader_out) { + gather_intrinsic_load_deref_output_info(nir, intr, var, info); } break; } -- 2.30.2