draw: associate rhw divide with clipping not viewport flag
[mesa.git] / src / gallium / auxiliary / draw / draw_vs_exec.c
index 487d0ea7f4f4c361f42e3a6a568599b4f41c66eb..c6e503686a6d7cd662e680d61d6390c5d13d100a 100644 (file)
@@ -110,13 +110,20 @@ vs_exec_run( struct draw_vertex_shader *shader,
 
    machine->Consts = (float (*)[4]) draw->user.constants;
    machine->Inputs = ALIGN16_ASSIGN(inputs);
-   machine->Outputs = ALIGN16_ASSIGN(outputs);
+   if (draw->rasterizer->bypass_vs) {
+      /* outputs are just the inputs */
+      machine->Outputs = machine->Inputs;
+   }
+   else {
+      machine->Outputs = ALIGN16_ASSIGN(outputs);
+   }
 
    draw->vertex_fetch.fetch_func( draw, machine, elts, count );
 
-   /* run interpreter */
-   tgsi_exec_machine_run( machine );
-
+   if (!draw->rasterizer->bypass_vs) {
+      /* run interpreter */
+      tgsi_exec_machine_run( machine );
+   }
 
    /* store machine results */
    for (j = 0; j < count; j++) {
@@ -136,14 +143,19 @@ vs_exec_run( struct draw_vertex_shader *shader,
 
       if (!draw->rasterizer->bypass_clipping) {
          vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes);
-         vOut[j]->edgeflag = 1;
 
          /* divide by w */
          w = 1.0f / w;
          x *= w;
          y *= w;
-         z *= w;
-         
+         z *= w;         
+      }
+      else {
+         vOut[j]->clipmask = 0;
+      }
+      vOut[j]->edgeflag = 1;
+
+      if (!draw->identity_viewport) {
          /* Viewport mapping */
          vOut[j]->data[0][0] = x * scale[0] + trans[0];
          vOut[j]->data[0][1] = y * scale[1] + trans[1];
@@ -151,8 +163,6 @@ vs_exec_run( struct draw_vertex_shader *shader,
          vOut[j]->data[0][3] = w;
       }
       else {
-         vOut[j]->clipmask = 0;
-         vOut[j]->edgeflag = 1;
          vOut[j]->data[0][0] = x;
          vOut[j]->data[0][1] = y;
          vOut[j]->data[0][2] = z;