ac/shader: scan output usage mask for VS and TES
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 1 Mar 2018 10:54:19 +0000 (11:54 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 6 Mar 2018 09:37:47 +0000 (10:37 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_shader_info.c
src/amd/common/ac_shader_info.h

index 57d7edec764e737347d8c71be6715ad1f8b58b25..98de963147b13d4f13eaad8851aa352d4c361a0c 100644 (file)
@@ -146,6 +146,24 @@ gather_intrinsic_info(const nir_shader *nir, const nir_intrinsic_instr *instr,
                        }
                }
                break;
+       case nir_intrinsic_store_var: {
+               nir_deref_var *dvar = instr->variables[0];
+               nir_variable *var = dvar->var;
+
+               if (var->data.mode == nir_var_shader_out) {
+                       unsigned idx = var->data.location;
+                       unsigned comp = var->data.location_frac;
+
+                       if (nir->info.stage == MESA_SHADER_VERTEX) {
+                               info->vs.output_usage_mask[idx] |=
+                                       instr->const_index[0] << comp;
+                       } else if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
+                               info->tes.output_usage_mask[idx] |=
+                                       instr->const_index[0] << comp;
+                       }
+               }
+               break;
+       }
        default:
                break;
        }
index 60ddfd2d71b2a0c27c40eabe66ad70c7f1fe25bf..12a1dcf915610dc8a7b1773f1f1982c0071f38d8 100644 (file)
@@ -37,10 +37,14 @@ struct ac_shader_info {
        bool uses_prim_id;
        struct {
                uint8_t input_usage_mask[VERT_ATTRIB_MAX];
+               uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
                bool has_vertex_buffers; /* needs vertex buffers and base/start */
                bool needs_draw_id;
                bool needs_instance_id;
        } vs;
+       struct {
+               uint8_t output_usage_mask[VARYING_SLOT_VAR31 + 1];
+       } tes;
        struct {
                bool force_persample;
                bool needs_sample_positions;