mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 02:40:11 +01:00
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>
This commit is contained in:
parent
7a0fd3ca1d
commit
051edcc144
1 changed files with 6 additions and 9 deletions
|
|
@ -841,12 +841,10 @@ static void brw_upload_indices(struct brw_context *brw)
|
||||||
/* Turn into a proper VBO:
|
/* Turn into a proper VBO:
|
||||||
*/
|
*/
|
||||||
if (!_mesa_is_bufferobj(bufferobj)) {
|
if (!_mesa_is_bufferobj(bufferobj)) {
|
||||||
|
|
||||||
/* Get new bufferobj, offset:
|
/* Get new bufferobj, offset:
|
||||||
*/
|
*/
|
||||||
intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size,
|
intel_upload_data(brw, index_buffer->ptr, ib_size, ib_type_size,
|
||||||
&bo, &offset);
|
&bo, &offset);
|
||||||
brw->ib.start_vertex_offset = offset / ib_type_size;
|
|
||||||
} else {
|
} else {
|
||||||
offset = (GLuint) (unsigned long) index_buffer->ptr;
|
offset = (GLuint) (unsigned long) index_buffer->ptr;
|
||||||
|
|
||||||
|
|
@ -865,22 +863,21 @@ static void brw_upload_indices(struct brw_context *brw)
|
||||||
MAP_INTERNAL);
|
MAP_INTERNAL);
|
||||||
|
|
||||||
intel_upload_data(brw, map, ib_size, ib_type_size, &bo, &offset);
|
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);
|
ctx->Driver.UnmapBuffer(ctx, bufferobj, MAP_INTERNAL);
|
||||||
} else {
|
} 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),
|
bo = intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
|
||||||
offset, ib_size);
|
offset, ib_size);
|
||||||
drm_intel_bo_reference(bo);
|
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) {
|
if (brw->ib.bo != bo) {
|
||||||
drm_intel_bo_unreference(brw->ib.bo);
|
drm_intel_bo_unreference(brw->ib.bo);
|
||||||
brw->ib.bo = bo;
|
brw->ib.bo = bo;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue