~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/compiler/nir/nir_linking_helpers.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
static void
81
81
tcs_add_output_reads(nir_shader *shader, uint64_t *read, uint64_t *patches_read)
82
82
{
83
 
   nir_foreach_function(function, shader) {
84
 
      if (!function->impl)
85
 
         continue;
86
 
 
87
 
      nir_foreach_block(block, function->impl) {
 
83
   nir_foreach_function_impl(impl, shader) {
 
84
      nir_foreach_block(block, impl) {
88
85
         nir_foreach_instr(instr, block) {
89
86
            if (instr->type != nir_instr_type_intrinsic)
90
87
               continue;
598
595
         if (in_var->data.location < VARYING_SLOT_VAR0)
599
596
            continue;
600
597
 
 
598
         /* Do not remap per-vertex shader inputs because it's an array of
 
599
          * 3-elements and this isn't supported.
 
600
          */
 
601
         if (in_var->data.per_vertex)
 
602
            continue;
 
603
 
601
604
         unsigned location = in_var->data.location - VARYING_SLOT_VAR0;
602
605
         if (location >= MAX_VARYINGS_INCL_PATCH)
603
606
            continue;
998
1001
does_varying_match(nir_variable *out_var, nir_variable *in_var)
999
1002
{
1000
1003
   return in_var->data.location == out_var->data.location &&
1001
 
          in_var->data.location_frac == out_var->data.location_frac;
 
1004
          in_var->data.location_frac == out_var->data.location_frac &&
 
1005
          in_var->type == out_var->type;
1002
1006
}
1003
1007
 
1004
1008
static nir_variable *
1043
1047
{
1044
1048
   nir_function_impl *impl = nir_shader_get_entrypoint(shader);
1045
1049
 
1046
 
   nir_builder b;
1047
 
   nir_builder_init(&b, impl);
 
1050
   nir_builder b = nir_builder_create(impl);
1048
1051
 
1049
 
   nir_variable *out_var =
1050
 
      nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0]));
 
1052
   nir_variable *out_var = nir_intrinsic_get_var(store_intr, 0);
1051
1053
 
1052
1054
   bool progress = false;
1053
1055
   nir_foreach_block(block, impl) {
1095
1097
 
1096
1098
   nir_function_impl *impl = nir_shader_get_entrypoint(shader);
1097
1099
 
1098
 
   nir_builder b;
1099
 
   nir_builder_init(&b, impl);
 
1100
   nir_builder b = nir_builder_create(impl);
1100
1101
 
1101
 
   nir_variable *dup_out_var =
1102
 
      nir_deref_instr_get_variable(nir_src_as_deref(dup_store_intr->src[0]));
 
1102
   nir_variable *dup_out_var = nir_intrinsic_get_var(dup_store_intr, 0);
1103
1103
 
1104
1104
   bool progress = false;
1105
1105
   nir_foreach_block(block, impl) {
1119
1119
 
1120
1120
         if (!does_varying_match(dup_out_var, in_var) ||
1121
1121
             in_var->data.interpolation != input_var->data.interpolation ||
1122
 
             get_interp_loc(in_var) != get_interp_loc(input_var))
 
1122
             get_interp_loc(in_var) != get_interp_loc(input_var) ||
 
1123
             in_var->data.per_vertex)
1123
1124
            continue;
1124
1125
 
1125
1126
         b.cursor = nir_before_instr(instr);
1230
1231
{
1231
1232
   nir_function_impl *impl = nir_shader_get_entrypoint(shader);
1232
1233
 
1233
 
   nir_builder b;
1234
 
   nir_builder_init(&b, impl);
 
1234
   nir_builder b = nir_builder_create(impl);
1235
1235
 
1236
 
   nir_variable *out_var =
1237
 
      nir_deref_instr_get_variable(nir_src_as_deref(store_intr->src[0]));
 
1236
   nir_variable *out_var = nir_intrinsic_get_var(store_intr, 0);
1238
1237
 
1239
1238
   nir_intrinsic_instr *load = nir_instr_as_intrinsic(scalar->def->parent_instr);
1240
1239
   nir_deref_instr *deref = nir_src_as_deref(load->src[0]);