nouveau: update for interface changes + hack around gallium x86_64 bustage
authorBen Skeggs <skeggsb@gmail.com>
Sun, 22 Jun 2008 14:14:21 +0000 (00:14 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Sun, 22 Jun 2008 14:14:21 +0000 (00:14 +1000)
src/gallium/auxiliary/draw/draw_context.c
src/gallium/drivers/nv10/nv10_context.h
src/gallium/drivers/nv10/nv10_state.c
src/gallium/drivers/nv10/nv10_vbo.c
src/gallium/drivers/nv30/nv30_fragprog.c
src/gallium/drivers/nv30/nv30_vertprog.c
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_draw.c
src/gallium/drivers/nv40/nv40_fragprog.c
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv40/nv40_vertprog.c

index 2f263cf06a9866c3226002687239485f0c6b2ab8..0e6f55a928be8da9615d5ca6d5a23cf02464d735 100644 (file)
@@ -63,8 +63,10 @@ struct draw_context *draw_create( void )
    if (!draw_pt_init( draw ))
       goto fail;
 
+#ifndef PIPE_ARCH_X86
    if (!draw_vs_init( draw ))
       goto fail;
+#endif
 
    return draw;
 
index 5636dfc9d227f4bdf391ac3bac0e8a1ecf06ba03..2bdba53db8ac17c721c11fd0e8283fecec02e4a5 100644 (file)
@@ -66,6 +66,7 @@ struct nv10_context {
 
        //struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
        float *constbuf[PIPE_SHADER_TYPES][32][4];
+       unsigned constbuf_nr[PIPE_SHADER_TYPES];
 
        struct vertex_info vertex_info;
 
index 4dcb9a31ab185b460a457ae09227157c67686d21..11664fae2afa51ede43f7bd9024d3a7ef3b9770b 100644 (file)
@@ -469,6 +469,8 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
                if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
                {
                        memcpy(nv10->constbuf[shader], mapped, buf->size);
+                       nv10->constbuf_nr[shader] =
+                               buf->size / (4 * sizeof(float));
                        ws->buffer_unmap(ws, buf->buffer);
                }
        }
index 2a334e137d96c7af9f8b3bf81a2d9e2dca6c5503..f024f5342091a94169c19fcacf32006d9b339d69 100644 (file)
@@ -44,7 +44,9 @@ 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_set_mapped_constant_buffer(draw,
+                                       nv10->constbuf[PIPE_SHADER_VERTEX],
+                                       nv10->constbuf_nr[PIPE_SHADER_VERTEX]);
 
        /* draw! */
        draw_arrays(nv10->draw, prim, start, count);
index 51000bd6fcdfba186803837781876eb9501c0c6f..54d6bea55f76acb272802c70b340e31c0fc69aaf 100644 (file)
@@ -645,7 +645,7 @@ nv30_fragprog_parse_decl_attrib(struct nv30_fpc *fpc,
                return FALSE;
        }
 
-       fpc->attrib_map[fdec->u.DeclarationRange.First] = hw;
+       fpc->attrib_map[fdec->DeclarationRange.First] = hw;
        return TRUE;
 }
 
@@ -655,10 +655,10 @@ nv30_fragprog_parse_decl_output(struct nv30_fpc *fpc,
 {
        switch (fdec->Semantic.SemanticName) {
        case TGSI_SEMANTIC_POSITION:
-               fpc->depth_id = fdec->u.DeclarationRange.First;
+               fpc->depth_id = fdec->DeclarationRange.First;
                break;
        case TGSI_SEMANTIC_COLOR:
-               fpc->colour_id = fdec->u.DeclarationRange.First;
+               fpc->colour_id = fdec->DeclarationRange.First;
                break;
        default:
                NOUVEAU_ERR("bad output semantic\n");
index 71aea3a59cb618de09536b0877b69cc69b02f5cb..1b34d2e4b29e21cde5973fcfc3a947d979c1639a 100644 (file)
@@ -530,7 +530,7 @@ nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc,
                return FALSE;
        }
 
-       vpc->output_map[fdec->u.DeclarationRange.First] = hw;
+       vpc->output_map[fdec->DeclarationRange.First] = hw;
        return TRUE;
 }
 
index d8d1891dff0ae42a1df24435c3b8783989c8e11f..8e60a81e68e210b6a6851a45cf2a7920083695bb 100644 (file)
@@ -136,6 +136,7 @@ struct nv40_context {
        struct nv40_vertex_program *vertprog;
        struct nv40_fragment_program *fragprog;
        struct pipe_buffer *constbuf[PIPE_SHADER_TYPES];
+       unsigned constbuf_nr[PIPE_SHADER_TYPES];
        struct nv40_rasterizer_state *rasterizer;
        struct nv40_zsa_state *zsa;
        struct nv40_blend_state *blend;
index 1d78324dda8d20576138c7bd7da7d20a96d3cd5e..2cf58e2950ad720cea2ba3795501430381b78baa 100644 (file)
@@ -253,9 +253,11 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
        }
 
        if (nv40->constbuf[PIPE_SHADER_VERTEX]) {
+               const unsigned nr = nv40->constbuf_nr[PIPE_SHADER_VERTEX];
+
                map = ws->buffer_map(ws, nv40->constbuf[PIPE_SHADER_VERTEX],
                                     PIPE_BUFFER_USAGE_CPU_READ);
-               draw_set_mapped_constant_buffer(nv40->draw, map);
+               draw_set_mapped_constant_buffer(nv40->draw, map, nr);
        }
 
        draw_arrays(nv40->draw, mode, start, count);
index 4b7667e03811b118d7d08cd064fb1a1e53ffc4b5..428348c33888f896bd8830c833cf21a13de1fca5 100644 (file)
@@ -708,7 +708,7 @@ nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc,
                return FALSE;
        }
 
-       fpc->attrib_map[fdec->u.DeclarationRange.First] = hw;
+       fpc->attrib_map[fdec->DeclarationRange.First] = hw;
        return TRUE;
 }
 
@@ -716,7 +716,7 @@ static boolean
 nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc,
                                const struct tgsi_full_declaration *fdec)
 {
-       unsigned idx = fdec->u.DeclarationRange.First;
+       unsigned idx = fdec->DeclarationRange.First;
        unsigned hw;
 
        switch (fdec->Semantic.SemanticName) {
@@ -770,9 +770,9 @@ nv40_fragprog_prepare(struct nv40_fpc *fpc)
                                        goto out_err;
                                break;
                        case TGSI_FILE_TEMPORARY:
-                               if (fdec->u.DeclarationRange.Last > high_temp) {
+                               if (fdec->DeclarationRange.Last > high_temp) {
                                        high_temp =
-                                               fdec->u.DeclarationRange.Last;
+                                               fdec->DeclarationRange.Last;
                                }
                                break;
                        default:
index 2d921d2b8a446549cc6fec6219dbc8bd443072d5..afcf336a65b9cd819dcc28da2b0220fb7f8859b6 100644 (file)
@@ -603,12 +603,13 @@ nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
+       nv40->constbuf[shader] = buf->buffer;
+       nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+
        if (shader == PIPE_SHADER_VERTEX) {
-               nv40->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
                nv40->dirty |= NV40_NEW_VERTPROG;
        } else
        if (shader == PIPE_SHADER_FRAGMENT) {
-               nv40->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
                nv40->dirty |= NV40_NEW_FRAGPROG;
        }
 }
index eb14869bfe04506ec44c6a3163e5675212947719..1e486a66ef0fd776752f719a00323decfba676b0 100644 (file)
@@ -603,7 +603,7 @@ static boolean
 nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc,
                                const struct tgsi_full_declaration *fdec)
 {
-       unsigned idx = fdec->u.DeclarationRange.First;
+       unsigned idx = fdec->DeclarationRange.First;
        int hw;
 
        switch (fdec->Semantic.SemanticName) {
@@ -678,16 +678,16 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc)
                        fdec = &p.FullToken.FullDeclaration;
                        switch (fdec->Declaration.File) {
                        case TGSI_FILE_TEMPORARY:
-                               if (fdec->u.DeclarationRange.Last > high_temp) {
+                               if (fdec->DeclarationRange.Last > high_temp) {
                                        high_temp =
-                                               fdec->u.DeclarationRange.Last;
+                                               fdec->DeclarationRange.Last;
                                }
                                break;
 #if 0 /* this would be nice.. except gallium doesn't track it */
                        case TGSI_FILE_ADDRESS:
-                               if (fdec->u.DeclarationRange.Last > high_addr) {
+                               if (fdec->DeclarationRange.Last > high_addr) {
                                        high_addr =
-                                               fdec->u.DeclarationRange.Last;
+                                               fdec->DeclarationRange.Last;
                                }
                                break;
 #endif