summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_draw_upload.c
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2014-03-02 15:02:54 -0800
committerKenneth Graunke <kenneth@whitecape.org>2014-03-18 10:38:44 -0700
commit051edcc144aca314d207200c46bc88b4efa1e56c (patch)
tree132e47929cfaff172eb3e0d1dfd35f89c81ad16c /src/mesa/drivers/dri/i965/brw_draw_upload.c
parent7a0fd3ca1d436591117d451ecee209a4cdb65aef (diff)
downloadexternal_mesa3d-051edcc144aca314d207200c46bc88b4efa1e56c.zip
external_mesa3d-051edcc144aca314d207200c46bc88b4efa1e56c.tar.gz
external_mesa3d-051edcc144aca314d207200c46bc88b4efa1e56c.tar.bz2
i965: Consolidate code for setting brw->ib.start_vertex_offset.
This was set identically in three places. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_draw_upload.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw_upload.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index d42c074..3c537a5 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -841,12 +841,10 @@ static void brw_upload_indices(struct brw_context *brw)
/* Turn into a proper VBO:
*/
if (!_mesa_is_bufferobj(bufferobj)) {
-
/* Get new bufferobj, offset:
*/
intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size,
&bo, &offset);
- brw->ib.start_vertex_offset = offset / ib_type_size;
} else {
offset = (GLuint) (unsigned long) index_buffer->ptr;
@@ -865,22 +863,21 @@ static void brw_upload_indices(struct brw_context *brw)
MAP_INTERNAL);
intel_upload_data(brw, map, ib_size, ib_type_size, &bo, &offset);
- brw->ib.start_vertex_offset = offset / ib_type_size;
ctx->Driver.UnmapBuffer(ctx, bufferobj, MAP_INTERNAL);
} else {
- /* 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;
-
bo = intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
offset, ib_size);
drm_intel_bo_reference(bo);
}
}
+ /* Use 3DPRIMITIVE'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;
+
if (brw->ib.bo != bo) {
drm_intel_bo_unreference(brw->ib.bo);
brw->ib.bo = bo;