ffvertex: Don't try to read output registers in fog calculation
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 17 Jun 2017 02:02:48 +0000 (19:02 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 4 May 2018 22:27:50 +0000 (15:27 -0700)
Gallium drivers use _mesa_remove_output_reads() via st_program to lower
output reads away.  It seems better to just generate the right thing in
the first place.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/ffvertex_prog.c

index 1c755592bd972e83b99cd00befb158fb33c13b50..dfb494bd8c186a4fdcbc82ff8c58d19cafd7918f 100644 (file)
@@ -1297,12 +1297,14 @@ static void build_fog( struct tnl_program *p )
    struct ureg input;
 
    switch (p->state->fog_distance_mode) {
-   case FDM_EYE_RADIAL: /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */
+   case FDM_EYE_RADIAL: { /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */
+      struct ureg tmp = get_temp(p);
       input = get_eye_position(p);
-      emit_op2(p, OPCODE_DP3, fog, WRITEMASK_X, input, input);
-      emit_op1(p, OPCODE_RSQ, fog, WRITEMASK_X, fog);
-      emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, fog);
+      emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, input, input);
+      emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
+      emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, tmp);
       break;
+   }
    case FDM_EYE_PLANE: /* Z = Ze */
       input = get_eye_position_z(p);
       emit_op1(p, OPCODE_MOV, fog, WRITEMASK_X, input);