nir/lower_input_attachments: Refactor to use an options struct

While we're at it, fold the details of how to load the fragcoord into
load_fragcoord().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5719>
This commit is contained in:
Connor Abbott
2020-07-01 16:55:46 +02:00
committed by Marge Bot
parent 340c73d4ef
commit e72895767b
5 changed files with 32 additions and 15 deletions

View File

@@ -505,7 +505,10 @@ radv_shader_compile_to_nir(struct radv_device *device,
!radv_use_llvm_for_stage(device, nir->info.stage))
NIR_PASS_V(nir, nir_lower_io_to_vector, nir_var_shader_out);
if (nir->info.stage == MESA_SHADER_FRAGMENT)
NIR_PASS_V(nir, nir_lower_input_attachments, true);
NIR_PASS_V(nir, nir_lower_input_attachments,
&(nir_input_attachment_options) {
.use_fragcoord_sysval = true,
});
NIR_PASS_V(nir, nir_remove_dead_variables,
nir_var_shader_in | nir_var_shader_out | nir_var_system_value | nir_var_mem_shared,