nv50: get clear-scissor working
authorBen Skeggs <skeggsb@gmail.com>
Thu, 10 Jul 2008 15:53:28 +0000 (01:53 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Thu, 10 Jul 2008 15:53:28 +0000 (01:53 +1000)
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_state_validate.c

index 4ea01009fb6e0e17c791998f7cec16756dcda7a6..9b77fc1225d1d455067b25e71b22c982337086b8 100644 (file)
@@ -86,6 +86,7 @@ struct nv50_state {
        struct nouveau_stateobj *scissor;
        unsigned scissor_enabled;
        struct nouveau_stateobj *viewport;
+       unsigned viewport_bypass;
        struct nouveau_stateobj *tsc_upload;
        struct nouveau_stateobj *tic_upload;
        struct nouveau_stateobj *vertprog;
index 88ef685bb1f2b0bd0f5c0ae2678631169f274ccc..bd1f048f878b64d21132ed4a09a4d1a55983e1f0 100644 (file)
@@ -228,17 +228,43 @@ nv50_state_validate(struct nv50_context *nv50)
 scissor_uptodate:
 
        if (nv50->dirty & NV50_NEW_VIEWPORT) {
-               so = so_new(8, 0);
-               so_method(so, tesla, NV50TCL_VIEWPORT_UNK1(0), 3);
-               so_data  (so, fui(nv50->viewport.translate[0]));
-               so_data  (so, fui(nv50->viewport.translate[1]));
-               so_data  (so, fui(nv50->viewport.translate[2]));
-               so_method(so, tesla, NV50TCL_VIEWPORT_UNK0(0), 3);
-               so_data  (so, fui(nv50->viewport.scale[0]));
-               so_data  (so, fui(-nv50->viewport.scale[1]));
-               so_data  (so, fui(nv50->viewport.scale[2]));
+               unsigned bypass;
+
+               if (!nv50->rasterizer->pipe.bypass_clipping)
+                       bypass = 0;
+               else
+                       bypass = 1;
+
+               if (nv50->state.viewport &&
+                   (bypass || !(nv50->dirty & NV50_NEW_VIEWPORT)) &&
+                   nv50->state.viewport_bypass == bypass)
+                       goto viewport_uptodate;
+               nv50->state.viewport_bypass = bypass;
+
+               so = so_new(12, 0);
+               if (!bypass) {
+                       so_method(so, tesla, NV50TCL_VIEWPORT_UNK1(0), 3);
+                       so_data  (so, fui(nv50->viewport.translate[0]));
+                       so_data  (so, fui(nv50->viewport.translate[1]));
+                       so_data  (so, fui(nv50->viewport.translate[2]));
+                       so_method(so, tesla, NV50TCL_VIEWPORT_UNK0(0), 3);
+                       so_data  (so, fui(nv50->viewport.scale[0]));
+                       so_data  (so, fui(-nv50->viewport.scale[1]));
+                       so_data  (so, fui(nv50->viewport.scale[2]));
+                       so_method(so, tesla, 0x192c, 1);
+                       so_data  (so, 1);
+                       so_method(so, tesla, 0x0f90, 1);
+                       so_data  (so, 0);
+               } else {
+                       so_method(so, tesla, 0x192c, 1);
+                       so_data  (so, 0);
+                       so_method(so, tesla, 0x0f90, 1);
+                       so_data  (so, 1);
+               }
+
                so_ref(so, &nv50->state.viewport);
        }
+viewport_uptodate:
 
        if (nv50->dirty & NV50_NEW_SAMPLER) {
                int i;