~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/amd/vulkan/nir/radv_nir_lower_io.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:
43
43
 
44
44
   NIR_PASS(progress, nir, nir_lower_array_deref_of_vec, mask,
45
45
            nir_lower_direct_array_deref_of_vec_load | nir_lower_indirect_array_deref_of_vec_load |
46
 
               nir_lower_direct_array_deref_of_vec_store |
47
 
               nir_lower_indirect_array_deref_of_vec_store);
 
46
               nir_lower_direct_array_deref_of_vec_store | nir_lower_indirect_array_deref_of_vec_store);
48
47
   NIR_PASS(progress, nir, nir_lower_io_to_scalar_early, mask);
49
48
   if (progress) {
50
49
      /* Optimize the new vector code and then remove dead vars */
69
68
         NIR_PASS(_, nir, nir_opt_copy_prop_vars);
70
69
 
71
70
      NIR_PASS(_, nir, nir_opt_dce);
72
 
      NIR_PASS(_, nir, nir_remove_dead_variables,
73
 
               nir_var_function_temp | nir_var_shader_in | nir_var_shader_out, NULL);
 
71
      NIR_PASS(_, nir, nir_remove_dead_variables, nir_var_function_temp | nir_var_shader_in | nir_var_shader_out, NULL);
74
72
   }
75
73
}
76
74
 
83
81
 
84
82
   if (nir->info.stage == MESA_SHADER_VERTEX) {
85
83
      NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in, type_size_vec4, 0);
86
 
      NIR_PASS(_, nir, nir_lower_io, nir_var_shader_out, type_size_vec4,
87
 
               nir_lower_io_lower_64bit_to_32);
 
84
      NIR_PASS(_, nir, nir_lower_io, nir_var_shader_out, type_size_vec4, nir_lower_io_lower_64bit_to_32);
88
85
   } else {
89
86
      NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out, type_size_vec4,
90
87
               nir_lower_io_lower_64bit_to_32);
117
114
                    info->vs.tcs_temp_only_input_mask);
118
115
         return true;
119
116
      } else if (info->vs.as_es) {
120
 
         NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, NULL,
121
 
                    device->physical_device->rad_info.gfx_level, info->esgs_itemsize);
 
117
         NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, NULL, device->physical_device->rad_info.gfx_level,
 
118
                    info->esgs_itemsize);
122
119
         return true;
123
120
      }
124
121
   } else if (nir->info.stage == MESA_SHADER_TESS_CTRL) {
125
122
      NIR_PASS_V(nir, ac_nir_lower_hs_inputs_to_mem, NULL, info->vs.tcs_in_out_eq);
126
 
      NIR_PASS_V(nir, ac_nir_lower_hs_outputs_to_mem, NULL,
127
 
                 device->physical_device->rad_info.gfx_level, info->tcs.tes_reads_tess_factors,
128
 
                 info->tcs.tes_inputs_read, info->tcs.tes_patch_inputs_read,
129
 
                 info->tcs.num_linked_outputs, info->tcs.num_linked_patch_outputs, info->wave_size,
130
 
                 false, false, true);
 
123
      NIR_PASS_V(nir, ac_nir_lower_hs_outputs_to_mem, NULL, device->physical_device->rad_info.gfx_level,
 
124
                 info->tcs.tes_reads_tess_factors, info->tcs.tes_inputs_read, info->tcs.tes_patch_inputs_read,
 
125
                 info->tcs.num_linked_outputs, info->tcs.num_linked_patch_outputs, info->wave_size, false, false, true);
131
126
 
132
127
      return true;
133
128
   } else if (nir->info.stage == MESA_SHADER_TESS_EVAL) {
134
129
      NIR_PASS_V(nir, ac_nir_lower_tes_inputs_to_mem, NULL);
135
130
 
136
131
      if (info->tes.as_es) {
137
 
         NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, NULL,
138
 
                    device->physical_device->rad_info.gfx_level, info->esgs_itemsize);
 
132
         NIR_PASS_V(nir, ac_nir_lower_es_outputs_to_mem, NULL, device->physical_device->rad_info.gfx_level,
 
133
                    info->esgs_itemsize);
139
134
      }
140
135
 
141
136
      return true;
142
137
   } else if (nir->info.stage == MESA_SHADER_GEOMETRY) {
143
 
      NIR_PASS_V(nir, ac_nir_lower_gs_inputs_to_mem, NULL,
144
 
                 device->physical_device->rad_info.gfx_level, false);
 
138
      NIR_PASS_V(nir, ac_nir_lower_gs_inputs_to_mem, NULL, device->physical_device->rad_info.gfx_level, false);
145
139
      return true;
146
140
   } else if (nir->info.stage == MESA_SHADER_TASK) {
147
141
      ac_nir_lower_task_outputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES,
148
142
                                       device->physical_device->task_info.num_entries);
149
143
      return true;
150
144
   } else if (nir->info.stage == MESA_SHADER_MESH) {
151
 
      ac_nir_lower_mesh_inputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES,
152
 
                                      device->physical_device->task_info.num_entries);
 
145
      ac_nir_lower_mesh_inputs_to_mem(nir, AC_TASK_PAYLOAD_ENTRY_BYTES, device->physical_device->task_info.num_entries);
153
146
      return true;
154
147
   }
155
148