i965: Drop index buffer re-alignment code.
This shouldn't ever happen - GL requires it to be aligned: "Clients must align data elements consistent with the requirements of the client platform, with an additional base-level requirement that an offset within a buffer to a datum comprising N basic machine units be a multiple of N." Mesa should reject unaligned index buffers for us - we shouldn't have to handle them in the driver. Note that Gallium already makes this assumption. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
parent
c1b1cad586
commit
d2c4f714d1
|
@ -711,7 +711,6 @@ brw_prepare_shader_draw_parameters(struct brw_context *brw)
|
||||||
static void
|
static void
|
||||||
brw_upload_indices(struct brw_context *brw)
|
brw_upload_indices(struct brw_context *brw)
|
||||||
{
|
{
|
||||||
struct gl_context *ctx = &brw->ctx;
|
|
||||||
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
|
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
|
||||||
GLuint ib_size;
|
GLuint ib_size;
|
||||||
struct brw_bo *old_bo = brw->ib.bo;
|
struct brw_bo *old_bo = brw->ib.bo;
|
||||||
|
@ -738,35 +737,14 @@ brw_upload_indices(struct brw_context *brw)
|
||||||
} else {
|
} else {
|
||||||
offset = (GLuint) (unsigned long) index_buffer->ptr;
|
offset = (GLuint) (unsigned long) index_buffer->ptr;
|
||||||
|
|
||||||
/* If the index buffer isn't aligned to its element size, we have to
|
struct brw_bo *bo =
|
||||||
* rebase it into a temporary.
|
intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
|
||||||
*/
|
offset, ib_size);
|
||||||
if ((ib_type_size - 1) & offset) {
|
if (bo != brw->ib.bo) {
|
||||||
perf_debug("copying index buffer to a temporary to work around "
|
brw_bo_unreference(brw->ib.bo);
|
||||||
"misaligned offset %d\n", offset);
|
brw->ib.bo = bo;
|
||||||
|
brw->ib.size = bufferobj->Size;
|
||||||
GLubyte *map = ctx->Driver.MapBufferRange(ctx,
|
brw_bo_reference(bo);
|
||||||
offset,
|
|
||||||
ib_size,
|
|
||||||
GL_MAP_READ_BIT,
|
|
||||||
bufferobj,
|
|
||||||
MAP_INTERNAL);
|
|
||||||
|
|
||||||
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 {
|
|
||||||
struct brw_bo *bo =
|
|
||||||
intel_bufferobj_buffer(brw, intel_buffer_object(bufferobj),
|
|
||||||
offset, ib_size);
|
|
||||||
if (bo != brw->ib.bo) {
|
|
||||||
brw_bo_unreference(brw->ib.bo);
|
|
||||||
brw->ib.bo = bo;
|
|
||||||
brw->ib.size = bufferobj->Size;
|
|
||||||
brw_bo_reference(bo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue