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:
*/
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;
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 {
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);
}
}
0);
OUT_RELOC(brw->ib.bo,
I915_GEM_DOMAIN_VERTEX, 0,
- brw->ib.bo->size - 1);
+ brw->ib.size - 1);
ADVANCE_BATCH();
}
OUT_BATCH(CMD_INDEX_BUFFER << 16 | (5 - 2));
OUT_BATCH(brw_get_index_type(index_buffer->type) | mocs_wb);
OUT_RELOC64(brw->ib.bo, I915_GEM_DOMAIN_VERTEX, 0, 0);
- OUT_BATCH(brw->ib.bo->size);
+ OUT_BATCH(brw->ib.size);
ADVANCE_BATCH();
}