zink: remove unused code-path in lower_pos_write
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 19 Dec 2019 13:41:09 +0000 (14:41 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Fri, 3 Jan 2020 22:48:19 +0000 (22:48 +0000)
This code is never reached, because we don't call nir_lower_io before
lowering this. So let's get rid of it.

src/gallium/drivers/zink/zink_compiler.c

index d3eb41e9da85f7ea325b57b0026251f9f81a479f..846efa85e2e74627553ff5f0772ed85b0c40ee9f 100644 (file)
@@ -123,23 +123,17 @@ lower_pos_write(nir_builder *b, struct nir_instr *instr)
       return;
 
    nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
-   struct nir_src *src;
-   if (intr->intrinsic == nir_intrinsic_store_output) {
-      if (nir_intrinsic_base(intr) != VARYING_SLOT_POS)
-         return;
-      src = &intr->src[0];
-   } else if (intr->intrinsic == nir_intrinsic_store_deref) {
-      nir_variable *var = nir_intrinsic_get_var(intr, 0);
-      if (var->data.mode != nir_var_shader_out ||
-          var->data.location != VARYING_SLOT_POS)
-         return;
-      src = &intr->src[1];
-   } else
+   if (intr->intrinsic != nir_intrinsic_store_deref)
+      return;
+
+   nir_variable *var = nir_intrinsic_get_var(intr, 0);
+   if (var->data.mode != nir_var_shader_out ||
+       var->data.location != VARYING_SLOT_POS)
       return;
 
    b->cursor = nir_before_instr(&intr->instr);
 
-   nir_ssa_def *pos = nir_ssa_for_src(b, *src, 4);
+   nir_ssa_def *pos = nir_ssa_for_src(b, intr->src[1], 4);
    nir_ssa_def *def = nir_vec4(b,
                                nir_channel(b, pos, 0),
                                nir_channel(b, pos, 1),
@@ -149,7 +143,7 @@ lower_pos_write(nir_builder *b, struct nir_instr *instr)
                                                      nir_channel(b, pos, 3)),
                                             0.5),
                                nir_channel(b, pos, 3));
-   nir_instr_rewrite_src(&intr->instr, src, nir_src_for_ssa(def));
+   nir_instr_rewrite_src(&intr->instr, intr->src + 1, nir_src_for_ssa(def));
 }
 
 static void