llvmpipe: reintroduce SET_STATE binner command
[mesa.git] / src / gallium / drivers / llvmpipe / lp_setup_line.c
index 829eb8a5a045e8a005bdb93d9c668fbb48f9cbd6..e4cff9aa42ce287b458ac8cee4b4270269a4d010 100644 (file)
@@ -208,6 +208,12 @@ static void setup_line_coefficients( struct lp_setup_context *setup,
          fragcoord_usage_mask |= usage_mask;
          break;
 
+      case LP_INTERP_FACING:
+         for (i = 0; i < NUM_CHANNELS; i++)
+            if (usage_mask & (1 << i))
+               constant_coef(setup, tri, slot+1, 1.0, i);
+         break;
+
       default:
          assert(0);
       }
@@ -469,7 +475,7 @@ try_setup_line( struct lp_setup_context *setup,
       else {
          /* do intersection test */
          float xintersect = fracf(v2[0][0]) + y2diff * dxdy;
-         draw_end = (xintersect < 1.0 && xintersect > 0.0);
+         draw_end = (xintersect < 1.0 && xintersect >= 0.0);
       }
 
       /* Are we already drawing start/end?
@@ -507,7 +513,7 @@ try_setup_line( struct lp_setup_context *setup,
             x_offset_end = y_offset_end * dxdy;
          }
       }
+
       /* x/y positions in fixed point */
       x[0] = subpixel_snap(v1[0][0] + x_offset     - setup->pixel_offset) - fixed_width/2;
       x[1] = subpixel_snap(v2[0][0] + x_offset_end - setup->pixel_offset) - fixed_width/2;
@@ -591,7 +597,6 @@ try_setup_line( struct lp_setup_context *setup,
    setup_line_coefficients( setup, line, &info); 
 
    line->inputs.facing = 1.0F;
-   line->inputs.state = setup->fs.stored;
    line->inputs.disable = FALSE;
    line->inputs.opaque = FALSE;
 
@@ -706,10 +711,11 @@ static void lp_setup_line( struct lp_setup_context *setup,
 {
    if (!try_setup_line( setup, v0, v1 ))
    {
-      lp_setup_flush_and_restart(setup);
+      if (!lp_setup_flush_and_restart(setup))
+         return;
 
       if (!try_setup_line( setup, v0, v1 ))
-         assert(0);
+         return;
    }
 }