aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2007-09-14 11:10:23 +0800
committerXiang, Haihao <[email protected]>2007-09-14 11:10:23 +0800
commitea07a0df9a2f689b8f5acaf92c40bbbd602cab3c (patch)
treecfeb727b44aa51511990e51444d972779d57f38a /src/mesa/drivers/dri
parent75a0f7f4a73270714181662bbb12dd5de5eb7f79 (diff)
i965: align the address of the first element within
the index buffer. (fix#11910)
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 6150cac4aa3..dc289ca9ae7 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -593,6 +593,28 @@ void brw_upload_indices( struct brw_context *brw,
ib_size,
index_buffer->ptr,
bufferobj);
+ } else {
+ if (((1 << get_index_type(index_buffer->type)) - 1) & offset) {
+ struct gl_buffer_object *vbo;
+ GLuint voffset;
+ GLubyte *map = ctx->Driver.MapBuffer(ctx,
+ GL_ELEMENT_ARRAY_BUFFER_ARB,
+ GL_DYNAMIC_DRAW_ARB,
+ bufferobj);
+ map += offset;
+ get_space(brw, ib_size, &vbo, &voffset);
+
+ ctx->Driver.BufferSubData(ctx,
+ GL_ELEMENT_ARRAY_BUFFER_ARB,
+ voffset,
+ ib_size,
+ map,
+ vbo);
+ ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, bufferobj);
+
+ bufferobj = vbo;
+ offset = voffset;
+ }
}
/* Emit the indexbuffer packet: