summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-11-06 23:29:47 +0000
committerKeith Whitwell <[email protected]>2009-11-11 18:51:57 -0800
commitd86e9079a8eb2e84cb231fdbca4b74d744198afb (patch)
tree516a1af6ab27bf204828fcfb94d542b530938fb4 /src/gallium/drivers
parente243279a48d68c0a14fbf2b78d99b6a9e72c87b6 (diff)
i965g: fix off-by-one on curbe upload
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/i965/brw_curbe.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gallium/drivers/i965/brw_curbe.c b/src/gallium/drivers/i965/brw_curbe.c
index 0a5cfcc7cfc..79ebac9d153 100644
--- a/src/gallium/drivers/i965/brw_curbe.c
+++ b/src/gallium/drivers/i965/brw_curbe.c
@@ -224,9 +224,13 @@ static enum pipe_error prepare_curbe_buffer(struct brw_context *brw)
/* vertex shader constants */
if (brw->curbe.vs_size) {
GLuint offset = brw->curbe.vs_start * 16;
- GLuint nr = brw->curr.vertex_shader->info.file_max[TGSI_FILE_CONSTANT];
+ GLuint nr = brw->curr.vertex_shader->info.file_max[TGSI_FILE_CONSTANT] + 1;
struct pipe_screen *screen = brw->base.screen;
+ /* XXX: note that constant buffers are currently *already* in
+ * buffer objects. If we want to keep on putting them into the
+ * curbe, makes sense to treat constbuf's specially with malloc.
+ */
const GLfloat *value = screen->buffer_map( screen,
brw->curr.vertex_constants,
PIPE_BUFFER_USAGE_CPU_READ);
@@ -272,8 +276,10 @@ static enum pipe_error prepare_curbe_buffer(struct brw_context *brw)
}
if (brw->curbe.curbe_bo == NULL) {
- /* Allocate a single page for CURBE entries for this batchbuffer.
- * They're generally around 64b.
+ /* Allocate a single page for CURBE entries for this
+ * batchbuffer. They're generally around 64b. We will
+ * discard the curbe buffer after the batch is flushed to
+ * avoid synchronous updates.
*/
ret = brw->sws->bo_alloc(brw->sws,
BRW_BUFFER_TYPE_CURBE,
@@ -292,8 +298,8 @@ static enum pipe_error prepare_curbe_buffer(struct brw_context *brw)
/* Copy data to the buffer:
*/
brw->sws->bo_subdata(brw->curbe.curbe_bo,
+ BRW_DATA_CONSTANT_BUFFER,
brw->curbe.curbe_offset,
- BRW_DATA_OTHER,
bufsz,
buf,
NULL, 0);