nv40: do full swtnl fallback when edge flags present.
authorBen Skeggs <skeggsb@gmail.com>
Mon, 28 Apr 2008 05:42:19 +0000 (15:42 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Mon, 28 Apr 2008 09:25:40 +0000 (19:25 +1000)
This isn't necessary, with some effort we can do this on the hw.  However,
until I encounter something "real" that uses them there's not a lot of
point.

src/gallium/drivers/nv40/nv40_context.c
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv40/nv40_state_emit.c
src/gallium/drivers/nv40/nv40_vbo.c

index f1d4f3c76f1a2c4ce19bf2e1e2e7880022bba53a..f9c93f7a2d7c84d6a301f66714c0e3b3557a5024 100644 (file)
@@ -32,11 +32,6 @@ nv40_destroy(struct pipe_context *pipe)
        FREE(nv40);
 }
 
-static void
-nv40_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
-{
-}
-
 struct pipe_context *
 nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
 {
@@ -58,7 +53,6 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id)
        nv40->pipe.winsys = ws;
        nv40->pipe.screen = pscreen;
        nv40->pipe.destroy = nv40_destroy;
-       nv40->pipe.set_edgeflags = nv40_set_edgeflags;
        nv40->pipe.draw_arrays = nv40_draw_arrays;
        nv40->pipe.draw_elements = nv40_draw_elements;
        nv40->pipe.clear = nv40_clear;
index 2f10540ff0c491ef8884514c08edc3345b9f729a..24e8cd233796c2b672ecb6111c3629c10fa1da2d 100644 (file)
@@ -155,6 +155,7 @@ struct nv40_context {
        unsigned vtxbuf_nr;
        struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
        unsigned vtxelt_nr;
+       const unsigned *edgeflags;
 };
 
 static INLINE struct nv40_context *
index 997beca883ab7428f388273b7c5c29dbb46935ac..2d921d2b8a446549cc6fec6219dbc8bd443072d5 100644 (file)
@@ -680,6 +680,16 @@ nv40_set_vertex_elements(struct pipe_context *pipe, unsigned count,
        nv40->draw_dirty |= NV40_NEW_ARRAYS;
 }
 
+static void
+nv40_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
+{
+       struct nv40_context *nv40 = nv40_context(pipe);
+
+       nv40->edgeflags = bitfield;
+       nv40->dirty |= NV40_NEW_ARRAYS;
+       nv40->draw_dirty |= NV40_NEW_ARRAYS;
+}
+
 void
 nv40_init_state_functions(struct nv40_context *nv40)
 {
@@ -719,6 +729,7 @@ nv40_init_state_functions(struct nv40_context *nv40)
        nv40->pipe.set_scissor_state = nv40_set_scissor_state;
        nv40->pipe.set_viewport_state = nv40_set_viewport_state;
 
+       nv40->pipe.set_edgeflags = nv40_set_edgeflags;
        nv40->pipe.set_vertex_buffers = nv40_set_vertex_buffers;
        nv40->pipe.set_vertex_elements = nv40_set_vertex_elements;
 }
index 864dfc2e0c3d3b1520fb6be91e5965995be8f8c5..ab88dc416e5d54c6c76d823bc9411600ea5405ef 100644 (file)
@@ -167,6 +167,7 @@ nv40_state_validate_swtnl(struct nv40_context *nv40)
                draw_set_viewport_state(draw, &nv40->viewport);
 
        if (nv40->draw_dirty & NV40_NEW_ARRAYS) {
+               draw_set_edgeflags(draw, nv40->edgeflags);
                draw_set_vertex_buffers(draw, nv40->vtxbuf_nr, nv40->vtxbuf);
                draw_set_vertex_elements(draw, nv40->vtxelt_nr, nv40->vtxelt);  
        }
index 06374184b124481945d98e493a7c3c83ab6ff487..e5f9bd5668a307737ff2ba6c0ea62d9637b12acb 100644 (file)
@@ -488,6 +488,11 @@ nv40_vbo_validate(struct nv40_context *nv40)
        unsigned vb_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD;
        int hw;
 
+       if (nv40->edgeflags) {
+               nv40->fallback_swtnl |= NV40_NEW_ARRAYS;
+               return FALSE;
+       }
+
        vtxbuf = so_new(20, 18);
        so_method(vtxbuf, curie, NV40TCL_VTXBUF_ADDRESS(0), nv40->vtxelt_nr);
        vtxfmt = so_new(17, 0);