nv50: get tri-scissor-tri working
authorBen Skeggs <skeggsb@gmail.com>
Mon, 16 Jun 2008 12:34:50 +0000 (22:34 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 29 Jun 2008 05:46:19 +0000 (15:46 +1000)
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_state_validate.c

index 3e0e523ee3ec6f22e2502765a4f32a59a01fcf4f..4ea01009fb6e0e17c791998f7cec16756dcda7a6 100644 (file)
@@ -84,6 +84,7 @@ struct nv50_state {
        struct nouveau_stateobj *rast;
        struct nouveau_stateobj *stipple;
        struct nouveau_stateobj *scissor;
+       unsigned scissor_enabled;
        struct nouveau_stateobj *viewport;
        struct nouveau_stateobj *tsc_upload;
        struct nouveau_stateobj *tic_upload;
index 566f95f682c9891f924a5bc43a5a25962cb170fd..d99cdc73cac93090192a824663a26ebba2f58e12 100644 (file)
@@ -196,15 +196,28 @@ nv50_state_validate(struct nv50_context *nv50)
                so_ref(so, &nv50->state.stipple);
        }
 
-       if (nv50->dirty & NV50_NEW_SCISSOR) {
+       if (nv50->dirty & (NV50_NEW_SCISSOR | NV50_NEW_RASTERIZER)) {
+               struct pipe_rasterizer_state *rast = &nv50->rasterizer->pipe;
+               struct pipe_scissor_state *s = &nv50->scissor;
+
+               if (nv50->state.scissor &&
+                   (rast->scissor == 0 && nv50->state.scissor_enabled == 0))
+                       goto scissor_uptodate;
+               nv50->state.scissor_enabled = rast->scissor;
+
                so = so_new(3, 0);
-               so_method(so, tesla, NV50TCL_SCISSOR_HORIZ, 2);
-               so_data  (so, (nv50->scissor.maxx << 16) |
-                              nv50->scissor.minx);
-               so_data  (so, (nv50->scissor.maxy << 16) |
-                              nv50->scissor.miny);
+               so_method(so, tesla, 0xff4, 2); //NV50TCL_SCISSOR_HORIZ, 2);
+               if (nv50->state.scissor_enabled) {
+                       so_data(so, ((s->maxx - s->minx) << 16) | s->minx);
+                       so_data(so, ((s->maxy - s->miny) << 16) | s->miny);
+               } else {
+                       so_data(so, (8192 << 16));
+                       so_data(so, (8192 << 16));
+               }
                so_ref(so, &nv50->state.scissor);
+               nv50->state.dirty |= NV50_NEW_SCISSOR;
        }
+scissor_uptodate:
 
        if (nv50->dirty & NV50_NEW_VIEWPORT) {
                so = so_new(8, 0);