diff options
author | Jason Ekstrand <[email protected]> | 2016-05-17 15:34:40 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-05-23 19:12:34 -0700 |
commit | aec10a1d5b4a0802f6f09d1b83c79f53ecd3d29f (patch) | |
tree | 70d9f9fd944e5d33ab2ce396f22fbf279bce94f8 /src/mesa/drivers/dri/i965/brw_draw_upload.c | |
parent | 7c8dfa78b98a12c1c5f74d11433c8554d4c90657 (diff) |
i965/draw: Use the real size for index buffers
Previously, we were using the size of the whole BO which may be
substantially larger than the actual index buffer size.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_draw_upload.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index fd6ea8c3f50..3349161754b 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -1018,7 +1018,8 @@ brw_upload_indices(struct brw_context *brw) return; ib_type_size = _mesa_sizeof_type(index_buffer->type); - ib_size = ib_type_size * index_buffer->count; + ib_size = index_buffer->count ? ib_type_size * index_buffer->count : + index_buffer->obj->Size; bufferobj = index_buffer->obj; /* Turn into a proper VBO: @@ -1028,6 +1029,7 @@ brw_upload_indices(struct brw_context *brw) */ intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size, &brw->ib.bo, &offset); + brw->ib.size = brw->ib.bo->size; } else { offset = (GLuint) (unsigned long) index_buffer->ptr; @@ -1047,6 +1049,7 @@ brw_upload_indices(struct brw_context *brw) intel_upload_data(brw, map, ib_size, ib_type_size, &brw->ib.bo, &offset); + brw->ib.size = brw->ib.bo->size; ctx->Driver.UnmapBuffer(ctx, bufferobj, MAP_INTERNAL); } else { @@ -1056,6 +1059,7 @@ brw_upload_indices(struct brw_context *brw) if (bo != brw->ib.bo) { drm_intel_bo_unreference(brw->ib.bo); brw->ib.bo = bo; + brw->ib.size = bufferobj->Size; drm_intel_bo_reference(bo); } } @@ -1110,7 +1114,7 @@ brw_emit_index_buffer(struct brw_context *brw) 0); OUT_RELOC(brw->ib.bo, I915_GEM_DOMAIN_VERTEX, 0, - brw->ib.bo->size - 1); + brw->ib.size - 1); ADVANCE_BATCH(); } |