radv: Use an input for the layer when lowering input attachments
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 1 Jul 2020 15:19:11 +0000 (17:19 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 19 Aug 2020 16:36:43 +0000 (16:36 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5719>

src/amd/vulkan/radv_shader.c

index e0e5507e49fe6d722c47b9b09f7c9188edce4e4a..c3a2b538ab7a430147376fac9fee7b081ddae5f9 100644 (file)
@@ -508,7 +508,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
                        NIR_PASS_V(nir, nir_lower_input_attachments,
                                   &(nir_input_attachment_options) {
                                        .use_fragcoord_sysval = true,
-                                       .use_layer_id_sysval = true,
+                                       .use_layer_id_sysval = false,
                                   });
 
                NIR_PASS_V(nir, nir_remove_dead_variables,
@@ -643,13 +643,12 @@ find_layer_in_var(nir_shader *nir)
 }
 
 /* We use layered rendering to implement multiview, which means we need to map
- * view_index to gl_Layer. The attachment lowering also uses needs to know the
- * layer so that it can sample from the correct layer. The code generates a
- * load from the layer_id sysval, but since we don't have a way to get at this
- * information from the fragment shader, we also need to lower this to the
- * gl_Layer varying.  This pass lowers both to a varying load from the LAYER
- * slot, before lowering io, so that nir_assign_var_locations() will give the
- * LAYER varying the correct driver_location.
+ * view_index to gl_Layer. The code generates a load from the layer_id sysval,
+ * but since we don't have a way to get at this information from the fragment
+ * shader, we also need to lower this to the gl_Layer varying.  This pass
+ * lowers both to a varying load from the LAYER slot, before lowering io, so
+ * that nir_assign_var_locations() will give the LAYER varying the correct
+ * driver_location.
  */
 
 static bool
@@ -667,8 +666,7 @@ lower_view_index(nir_shader *nir)
                                continue;
 
                        nir_intrinsic_instr *load = nir_instr_as_intrinsic(instr);
-                       if (load->intrinsic != nir_intrinsic_load_view_index &&
-                           load->intrinsic != nir_intrinsic_load_layer_id)
+                       if (load->intrinsic != nir_intrinsic_load_view_index)
                                continue;
 
                        if (!layer)