diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-08 20:01:10 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-21 12:59:34 +0000 |
commit | e476e122207e6195a16a8c7d2cab90eeba227934 (patch) | |
tree | 7c1a5f31a6078ffd7174f6a04816968f6fc3a382 /src/mesa/drivers/dri/i965 | |
parent | d0809d7b15ba58c05bb0b63128c9cf7042304cd2 (diff) |
intel: Pack dynamic draws together
Dynamic arrays have the tendency to be small and so allocating a bo for
each one is overkill and we can exploit many efficiency gains by packing
them together.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw_upload.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 2cd249812f..7f93f1d5ed 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -359,13 +359,13 @@ static void brw_prepare_vertices(struct brw_context *brw) if (_mesa_is_bufferobj(input->glarray->BufferObj)) { struct intel_buffer_object *intel_buffer = intel_buffer_object(input->glarray->BufferObj); + GLuint offset; /* Named buffer object: Just reference its contents directly. */ drm_intel_bo_unreference(input->bo); - input->bo = intel_bufferobj_buffer(intel, intel_buffer, - INTEL_READ); + input->bo = intel_bufferobj_source(intel, intel_buffer, &offset); drm_intel_bo_reference(input->bo); - input->offset = (unsigned long)input->glarray->Ptr; + input->offset = offset + (unsigned long)input->glarray->Ptr; input->stride = input->glarray->StrideB; input->count = input->glarray->_MaxElement; @@ -633,16 +633,16 @@ static void brw_prepare_indices(struct brw_context *brw) ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, bufferobj); } else { - bo = intel_bufferobj_buffer(intel, intel_buffer_object(bufferobj), - INTEL_READ); - drm_intel_bo_reference(bo); - /* Use CMD_3D_PRIM's start_vertex_offset to avoid re-uploading * the index buffer state when we're just moving the start index * of our drawing. */ brw->ib.start_vertex_offset = offset / ib_type_size; - offset = 0; + + bo = intel_bufferobj_source(intel, intel_buffer_object(bufferobj), + &offset); + drm_intel_bo_reference(bo); + ib_size = bo->size; } } |