gallium/drivers: Remove unnecessary semicolons
[mesa.git] / src / gallium / drivers / r300 / compiler / radeon_program_alu.c
index f4ee86de5d0424d74999d27eb358051f4cb35605..c8aabc255d08f68624921c0b99cac54cc3ecc25c 100644 (file)
@@ -1209,14 +1209,14 @@ int radeonTransformDeriv(struct radeon_compiler* c,
 /**
  * IF Temp[0].x -> IF Temp[0].x
  * ...          -> ...
- * KILP         -> KIL -abs(Temp[0].x)
+ * KILL         -> KIL -abs(Temp[0].x)
  * ...          -> ...
  * ENDIF        -> ENDIF
  *
  * === OR ===
  *
  * IF Temp[0].x -\
- * KILP         - > KIL -abs(Temp[0].x)
+ * KILL         - > KIL -abs(Temp[0].x)
  * ENDIF        -/
  *
  * === OR ===
@@ -1225,18 +1225,18 @@ int radeonTransformDeriv(struct radeon_compiler* c,
  * ...          -> ...
  * ELSE         -> ELSE
  * ...         -> ...
- * KILP                -> KIL -abs(Temp[0].x)
+ * KILL                -> KIL -abs(Temp[0].x)
  * ...          -> ...
  * ENDIF        -> ENDIF
  *
  * === OR ===
  *
- * KILP         -> KIL -none.1111
+ * KILL         -> KIL -none.1111
  *
  * This needs to be done in its own pass, because it might modify the
- * instructions before and after KILP.
+ * instructions before and after KILL.
  */
-void rc_transform_KILP(struct radeon_compiler * c, void *user)
+void rc_transform_KILL(struct radeon_compiler * c, void *user)
 {
        struct rc_instruction * inst;
        for (inst = c->Program.Instructions.Next;
@@ -1283,3 +1283,31 @@ void rc_transform_KILP(struct radeon_compiler * c, void *user)
                }
        }
 }
+
+int rc_force_output_alpha_to_one(struct radeon_compiler *c,
+                                struct rc_instruction *inst, void *data)
+{
+       struct r300_fragment_program_compiler *fragc = (struct r300_fragment_program_compiler*)c;
+       const struct rc_opcode_info *info = rc_get_opcode_info(inst->U.I.Opcode);
+       unsigned tmp;
+
+       if (!info->HasDstReg || inst->U.I.DstReg.File != RC_FILE_OUTPUT ||
+           inst->U.I.DstReg.Index == fragc->OutputDepth)
+               return 1;
+
+       tmp = rc_find_free_temporary(c);
+
+       /* Insert MOV after inst, set alpha to 1. */
+       emit1(c, inst, RC_OPCODE_MOV, 0, inst->U.I.DstReg,
+             srcregswz(RC_FILE_TEMPORARY, tmp, RC_SWIZZLE_XYZ1));
+
+       /* Re-route the destination of inst to the source of mov. */
+       inst->U.I.DstReg.File = RC_FILE_TEMPORARY;
+       inst->U.I.DstReg.Index = tmp;
+
+       /* Move the saturate output modifier to the MOV instruction
+        * (for better copy propagation). */
+       inst->Next->U.I.SaturateMode = inst->U.I.SaturateMode;
+       inst->U.I.SaturateMode = RC_SATURATE_NONE;
+       return 1;
+}