vc4: Shove some depth comparison bits down to where they're used.
authorEric Anholt <eric@anholt.net>
Mon, 29 Sep 2014 22:31:23 +0000 (15:31 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 30 Sep 2014 00:44:15 +0000 (17:44 -0700)
src/gallium/drivers/vc4/vc4_program.c

index 64faf6f79d28813c1ce307821181d8d579250c5a..6dc42ac3e32242904d2527f6d7105b6ffe66c71e 100644 (file)
@@ -576,13 +576,13 @@ tgsi_to_qir_tex(struct vc4_compile *c,
 
                 struct qreg depth_output;
 
-                struct qreg compare = src[0 * 4 + 2];
-
-                if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXP)
-                        compare = qir_FMUL(c, compare, proj);
-
                 struct qreg one = qir_uniform_f(c, 1.0f);
                 if (c->key->tex[unit].compare_mode) {
+                        struct qreg compare = src[0 * 4 + 2];
+
+                        if (tgsi_inst->Instruction.Opcode == TGSI_OPCODE_TXP)
+                                compare = qir_FMUL(c, compare, proj);
+
                         switch (c->key->tex[unit].compare_func) {
                         case PIPE_FUNC_NEVER:
                                 depth_output = qir_uniform_f(c, 0.0f);