gallium: adapt drivers to pipe_constant_buffer removal
authorRoland Scheidegger <sroland@vmware.com>
Wed, 23 Dec 2009 23:55:49 +0000 (00:55 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 23 Dec 2009 23:55:49 +0000 (00:55 +0100)
30 files changed:
src/gallium/drivers/cell/ppu/cell_context.h
src/gallium/drivers/cell/ppu/cell_draw_arrays.c
src/gallium/drivers/cell/ppu/cell_state_emit.c
src/gallium/drivers/cell/ppu/cell_state_shader.c
src/gallium/drivers/failover/fo_context.h
src/gallium/drivers/failover/fo_state.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i965/brw_pipe_shader.c
src/gallium/drivers/identity/id_context.c
src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_state.h
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/nv04/nv04_state.c
src/gallium/drivers/nv10/nv10_state.c
src/gallium/drivers/nv20/nv20_state.c
src/gallium/drivers/nv30/nv30_state.c
src/gallium/drivers/nv40/nv40_state.c
src/gallium/drivers/nv50/nv50_state.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_draw_arrays.c
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/softpipe/sp_state_fs.c
src/gallium/drivers/svga/svga_pipe_constants.c
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump_state.c
src/gallium/drivers/trace/tr_dump_state.h

index 5c3188e7f9dc1194feb8da5960bb3c9a83720c8f..1498fb665a213b30d6f886d06cdd0e5d0146f703 100644 (file)
@@ -115,7 +115,7 @@ struct cell_context
 
    struct pipe_blend_color blend_color;
    struct pipe_clip_state clip;
-   struct pipe_constant_buffer constants[2];
+   struct pipe_buffer *constants[2];
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
index 5cc1d4ddf81eaf54fed5550e1325a889faec34f5..2016b21a40984e893fe63985010efe9bd6067f1c 100644 (file)
@@ -51,17 +51,17 @@ cell_map_constant_buffers(struct cell_context *sp)
    struct pipe_winsys *ws = sp->pipe.winsys;
    uint i;
    for (i = 0; i < 2; i++) {
-      if (sp->constants[i].buffer && sp->constants[i].buffer->size) {
-         sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
+      if (sp->constants[i] && sp->constants[i]->size) {
+         sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i],
                                                    PIPE_BUFFER_USAGE_CPU_READ);
          cell_flush_buffer_range(sp, sp->mapped_constants[i], 
-                                 sp->constants[i].buffer->size);
+                                 sp->constants[i]->size);
       }
    }
 
    draw_set_mapped_constant_buffer(sp->draw,
                                    sp->mapped_constants[PIPE_SHADER_VERTEX],
-                                   sp->constants[PIPE_SHADER_VERTEX].buffer->size);
+                                   sp->constants[PIPE_SHADER_VERTEX]->size);
 }
 
 static void
@@ -70,8 +70,8 @@ cell_unmap_constant_buffers(struct cell_context *sp)
    struct pipe_winsys *ws = sp->pipe.winsys;
    uint i;
    for (i = 0; i < 2; i++) {
-      if (sp->constants[i].buffer && sp->constants[i].buffer->size)
-         ws->buffer_unmap(ws, sp->constants[i].buffer);
+      if (sp->constants[i] && sp->constants[i]->size)
+         ws->buffer_unmap(ws, sp->constants[i]);
       sp->mapped_constants[i] = NULL;
    }
 }
index ac5fafec1ad0be45620abdada0c2e73f62b831f1..ab55a24bb643a89953a529f7fd89f4c7f4b1eb5b 100644 (file)
@@ -240,12 +240,12 @@ cell_emit_state(struct cell_context *cell)
 
    if (cell->dirty & (CELL_NEW_FS_CONSTANTS)) {
       const uint shader = PIPE_SHADER_FRAGMENT;
-      const uint num_const = cell->constants[shader].buffer->size / sizeof(float);
+      const uint num_const = cell->constants[shader]->size / sizeof(float);
       uint i, j;
       float *buf = cell_batch_alloc16(cell, ROUNDUP16(32 + num_const * sizeof(float)));
       uint32_t *ibuf = (uint32_t *) buf;
       const float *constants = pipe_buffer_map(cell->pipe.screen,
-                                               cell->constants[shader].buffer,
+                                               cell->constants[shader],
                                                PIPE_BUFFER_USAGE_CPU_READ);
       ibuf[0] = CELL_CMD_STATE_FS_CONSTANTS;
       ibuf[4] = num_const;
@@ -253,7 +253,7 @@ cell_emit_state(struct cell_context *cell)
       for (i = 0; i < num_const; i++) {
          buf[j++] = constants[i];
       }
-      pipe_buffer_unmap(cell->pipe.screen, cell->constants[shader].buffer);
+      pipe_buffer_unmap(cell->pipe.screen, cell->constants[shader]);
    }
 
    if (cell->dirty & (CELL_NEW_FRAMEBUFFER |
index 6568c784fec1f0dfdc30348b2bb2199422bdf9f0..cf5d681499ec08b0b0e51bd9b1b16dd87717caf9 100644 (file)
@@ -183,7 +183,7 @@ cell_delete_vs_state(struct pipe_context *pipe, void *vs)
 static void
 cell_set_constant_buffer(struct pipe_context *pipe,
                          uint shader, uint index,
-                         const struct pipe_constant_buffer *buf)
+                         const struct pipe_buffer *buf)
 {
    struct cell_context *cell = cell_context(pipe);
 
@@ -193,7 +193,7 @@ cell_set_constant_buffer(struct pipe_context *pipe,
    draw_flush(cell->draw);
 
    /* note: reference counting */
-   pipe_buffer_reference(&cell->constants[shader].buffer, buf->buffer);
+   pipe_buffer_reference(&cell->constants[shader], buf);
 
    if (shader == PIPE_SHADER_VERTEX)
       cell->dirty |= CELL_NEW_VS_CONSTANTS;
index 149393712a3c90aff853f6fd6ee55a77e82971a2..c8be885457d8f06da6f487c95a56517b4cf13933 100644 (file)
@@ -125,7 +125,7 @@ failover_context( struct pipe_context *pipe )
 void
 failover_set_constant_buffer(struct pipe_context *pipe,
                              uint shader, uint index,
-                             const struct pipe_constant_buffer *buf);
+                             const struct pipe_buffer *buf);
 
 
 #endif /* FO_CONTEXT_H */
index 3f5f5560323260612e3d0c99ec052b83716b8fa0..55ccab6e9806fe9738e7ad066d4424a46182745c 100644 (file)
@@ -495,7 +495,7 @@ failover_set_vertex_elements(struct pipe_context *pipe,
 void
 failover_set_constant_buffer(struct pipe_context *pipe,
                              uint shader, uint index,
-                             const struct pipe_constant_buffer *buf)
+                             const struct pipe_buffer *buf)
 {
    struct failover_context *failover = failover_context(pipe);
 
index 234b441ce6e69cf50703205ea44ddac74ca0afd9..37cbd56036b02b2ad8837a132e63507518c4fa00 100644 (file)
@@ -233,7 +233,8 @@ struct i915_context
 
    struct pipe_blend_color blend_color;
    struct pipe_clip_state clip;
-   struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
+   /* XXX unneded */
+   struct pipe_buffer *constants[PIPE_SHADER_TYPES];
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
index e580b6c0f7fb6a0c2ecb62adbd2b7272dfee77f8..4d48b5a0be2abaf79ae1d72fb63023a9efc66b86 100644 (file)
@@ -517,7 +517,7 @@ static void i915_delete_vs_state(struct pipe_context *pipe, void *shader)
 
 static void i915_set_constant_buffer(struct pipe_context *pipe,
                                      uint shader, uint index,
-                                     const struct pipe_constant_buffer *buf)
+                                     const struct pipe_buffer *buf)
 {
    struct i915_context *i915 = i915_context(pipe);
    struct pipe_screen *screen = pipe->screen;
@@ -537,13 +537,13 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
     */
    if (buf) {
       void *mapped;
-      if (buf->buffer && buf->buffer->size &&
-          (mapped = pipe_buffer_map(screen, buf->buffer,
+      if (buf->size &&
+          (mapped = pipe_buffer_map(screen, buf,
                                     PIPE_BUFFER_USAGE_CPU_READ))) {
-         memcpy(i915->current.constants[shader], mapped, buf->buffer->size);
-         pipe_buffer_unmap(screen, buf->buffer);
+         memcpy(i915->current.constants[shader], mapped, buf->size);
+         pipe_buffer_unmap(screen, buf);
          i915->current.num_user_constants[shader]
-            = buf->buffer->size / (4 * sizeof(float));
+            = buf->size / (4 * sizeof(float));
       }
       else {
          i915->current.num_user_constants[shader] = 0;
index 20f20571f653b39a036e1a586791f9afe05fac8b..ede6b347a50e472610f82e415c44f44f8d1ae89a 100644 (file)
@@ -255,7 +255,7 @@ static void brw_delete_vs_state( struct pipe_context *pipe, void *prog )
 
 static void brw_set_constant_buffer(struct pipe_context *pipe,
                                      uint shader, uint index,
-                                     const struct pipe_constant_buffer *buf)
+                                     const struct pipe_buffer *buf)
 {
    struct brw_context *brw = brw_context(pipe);
 
@@ -263,13 +263,13 @@ static void brw_set_constant_buffer(struct pipe_context *pipe,
 
    if (shader == PIPE_SHADER_FRAGMENT) {
       pipe_buffer_reference( &brw->curr.fragment_constants,
-                             buf->buffer );
+                             buf );
 
       brw->state.dirty.mesa |= PIPE_NEW_FRAGMENT_CONSTANTS;
    }
    else {
       pipe_buffer_reference( &brw->curr.vertex_constants,
-                             buf->buffer );
+                             buf );
 
       brw->state.dirty.mesa |= PIPE_NEW_VERTEX_CONSTANTS;
    }
index bdbaae59875b3e94d4ca6ded65433c541fd47ce0..fb4d91a114109c62a46f6f6f363771869cd90639 100644 (file)
@@ -404,17 +404,17 @@ static void
 identity_set_constant_buffer(struct pipe_context *_pipe,
                              uint shader,
                              uint index,
-                             const struct pipe_constant_buffer *_buffer)
+                             const struct pipe_buffer *_buffer)
 {
    struct identity_context *id_pipe = identity_context(_pipe);
    struct pipe_context *pipe = id_pipe->pipe;
-   struct pipe_constant_buffer unwrapped_buffer;
-   struct pipe_constant_buffer *buffer = NULL;
+   struct pipe_buffer *unwrapped_buffer;
+   struct pipe_buffer *buffer = NULL;
 
-   /* unwrap the input state */
+   /* XXX hmm? unwrap the input state */
    if (_buffer) {
-      unwrapped_buffer.buffer = identity_buffer_unwrap(_buffer->buffer);
-      buffer = &unwrapped_buffer;
+      unwrapped_buffer = identity_buffer_unwrap(_buffer);
+      buffer = unwrapped_buffer;
    }
 
    pipe->set_constant_buffer(pipe,
index 001311e7031a11bbf63d301ab2360fd1ffc66342..f381156d00f206ecf782d57d53c436ceb712dc3b 100644 (file)
@@ -124,8 +124,8 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
    }
 
    for (i = 0; i < Elements(llvmpipe->constants); i++) {
-      if (llvmpipe->constants[i].buffer) {
-         pipe_buffer_reference(&llvmpipe->constants[i].buffer, NULL);
+      if (llvmpipe->constants[i]) {
+         pipe_buffer_reference(&llvmpipe->constants[i], NULL);
       }
    }
 
index cc4d5ad5fd9423301db47ce674466e226d9e80d4..ca50585896eb582d0566240d7d4b4c08253c5fc0 100644 (file)
@@ -64,7 +64,7 @@ struct llvmpipe_context {
    /** Other rendering state */
    struct pipe_blend_color blend_color[4][16];
    struct pipe_clip_state clip;
-   struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
+   struct pipe_buffer *constants[PIPE_SHADER_TYPES];
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
index 5cee7bf74b6aa5a1d4d6053286bc0b818a4b7a81..131e3621e94e4d31445dbb0ff18b3e4a75915cf8 100644 (file)
@@ -155,7 +155,7 @@ void llvmpipe_set_clip_state( struct pipe_context *,
 
 void llvmpipe_set_constant_buffer(struct pipe_context *,
                                   uint shader, uint index,
-                                  const struct pipe_constant_buffer *buf);
+                                  const struct pipe_buffer *buf);
 
 void *llvmpipe_create_fs_state(struct pipe_context *,
                                const struct pipe_shader_state *);
index 22683ff8b428581ec91b0312a0887af640324d42..867e8ceea79b98a2dda09d6218d7ba68ea7e41c4 100644 (file)
@@ -713,12 +713,11 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
 void
 llvmpipe_set_constant_buffer(struct pipe_context *pipe,
                              uint shader, uint index,
-                             const struct pipe_constant_buffer *constants)
+                             const struct pipe_buffer *constants)
 {
    struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
-   struct pipe_buffer *buffer = constants ? constants->buffer : NULL;
-   unsigned size = buffer ? buffer->size : 0;
-   const void *data = buffer ? llvmpipe_buffer(buffer)->data : NULL;
+   unsigned size = constants ? constants->size : 0;
+   const void *data = constants ? llvmpipe_buffer(constants)->data : NULL;
 
    assert(shader < PIPE_SHADER_TYPES);
    assert(index == 0);
@@ -727,7 +726,7 @@ llvmpipe_set_constant_buffer(struct pipe_context *pipe,
       draw_flush(llvmpipe->draw);
 
    /* note: reference counting */
-   pipe_buffer_reference(&llvmpipe->constants[shader].buffer, buffer);
+   pipe_buffer_reference(&llvmpipe->constants[shader], constants);
 
    if(shader == PIPE_SHADER_FRAGMENT) {
       llvmpipe->jit_context.constants = data;
index ef3005db5fc11e261f83dd25ee356dda8cabcd1f..ac69b29616213eb604fc801d66973d886fc47c5c 100644 (file)
@@ -332,7 +332,7 @@ nv04_set_clip_state(struct pipe_context *pipe,
 
 static void
 nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
-                        const struct pipe_constant_buffer *buf )
+                        const struct pipe_buffer *buf )
 {
        struct nv04_context *nv04 = nv04_context(pipe);
        struct pipe_screen *pscreen = pipe->screen;
@@ -342,13 +342,13 @@ nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
 
        if (buf) {
                void *mapped;
-               if (buf->buffer && buf->buffer->size &&
-                    (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+               if (buf && buf->size &&
+                    (mapped = pipe_buffer_map(pscreen, buf, PIPE_BUFFER_USAGE_CPU_READ)))
                {
-                       memcpy(nv04->constbuf[shader], mapped, buf->buffer->size);
+                       memcpy(nv04->constbuf[shader], mapped, buf->size);
                        nv04->constbuf_nr[shader] =
-                               buf->buffer->size / (4 * sizeof(float));
-                       pipe_buffer_unmap(pscreen, buf->buffer);
+                               buf->size / (4 * sizeof(float));
+                       pipe_buffer_unmap(pscreen, buf);
                }
        }
 }
index ffc6be3c401d68740f162bb86d15ab001d4d2299..150ab5029c8fc04addbe46f03e0718cfd35d49ca 100644 (file)
@@ -458,7 +458,7 @@ nv10_set_clip_state(struct pipe_context *pipe,
 
 static void
 nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
-                        const struct pipe_constant_buffer *buf )
+                        const struct pipe_buffer *buf )
 {
        struct nv10_context *nv10 = nv10_context(pipe);
        struct pipe_screen *pscreen = pipe->screen;
@@ -468,13 +468,13 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
 
        if (buf) {
                void *mapped;
-               if (buf->buffer && buf->buffer->size &&
-                    (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+               if (buf->size &&
+                    (mapped = pipe_buffer_map(pscreen, buf, PIPE_BUFFER_USAGE_CPU_READ)))
                {
-                       memcpy(nv10->constbuf[shader], mapped, buf->buffer->size);
+                       memcpy(nv10->constbuf[shader], mapped, buf->size);
                        nv10->constbuf_nr[shader] =
-                               buf->buffer->size / (4 * sizeof(float));
-                       pipe_buffer_unmap(pscreen, buf->buffer);
+                               buf->size / (4 * sizeof(float));
+                       pipe_buffer_unmap(pscreen, buf);
                }
        }
 }
index 3a82e63423dcea9b595a573c25479f9af90c452b..d7893b4f0f2c97ed14bd069f49eddd65e1fa27aa 100644 (file)
@@ -451,7 +451,7 @@ nv20_set_clip_state(struct pipe_context *pipe,
 
 static void
 nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
-                        const struct pipe_constant_buffer *buf )
+                        const struct pipe_buffer *buf )
 {
        struct nv20_context *nv20 = nv20_context(pipe);
        struct pipe_screen *pscreen = pipe->screen;
@@ -461,13 +461,13 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
 
        if (buf) {
                void *mapped;
-               if (buf->buffer && buf->buffer->size &&
-                    (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+               if (buf->size &&
+                    (mapped = pipe_buffer_map(pscreen, buf, PIPE_BUFFER_USAGE_CPU_READ)))
                {
-                       memcpy(nv20->constbuf[shader], mapped, buf->buffer->size);
+                       memcpy(nv20->constbuf[shader], mapped, buf->size);
                        nv20->constbuf_nr[shader] =
-                               buf->buffer->size / (4 * sizeof(float));
-                       pipe_buffer_unmap(pscreen, buf->buffer);
+                               buf->size / (4 * sizeof(float));
+                       pipe_buffer_unmap(pscreen, buf);
                }
        }
 }
index e6321b480f6f55cc96d3082da5d40493404cf3a3..dfac46e23fbfb28dfce27ad1fd92c21fc91ba194 100644 (file)
@@ -590,12 +590,12 @@ nv30_set_clip_state(struct pipe_context *pipe,
 
 static void
 nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
-                        const struct pipe_constant_buffer *buf )
+                        const struct pipe_buffer *buf )
 {
        struct nv30_context *nv30 = nv30_context(pipe);
 
-       nv30->constbuf[shader] = buf->buffer;
-       nv30->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float));
+       nv30->constbuf[shader] = buf;
+       nv30->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
 
        if (shader == PIPE_SHADER_VERTEX) {
                nv30->dirty |= NV30_NEW_VERTPROG;
index ed55d29affde8565541fcb077400424a98a2418f..81ccbb5ea594deb2f0acea44b440dc9d41757032 100644 (file)
@@ -605,12 +605,12 @@ nv40_set_clip_state(struct pipe_context *pipe,
 
 static void
 nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
-                        const struct pipe_constant_buffer *buf )
+                        const struct pipe_buffer *buf )
 {
        struct nv40_context *nv40 = nv40_context(pipe);
 
-       nv40->constbuf[shader] = buf->buffer;
-       nv40->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float));
+       nv40->constbuf[shader] = buf;
+       nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
 
        if (shader == PIPE_SHADER_VERTEX) {
                nv40->dirty |= NV40_NEW_VERTPROG;
index 88aef52d08c6bb57218cea85a52d9af073581b7c..f462558aecd9a3b11cac21010251cbac47313b09 100644 (file)
@@ -588,16 +588,16 @@ nv50_set_clip_state(struct pipe_context *pipe,
 
 static void
 nv50_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
-                        const struct pipe_constant_buffer *buf )
+                        const struct pipe_buffer *buf )
 {
        struct nv50_context *nv50 = nv50_context(pipe);
 
        if (shader == PIPE_SHADER_VERTEX) {
-               nv50->constbuf[PIPE_SHADER_VERTEX] = buf->buffer;
+               nv50->constbuf[PIPE_SHADER_VERTEX] = buf;
                nv50->dirty |= NV50_NEW_VERTPROG_CB;
        } else
        if (shader == PIPE_SHADER_FRAGMENT) {
-               nv50->constbuf[PIPE_SHADER_FRAGMENT] = buf->buffer;
+               nv50->constbuf[PIPE_SHADER_FRAGMENT] = buf;
                nv50->dirty |= NV50_NEW_FRAGPROG_CB;
        }
 }
index 49072462ec3ff0e27ddd2d7a3fd80a9099ecdd4f..b627895d4c4e195c038213e67744489ac9bbf48a 100644 (file)
@@ -804,22 +804,22 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
 
 static void r300_set_constant_buffer(struct pipe_context *pipe,
                                      uint shader, uint index,
-                                     const struct pipe_constant_buffer *buf)
+                                     const struct pipe_buffer *buf)
 {
     struct r300_context* r300 = r300_context(pipe);
     void *mapped;
 
-    if (buf == NULL || buf->buffer->size == 0 ||
-        (mapped = pipe_buffer_map(pipe->screen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)) == NULL)
+    if (buf == NULL || buf->size == 0 ||
+        (mapped = pipe_buffer_map(pipe->screen, buf, PIPE_BUFFER_USAGE_CPU_READ)) == NULL)
     {
         r300->shader_constants[shader].count = 0;
         return;
     }
 
-    assert((buf->buffer->size % 4 * sizeof(float)) == 0);
-    memcpy(r300->shader_constants[shader].constants, mapped, buf->buffer->size);
-    r300->shader_constants[shader].count = buf->buffer->size / (4 * sizeof(float));
-    pipe_buffer_unmap(pipe->screen, buf->buffer);
+    assert((buf->size % 4 * sizeof(float)) == 0);
+    memcpy(r300->shader_constants[shader].constants, mapped, buf->size);
+    r300->shader_constants[shader].count = buf->size / (4 * sizeof(float));
+    pipe_buffer_unmap(pipe->screen, buf);
 
     if (shader == PIPE_SHADER_VERTEX)
         r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS;
index 2a33587b5a7fa4e9ee64a1c0a7ad0f884123eae3..0862e9f24bd69542d85b60fa9cbbfdaea412dd0d 100644 (file)
@@ -113,8 +113,8 @@ softpipe_destroy( struct pipe_context *pipe )
    }
 
    for (i = 0; i < Elements(softpipe->constants); i++) {
-      if (softpipe->constants[i].buffer) {
-         pipe_buffer_reference(&softpipe->constants[i].buffer, NULL);
+      if (softpipe->constants[i]) {
+         pipe_buffer_reference(&softpipe->constants[i], NULL);
       }
    }
 
index 8ce20c5744c9f3b6479355e9be3e64a9dc20589a..ac24fccb4c18eff6842d898b4f0dde13b81da91e 100644 (file)
@@ -62,7 +62,7 @@ struct softpipe_context {
    /** Other rendering state */
    struct pipe_blend_color blend_color;
    struct pipe_clip_state clip;
-   struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
+   struct pipe_buffer *constants[PIPE_SHADER_TYPES];
    struct pipe_framebuffer_state framebuffer;
    struct pipe_poly_stipple poly_stipple;
    struct pipe_scissor_state scissor;
index 518ef8806e5681ff3eebf61b109618bd1e7354d4..96e1c5d8159b0c41c7b592d96aafdf6547466e1f 100644 (file)
@@ -51,13 +51,13 @@ softpipe_map_constant_buffers(struct softpipe_context *sp)
    uint i, size;
 
    for (i = 0; i < PIPE_SHADER_TYPES; i++) {
-      if (sp->constants[i].buffer && sp->constants[i].buffer->size)
-         sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
+      if (sp->constants[i] && sp->constants[i]->size)
+         sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i],
                                                   PIPE_BUFFER_USAGE_CPU_READ);
    }
 
-   if (sp->constants[PIPE_SHADER_VERTEX].buffer)
-      size = sp->constants[PIPE_SHADER_VERTEX].buffer->size;
+   if (sp->constants[PIPE_SHADER_VERTEX])
+      size = sp->constants[PIPE_SHADER_VERTEX]->size;
    else
       size = 0;
 
@@ -81,8 +81,8 @@ softpipe_unmap_constant_buffers(struct softpipe_context *sp)
    draw_set_mapped_constant_buffer(sp->draw, NULL, 0);
 
    for (i = 0; i < 2; i++) {
-      if (sp->constants[i].buffer && sp->constants[i].buffer->size)
-         ws->buffer_unmap(ws, sp->constants[i].buffer);
+      if (sp->constants[i] && sp->constants[i]->size)
+         ws->buffer_unmap(ws, sp->constants[i]);
       sp->mapped_constants[i] = NULL;
    }
 }
index 26d5c3fbb2fb0bd3bb3d62c03ffd52dcbfe248e2..1169520b445f0fcdad93843fe9811f6d5aec3eb8 100644 (file)
@@ -133,7 +133,7 @@ void softpipe_set_clip_state( struct pipe_context *,
 
 void softpipe_set_constant_buffer(struct pipe_context *,
                                   uint shader, uint index,
-                                  const struct pipe_constant_buffer *buf);
+                                  const struct pipe_buffer *buf);
 
 void *softpipe_create_fs_state(struct pipe_context *,
                                const struct pipe_shader_state *);
index b41f7e8ab726c5feacffb388479bcd13c97ac684..fa85946c6a8f849dafbf93c4c5a7860f40eafc4a 100644 (file)
@@ -152,7 +152,7 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
 void
 softpipe_set_constant_buffer(struct pipe_context *pipe,
                              uint shader, uint index,
-                             const struct pipe_constant_buffer *buf)
+                             const struct pipe_buffer *buf)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
 
@@ -160,8 +160,7 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
    assert(index == 0);
 
    /* note: reference counting */
-   pipe_buffer_reference(&softpipe->constants[shader].buffer,
-                        buf ? buf->buffer : NULL);
+   pipe_buffer_reference(&softpipe->constants[shader], buf);
 
    softpipe->dirty |= SP_NEW_CONSTANTS;
 }
index 10e7a121892af8aa32acfe4740dac0d623beaefb..ea0f833cea8fe387f77d1df4e958d88970f908b0 100644 (file)
@@ -49,7 +49,7 @@ struct svga_constbuf
 
 static void svga_set_constant_buffer(struct pipe_context *pipe,
                                      uint shader, uint index,
-                                     const struct pipe_constant_buffer *buf)
+                                     const struct pipe_buffer *buf)
 {
    struct svga_context *svga = svga_context(pipe);
 
@@ -57,7 +57,7 @@ static void svga_set_constant_buffer(struct pipe_context *pipe,
    assert(index == 0);
 
    pipe_buffer_reference( &svga->curr.cb[shader],
-                          buf->buffer );
+                          buf );
 
    if (shader == PIPE_SHADER_FRAGMENT)
       svga->dirty |= SVGA_NEW_FS_CONST_BUFFER;
index 80f4874b78050ec48ef34375c31b3987c20da865..11044d684556eba494dc8f3506a60900c6ff0a65 100644 (file)
@@ -825,13 +825,13 @@ trace_context_set_clip_state(struct pipe_context *_pipe,
 static INLINE void
 trace_context_set_constant_buffer(struct pipe_context *_pipe,
                                   uint shader, uint index,
-                                  const struct pipe_constant_buffer *buffer)
+                                  const struct pipe_buffer *buffer)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
 
    if (buffer)
-      trace_screen_user_buffer_update(_pipe->screen, buffer->buffer);
+      trace_screen_user_buffer_update(_pipe->screen, buffer);
 
    trace_dump_call_begin("pipe_context", "set_constant_buffer");
 
@@ -840,10 +840,11 @@ trace_context_set_constant_buffer(struct pipe_context *_pipe,
    trace_dump_arg(uint, index);
    trace_dump_arg(constant_buffer, buffer);
 
+   /* XXX hmm? */
    if (buffer) {
-      struct pipe_constant_buffer _buffer;
-      _buffer.buffer = trace_buffer_unwrap(tr_ctx, buffer->buffer);
-      pipe->set_constant_buffer(pipe, shader, index, &_buffer);
+      struct pipe_buffer *_buffer;
+      _buffer = trace_buffer_unwrap(tr_ctx, buffer);
+      pipe->set_constant_buffer(pipe, shader, index, _buffer);
    } else {
       pipe->set_constant_buffer(pipe, shader, index, buffer);
    }
index 0102cc187636542fd966f8ccd996cdf17fe2ffae..5794c902988a0ba6ad2d8bdd48da748c32fe4ce3 100644 (file)
@@ -229,7 +229,7 @@ void trace_dump_clip_state(const struct pipe_clip_state *state)
 }
 
 
-void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
+void trace_dump_constant_buffer(const struct pipe_buffer *state)
 {
    if (!trace_dumping_enabled_locked())
       return;
@@ -241,7 +241,7 @@ void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
 
    trace_dump_struct_begin("pipe_constant_buffer");
 
-   trace_dump_member(buffer_ptr, state, buffer);
+   trace_dump_reference(&state->reference);
 
    trace_dump_struct_end();
 }
index 07ad6fbb205ffdd2e38aea50bb311fe53729cfef..c7860fd6e181feb5851e6a957f2d00e4744186b9 100644 (file)
@@ -47,7 +47,7 @@ void trace_dump_scissor_state(const struct pipe_scissor_state *state);
 
 void trace_dump_clip_state(const struct pipe_clip_state *state);
 
-void trace_dump_constant_buffer(const struct pipe_constant_buffer *state);
+void trace_dump_constant_buffer(const struct pipe_buffer *state);
 
 void trace_dump_token(const struct tgsi_token *token);