r300g/swtcl: fix WPOS
authorMarek Olšák <maraeo@gmail.com>
Thu, 27 May 2010 23:39:27 +0000 (01:39 +0200)
committerMarek Olšák <maraeo@gmail.com>
Fri, 28 May 2010 01:30:11 +0000 (03:30 +0200)
There you are! r300->viewport_state is undefined when using SW TCL.

Piglit score (r300g.tests):
HW TCL: 231/275
SW TCL: 233/275

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_vs_draw.c

index 123b084b2b48a98c61ca668540293705618fd2ae..a55a545e1c9b93eb7f9ad1183987ce957dcc9d12 100644 (file)
@@ -134,7 +134,6 @@ static const float * get_rc_constant_state(
     struct r300_context * r300,
     struct rc_constant * constant)
 {
-    struct r300_viewport_state* viewport = r300->viewport_state.state;
     struct r300_textures_state* texstate = r300->textures_state.state;
     static float vec[4] = { 0.0, 0.0, 0.0, 1.0 };
     struct pipe_resource *tex;
@@ -151,15 +150,15 @@ static const float * get_rc_constant_state(
             break;
 
         case RC_STATE_R300_VIEWPORT_SCALE:
-            vec[0] = viewport->xscale;
-            vec[1] = viewport->yscale;
-            vec[2] = viewport->zscale;
+            vec[0] = r300->viewport.scale[0];
+            vec[1] = r300->viewport.scale[1];
+            vec[2] = r300->viewport.scale[2];
             break;
 
         case RC_STATE_R300_VIEWPORT_OFFSET:
-            vec[0] = viewport->xoffset;
-            vec[1] = viewport->yoffset;
-            vec[2] = viewport->zoffset;
+            vec[0] = r300->viewport.translate[0];
+            vec[1] = r300->viewport.translate[1];
+            vec[2] = r300->viewport.translate[2];
             break;
 
         default:
index 5858492a0a8c58babc00dfc466a801dc8f49503a..d64040b8911ae37bc2b74ed32453f514ba33ed16 100644 (file)
@@ -352,7 +352,7 @@ void r300_draw_init_vertex_shader(struct draw_context *draw,
     /* Init the VS output table for the rasterizer. */
     r300_init_vs_outputs(vs);
 
-    /**/
+    /* Make the last generic be WPOS. */
+    vs->outputs.wpos = vs->outputs.generic[transform.last_generic + 1];
     vs->outputs.generic[transform.last_generic + 1] = ATTR_UNUSED;
-    vs->outputs.wpos -= 1;
 }