radeonsi/nir: set tgsi_shader_info::uses_fbfetch for KHR_blend_equation_adv.
authorMarek Olšák <marek.olsak@amd.com>
Tue, 23 Jul 2019 01:20:29 +0000 (21:20 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 23 Jul 2019 19:08:37 +0000 (15:08 -0400)
This doesn't implement the color buffer load.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
src/gallium/drivers/radeonsi/si_shader_nir.c

index 0f964bda88f79d427c2993e4cd7f717cc5f33ffd..db40c04eb66decb414f3b4b444f232ecd676de8e 100644 (file)
@@ -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;
                }