turnip: set load_layer_id to zero
authorJonathan Marek <jonathan@marek.ca>
Thu, 12 Dec 2019 21:58:56 +0000 (16:58 -0500)
committerJonathan Marek <jonathan@marek.ca>
Fri, 13 Dec 2019 01:33:17 +0000 (20:33 -0500)
We don't have layered rendering and ir3 doesn't support this intrinsic, so
just set it to zero for now.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/freedreno/vulkan/tu_shader.c

index 24b4dc3e75dc503d83c6afbfe5cd5424904ca27c..a220f8ce4dff0a5ee00e94955dd6b19a8c7fe850 100644 (file)
@@ -225,6 +225,14 @@ static bool
 lower_intrinsic(nir_builder *b, nir_intrinsic_instr *instr,
                 struct tu_shader *shader)
 {
+   /* TODO: remove this when layered rendering is implemented */
+   if (instr->intrinsic == nir_intrinsic_load_layer_id) {
+      nir_ssa_def_rewrite_uses(&instr->dest.ssa,
+                               nir_src_for_ssa(nir_imm_int(b, 0)));
+      nir_instr_remove(&instr->instr);
+      return true;
+   }
+
    if (instr->intrinsic == nir_intrinsic_load_push_constant) {
       /* note: ir3 wants load_ubo, not load_uniform */
       assert(nir_intrinsic_base(instr) == 0);