nv10: fix more vertex stuff
authorStephane Marchesin <marchesin@icps.u-strasbg.fr>
Thu, 3 Apr 2008 02:07:16 +0000 (04:07 +0200)
committerStephane Marchesin <marchesin@icps.u-strasbg.fr>
Thu, 3 Apr 2008 02:07:16 +0000 (04:07 +0200)
src/gallium/drivers/nv10/nv10_context.h
src/gallium/drivers/nv10/nv10_state.c
src/gallium/drivers/nv10/nv10_state_emit.c
src/gallium/drivers/nv10/nv10_vbo.c

index 8c13d6897f7544d31218d10b2a2a488799aa8a1f..63d33ef7c91e421064a0e458ead50caefb6daae1 100644 (file)
@@ -65,6 +65,8 @@ struct nv10_context {
        struct pipe_viewport_state *viewport;
        struct pipe_scissor_state *scissor;
        struct pipe_framebuffer_state *framebuffer;
+       struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+       struct vertex_info vertex_info;
 
        struct {
                struct pipe_buffer *buffer;
@@ -77,8 +79,7 @@ struct nv10_context {
                unsigned delta;
        } vb[16];
 
-       struct vertex_info vertex_info;
-       struct {
+/*     struct {
        
                struct nouveau_resource *exec_heap;
                struct nouveau_resource *data_heap;
@@ -86,9 +87,8 @@ struct nv10_context {
                struct nv10_vertex_program *active;
 
                struct nv10_vertex_program *current;
-               struct pipe_buffer *constant_buf;
        } vertprog;
-
+*/
        struct {
                struct nv10_fragment_program *active;
 
index 924cf803acb638f1a4de3ea24ad1de3cb52c3849..1d9a202dd7c89bcdc1d457c94cfaa018c8eedaf2 100644 (file)
@@ -449,6 +449,9 @@ static void
 nv10_set_clip_state(struct pipe_context *pipe,
                    const struct pipe_clip_state *clip)
 {
+       struct nv10_context *nv10 = nv10_context(pipe);
+
+       draw_set_clip_state(nv10->draw, clip);
 }
 
 static void
@@ -458,11 +461,11 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
        struct nv10_context *nv10 = nv10_context(pipe);
 
        if (shader == PIPE_SHADER_VERTEX) {
-               nv10->vertprog.constant_buf = buf->buffer;
+               nv10->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
                nv10->dirty |= NV10_NEW_VERTPROG;
        } else
        if (shader == PIPE_SHADER_FRAGMENT) {
-               nv10->fragprog.constant_buf = buf->buffer;
+               nv10->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
                nv10->dirty |= NV10_NEW_FRAGPROG;
        }
 }
@@ -504,6 +507,8 @@ nv10_set_viewport_state(struct pipe_context *pipe,
 
        nv10->viewport = (struct pipe_viewport_state*)vpt;
 
+       draw_set_viewport_state(nv10->draw, &nv10->viewport);
+
        nv10->dirty |= NV10_NEW_VIEWPORT;
 }
 
@@ -515,6 +520,8 @@ nv10_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
 
        memcpy(nv10->vtxbuf, vb, sizeof(*vb) * count);
        nv10->dirty |= NV10_NEW_VTXARRAYS;
+
+       draw_set_vertex_buffers(nv10->draw, count, vb);
 }
 
 static void
@@ -525,6 +532,8 @@ nv10_set_vertex_elements(struct pipe_context *pipe, unsigned count,
 
        memcpy(nv10->vtxelt, ve, sizeof(*ve) * count);
        nv10->dirty |= NV10_NEW_VTXARRAYS;
+
+       draw_set_vertex_elements(nv10->draw, count, ve);
 }
 
 void
index 134e52bd622a980402b66f68e52775a63cf32446..18566986b064f582e3599e950c1b7237d5c41157 100644 (file)
@@ -136,8 +136,14 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10)
                assert(0);
        }
 
-       BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
-       OUT_RING  ( (rt->pitch * rt->cpp) | ( (zeta->pitch * zeta->cpp) << 16) );
+       if (zeta) {
+               BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
+               OUT_RING  ( (rt->pitch * rt->cpp) | ( (zeta->pitch * zeta->cpp) << 16) );
+       } else {
+               BEGIN_RING(celsius, NV10TCL_RT_PITCH, 1);
+               OUT_RING  ( (rt->pitch * rt->cpp) );
+       }
+
        nv10->rt[0] = rt->buffer;
 
        if (zeta_format)
index 0f5902602f653bdfe12df1d9bbf15c39e5d83178..3a4f49e1564ed61168f4751354e6d819ca9a5cb0 100644 (file)
@@ -44,6 +44,8 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
                draw_set_mapped_element_buffer(draw, 0, NULL);
        }
 
+       draw_set_mapped_constant_buffer(draw, nv10->constbuf[PIPE_SHADER_VERTEX]);
+
        /* draw! */
        draw_arrays(nv10->draw, prim, start, count);