[Mesa-dev] [PATCH] mesa: replace _mesa_index_buffer::type with index_size
Marek Olšák
maraeo at gmail.com
Fri Apr 14 15:06:21 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
This avoids repeated translations of the enum.
---
src/mesa/drivers/dri/i965/brw_context.h | 21 ++++----------
src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 +++---
src/mesa/drivers/dri/i965/brw_primitive_restart.c | 10 +++----
src/mesa/drivers/dri/i965/gen8_draw_upload.c | 2 +-
src/mesa/drivers/dri/i965/genX_blorp_exec.c | 2 +-
src/mesa/drivers/dri/i965/intel_batchbuffer.c | 2 +-
src/mesa/drivers/dri/nouveau/nouveau_render_t.c | 8 +++---
src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 14 +++++++--
src/mesa/main/varray.c | 13 +++++----
src/mesa/main/varray.h | 3 +-
src/mesa/state_tracker/st_draw.c | 18 ++++++------
src/mesa/state_tracker/st_draw_feedback.c | 2 +-
src/mesa/tnl/t_draw.c | 8 +++---
src/mesa/vbo/vbo.h | 2 +-
src/mesa/vbo/vbo_exec_array.c | 12 ++++----
src/mesa/vbo/vbo_minmax_index.c | 35 ++++++++++++-----------
src/mesa/vbo/vbo_primitive_restart.c | 4 +--
src/mesa/vbo/vbo_rebase.c | 10 +++----
src/mesa/vbo/vbo_split_copy.c | 10 +++----
src/mesa/vbo/vbo_split_inplace.c | 4 +--
20 files changed, 94 insertions(+), 94 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 7b354c4..c7d6e49 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -878,21 +878,21 @@ struct brw_context
/**
* Index buffer for this draw_prims call.
*
* Updates are signaled by BRW_NEW_INDICES.
*/
const struct _mesa_index_buffer *ib;
/* Updates are signaled by BRW_NEW_INDEX_BUFFER. */
struct brw_bo *bo;
uint32_t size;
- GLuint type;
+ unsigned index_size;
/* Offset to index buffer index to use in CMD_3D_PRIM so that we can
* avoid re-uploading the IB packet over and over if we're actually
* referencing the same index buffer.
*/
unsigned int start_vertex_offset;
} ib;
/* Active vertex program:
*/
@@ -1394,37 +1394,26 @@ void brw_upload_urb_fence(struct brw_context *brw);
void brw_upload_cs_urb_state(struct brw_context *brw);
/* brw_vs.c */
gl_clip_plane *brw_select_clip_planes(struct gl_context *ctx);
/* brw_draw_upload.c */
unsigned brw_get_vertex_surface_type(struct brw_context *brw,
const struct gl_vertex_array *glarray);
static inline unsigned
-brw_get_index_type(GLenum type)
+brw_get_index_type(unsigned index_size)
{
- assert((type == GL_UNSIGNED_BYTE)
- || (type == GL_UNSIGNED_SHORT)
- || (type == GL_UNSIGNED_INT));
-
- /* The possible values for type are GL_UNSIGNED_BYTE (0x1401),
- * GL_UNSIGNED_SHORT (0x1403), and GL_UNSIGNED_INT (0x1405) which we want
- * to map to scale factors of 0, 1, and 2, respectively. These scale
- * factors are then left-shfited by 8 to be in the correct position in the
- * CMD_INDEX_BUFFER packet.
- *
- * Subtracting 0x1401 gives 0, 2, and 4. Shifting left by 7 afterwards
- * gives 0x00000000, 0x00000100, and 0x00000200. These just happen to be
- * the values the need to be written in the CMD_INDEX_BUFFER packet.
+ /* The hw needs 0x00000000, 0x00000100, and 0x00000200 for ubyte, ushort,
+ * and uint, respectively.
*/
- return (type - 0x1401) << 7;
+ return (index_size >> 1) << 8;
}
void brw_prepare_vertices(struct brw_context *brw);
/* brw_wm_surface_state.c */
void brw_init_surface_formats(struct brw_context *brw);
void brw_create_constant_surface(struct brw_context *brw,
struct brw_bo *bo,
uint32_t offset,
uint32_t size,
diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 14b60a9..7846293 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -1167,21 +1167,21 @@ brw_upload_indices(struct brw_context *brw)
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
GLuint ib_size;
struct brw_bo *old_bo = brw->ib.bo;
struct gl_buffer_object *bufferobj;
GLuint offset;
GLuint ib_type_size;
if (index_buffer == NULL)
return;
- ib_type_size = _mesa_sizeof_type(index_buffer->type);
+ ib_type_size = index_buffer->index_size;
ib_size = index_buffer->count ? ib_type_size * index_buffer->count :
index_buffer->obj->Size;
bufferobj = index_buffer->obj;
/* 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,
@@ -1224,22 +1224,22 @@ brw_upload_indices(struct brw_context *brw)
/* 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 != old_bo)
brw->ctx.NewDriverState |= BRW_NEW_INDEX_BUFFER;
- if (index_buffer->type != brw->ib.type) {
- brw->ib.type = index_buffer->type;
+ if (index_buffer->index_size != brw->ib.index_size) {
+ brw->ib.index_size = index_buffer->index_size;
brw->ctx.NewDriverState |= BRW_NEW_INDEX_BUFFER;
}
}
const struct brw_tracked_state brw_indices = {
.dirty = {
.mesa = 0,
.brw = BRW_NEW_BLORP |
BRW_NEW_INDICES,
},
@@ -1257,21 +1257,21 @@ brw_emit_index_buffer(struct brw_context *brw)
if (brw->prim_restart.enable_cut_index && !brw->is_haswell) {
cut_index_setting = BRW_CUT_INDEX_ENABLE;
} else {
cut_index_setting = 0;
}
BEGIN_BATCH(3);
OUT_BATCH(CMD_INDEX_BUFFER << 16 |
cut_index_setting |
- brw_get_index_type(index_buffer->type) |
+ brw_get_index_type(index_buffer->index_size) |
1);
OUT_RELOC(brw->ib.bo,
I915_GEM_DOMAIN_VERTEX, 0,
0);
OUT_RELOC(brw->ib.bo,
I915_GEM_DOMAIN_VERTEX, 0,
brw->ib.size - 1);
ADVANCE_BATCH();
}
diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
index e329cc7..8e5a58a 100644
--- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c
+++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c
@@ -45,28 +45,28 @@ can_cut_index_handle_restart_index(struct gl_context *ctx,
const struct _mesa_index_buffer *ib)
{
/* The FixedIndex variant means 0xFF, 0xFFFF, or 0xFFFFFFFF based on
* the index buffer type, which corresponds exactly to the hardware.
*/
if (ctx->Array.PrimitiveRestartFixedIndex)
return true;
bool cut_index_will_work;
- switch (ib->type) {
- case GL_UNSIGNED_BYTE:
+ switch (ib->index_size) {
+ case 1:
cut_index_will_work = ctx->Array.RestartIndex == 0xff;
break;
- case GL_UNSIGNED_SHORT:
+ case 2:
cut_index_will_work = ctx->Array.RestartIndex == 0xffff;
break;
- case GL_UNSIGNED_INT:
+ case 4:
cut_index_will_work = ctx->Array.RestartIndex == 0xffffffff;
break;
default:
unreachable("not reached");
}
return cut_index_will_work;
}
/**
@@ -186,21 +186,21 @@ haswell_upload_cut_index(struct brw_context *brw)
/* Don't trigger on Ivybridge */
if (brw->gen < 8 && !brw->is_haswell)
return;
const unsigned cut_index_setting =
ctx->Array._PrimitiveRestart ? HSW_CUT_INDEX_ENABLE : 0;
/* BRW_NEW_INDEX_BUFFER */
unsigned cut_index;
if (brw->ib.ib) {
- cut_index = _mesa_primitive_restart_index(ctx, brw->ib.type);
+ cut_index = _mesa_primitive_restart_index(ctx, brw->ib.index_size);
} else {
/* There's no index buffer, but primitive restart may still apply
* to glDrawArrays and such. FIXED_INDEX mode only applies to drawing
* operations that use an index buffer, so we can ignore it and use
* the GL restart index directly.
*/
cut_index = ctx->Array.RestartIndex;
}
BEGIN_BATCH(2);
diff --git a/src/mesa/drivers/dri/i965/gen8_draw_upload.c b/src/mesa/drivers/dri/i965/gen8_draw_upload.c
index 32e1447..e81cca9 100644
--- a/src/mesa/drivers/dri/i965/gen8_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/gen8_draw_upload.c
@@ -368,21 +368,21 @@ static void
gen8_emit_index_buffer(struct brw_context *brw)
{
const struct _mesa_index_buffer *index_buffer = brw->ib.ib;
uint32_t mocs_wb = brw->gen >= 9 ? SKL_MOCS_WB : BDW_MOCS_WB;
if (index_buffer == NULL)
return;
BEGIN_BATCH(5);
OUT_BATCH(CMD_INDEX_BUFFER << 16 | (5 - 2));
- OUT_BATCH(brw_get_index_type(index_buffer->type) | mocs_wb);
+ OUT_BATCH(brw_get_index_type(index_buffer->index_size) | mocs_wb);
OUT_RELOC64(brw->ib.bo, I915_GEM_DOMAIN_VERTEX, 0, 0);
OUT_BATCH(brw->ib.size);
ADVANCE_BATCH();
}
const struct brw_tracked_state gen8_index_buffer = {
.dirty = {
.mesa = 0,
.brw = BRW_NEW_BATCH |
BRW_NEW_BLORP |
diff --git a/src/mesa/drivers/dri/i965/genX_blorp_exec.c b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
index 3931b8c..7157420 100644
--- a/src/mesa/drivers/dri/i965/genX_blorp_exec.c
+++ b/src/mesa/drivers/dri/i965/genX_blorp_exec.c
@@ -257,19 +257,19 @@ retry:
}
if (unlikely(brw->always_flush_batch))
intel_batchbuffer_flush(brw);
/* We've smashed all state compared to what the normal 3D pipeline
* rendering tracks for GL.
*/
brw->ctx.NewDriverState |= BRW_NEW_BLORP;
brw->no_depth_or_stencil = false;
- brw->ib.type = -1;
+ brw->ib.index_size = -1;
if (params->dst.enabled)
brw_render_cache_set_add_bo(brw, params->dst.addr.buffer);
if (params->depth.enabled)
brw_render_cache_set_add_bo(brw, params->depth.addr.buffer);
if (params->stencil.enabled)
brw_render_cache_set_add_bo(brw, params->stencil.addr.buffer);
}
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index 6e4b55c..154c095 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -382,21 +382,21 @@ brw_new_batch(struct brw_context *brw)
* preserved between batches; we only need to re-emit state that is required
* to be in every batch. Otherwise we need to re-emit all the state that
* would otherwise be stored in the context (which for all intents and
* purposes means everything).
*/
if (brw->hw_ctx == 0)
brw->ctx.NewDriverState |= BRW_NEW_CONTEXT;
brw->ctx.NewDriverState |= BRW_NEW_BATCH;
- brw->ib.type = -1;
+ brw->ib.index_size = -1;
/* We need to periodically reap the shader time results, because rollover
* happens every few seconds. We also want to see results every once in a
* while, because many programs won't cleanly destroy our context, so the
* end-of-run printout may not happen.
*/
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
brw_collect_and_report_shader_time(brw);
}
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
index 1625a87..db60b59 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
@@ -151,30 +151,30 @@ get_max_vertices(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
{
struct nouveau_render_state *render = to_render_state(ctx);
if (render->mode == IMM) {
return MAX2(0, n - 4) / (render->vertex_size / 4 +
render->attr_count);
} else {
unsigned max_out;
if (ib) {
- switch (ib->type) {
- case GL_UNSIGNED_INT:
+ switch (ib->index_size) {
+ case 4:
max_out = MAX_OUT_I32;
break;
- case GL_UNSIGNED_SHORT:
+ case 2:
max_out = MAX_OUT_I16;
break;
- case GL_UNSIGNED_BYTE:
+ case 1:
max_out = MAX_OUT_I16;
break;
default:
assert(0);
max_out = 0;
break;
}
} else {
max_out = MAX_OUT_L;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 51ffd5a..fdd135c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -52,23 +52,33 @@ get_array_stride(struct gl_context *ctx, const struct gl_vertex_array *a)
}
static void
vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
const struct gl_vertex_array **arrays)
{
struct nouveau_render_state *render = to_render_state(ctx);
GLboolean imm = (render->mode == IMM);
int i, attr;
- if (ib)
- nouveau_init_array(&render->ib, 0, 0, ib->count, ib->type,
+ if (ib) {
+ GLenum ib_type;
+
+ if (ib->index_size == 4)
+ ib_type = GL_UNSIGNED_INT;
+ else if (ib->index_size == 2)
+ ib_type = GL_UNSIGNED_SHORT;
+ else
+ ib_type = GL_UNSIGNED_BYTE;
+
+ nouveau_init_array(&render->ib, 0, 0, ib->count, ib_type,
ib->obj, ib->ptr, GL_TRUE, ctx);
+ }
FOR_EACH_BOUND_ATTR(render, i, attr) {
const struct gl_vertex_array *array = arrays[attr];
nouveau_init_array(&render->attrs[attr], attr,
get_array_stride(ctx, array),
array->Size, array->Type,
imm ? array->BufferObj : NULL,
array->Ptr, imm, ctx);
}
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 233dc0d..eca2f1f 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1656,37 +1656,38 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor)
*
* VertexAttribBinding(index, index);
* VertexBindingDivisor(index, divisor);"
*/
vertex_attrib_binding(ctx, vao, genericIndex, genericIndex);
vertex_binding_divisor(ctx, vao, genericIndex, divisor);
}
unsigned
-_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type)
+_mesa_primitive_restart_index(const struct gl_context *ctx,
+ unsigned index_size)
{
/* From the OpenGL 4.3 core specification, page 302:
* "If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are
* enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX
* is used."
*/
if (ctx->Array.PrimitiveRestartFixedIndex) {
- switch (ib_type) {
- case GL_UNSIGNED_BYTE:
+ switch (index_size) {
+ case 1:
return 0xff;
- case GL_UNSIGNED_SHORT:
+ case 2:
return 0xffff;
- case GL_UNSIGNED_INT:
+ case 4:
return 0xffffffff;
default:
- assert(!"_mesa_primitive_restart_index: Invalid index buffer type.");
+ assert(!"_mesa_primitive_restart_index: Invalid index size.");
}
}
return ctx->Array.RestartIndex;
}
/**
* GL_ARB_vertex_attrib_binding
*/
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 9216571..d274ec5 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -305,21 +305,22 @@ extern void GLAPIENTRY
_mesa_DrawTransformFeedback(GLenum mode, GLuint name);
extern void GLAPIENTRY
_mesa_PrimitiveRestartIndex(GLuint index);
extern void GLAPIENTRY
_mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
extern unsigned
-_mesa_primitive_restart_index(const struct gl_context *ctx, GLenum ib_type);
+_mesa_primitive_restart_index(const struct gl_context *ctx,
+ unsigned index_size);
extern void GLAPIENTRY
_mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
GLsizei stride);
extern void GLAPIENTRY
_mesa_VertexArrayVertexBuffer(GLuint vaobj, GLuint bindingIndex, GLuint buffer,
GLintptr offset, GLsizei stride);
extern void GLAPIENTRY
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index f04b6c2..4a3aae8 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -89,21 +89,21 @@ all_varyings_in_vbos(const struct gl_vertex_array *arrays[])
* Basically, translate Mesa's index buffer information into
* a pipe_index_buffer object.
*/
static void
setup_index_buffer(struct st_context *st,
const struct _mesa_index_buffer *ib)
{
struct pipe_index_buffer ibuffer;
struct gl_buffer_object *bufobj = ib->obj;
- ibuffer.index_size = vbo_sizeof_ib_type(ib->type);
+ ibuffer.index_size = ib->index_size;
/* get/create the index buffer object */
if (_mesa_is_bufferobj(bufobj)) {
/* indices are in a real VBO */
ibuffer.buffer = st_buffer_object(bufobj)->buffer;
ibuffer.offset = pointer_to_offset(ib->ptr);
ibuffer.user_buffer = NULL;
}
else {
/* indices are in user space memory */
@@ -113,35 +113,33 @@ setup_index_buffer(struct st_context *st,
}
cso_set_index_buffer(st->cso_context, &ibuffer);
}
/**
* Set the restart index.
*/
static void
-setup_primitive_restart(struct gl_context *ctx,
- const struct _mesa_index_buffer *ib,
- struct pipe_draw_info *info)
+setup_primitive_restart(struct gl_context *ctx, struct pipe_draw_info *info,
+ unsigned index_size)
{
if (ctx->Array._PrimitiveRestart) {
- info->restart_index = _mesa_primitive_restart_index(ctx, ib->type);
+ info->restart_index =
+ _mesa_primitive_restart_index(ctx, index_size);
/* Enable primitive restart only when the restart index can have an
* effect. This is required for correctness in radeonsi VI support.
* Other hardware may also benefit from taking a faster, non-restart path
* when possible.
*/
- if ((ib->type == GL_UNSIGNED_INT) ||
- (ib->type == GL_UNSIGNED_SHORT && info->restart_index <= 0xffff) ||
- (ib->type == GL_UNSIGNED_BYTE && info->restart_index <= 0xff))
+ if (index_size == 4 || info->restart_index < (1 << (index_size * 8)))
info->primitive_restart = true;
}
}
/**
* Translate OpenGL primtive type (GL_POINTS, GL_TRIANGLE_STRIP, etc) to
* the corresponding Gallium type.
*/
static unsigned
@@ -208,21 +206,21 @@ st_draw_vbo(struct gl_context *ctx,
info.indexed = TRUE;
if (min_index != ~0U && max_index != ~0U) {
info.min_index = min_index;
info.max_index = max_index;
}
/* The VBO module handles restart for the non-indexed GLDrawArrays
* so we only set these fields for indexed drawing:
*/
- setup_primitive_restart(ctx, ib, &info);
+ setup_primitive_restart(ctx, &info, ib->index_size);
}
else {
/* Transform feedback drawing is always non-indexed. */
/* Set info.count_from_stream_output. */
if (tfb_vertcount) {
if (!st_transform_feedback_draw_init(tfb_vertcount, stream, &info))
return;
}
}
@@ -293,21 +291,21 @@ st_indirect_draw_vbo(struct gl_context *ctx,
}
util_draw_init_info(&info);
if (ib) {
setup_index_buffer(st, ib);
info.indexed = TRUE;
/* Primitive restart is not handled by the VBO module in this case. */
- setup_primitive_restart(ctx, ib, &info);
+ setup_primitive_restart(ctx, &info, ib->index_size);
}
info.mode = translate_prim(ctx, mode);
info.vertices_per_patch = ctx->TessCtrlProgram.patch_vertices;
info.indirect = st_buffer_object(indirect_data)->buffer;
info.indirect_offset = indirect_offset;
if (ST_DEBUG & DEBUG_DRAW) {
debug_printf("st/draw indirect: mode %s drawcount %d indexed %d\n",
u_prim_name(info.mode),
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index fac83b9..9d68777 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -235,21 +235,21 @@ st_feedback_draw_vbo(struct gl_context *ctx,
#endif
}
draw_set_vertex_buffers(draw, 0, vp->num_inputs, vbuffers);
draw_set_vertex_elements(draw, vp->num_inputs, velements);
memset(&ibuffer, 0, sizeof(ibuffer));
if (ib) {
struct gl_buffer_object *bufobj = ib->obj;
- ibuffer.index_size = vbo_sizeof_ib_type(ib->type);
+ ibuffer.index_size = ib->index_size;
if (ibuffer.index_size == 0)
goto out_unref_vertex;
if (bufobj && bufobj->Name) {
struct st_buffer_object *stobj = st_buffer_object(bufobj);
pipe_resource_reference(&ibuffer.buffer, stobj->buffer);
ibuffer.offset = pointer_to_offset(ib->ptr);
mapped_indices = pipe_buffer_map(pipe, stobj->buffer,
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index 24d74c0..9fca4da 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -351,42 +351,42 @@ static void bind_indices( struct gl_context *ctx,
VB->Elts = NULL;
return;
}
if (_mesa_is_bufferobj(ib->obj) &&
!_mesa_bufferobj_mapped(ib->obj, MAP_INTERNAL)) {
/* if the buffer object isn't mapped yet, map it now */
bo[*nr_bo] = ib->obj;
(*nr_bo)++;
ptr = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) ib->ptr,
- ib->count * vbo_sizeof_ib_type(ib->type),
+ ib->count * ib->index_size,
GL_MAP_READ_BIT, ib->obj,
MAP_INTERNAL);
assert(ib->obj->Mappings[MAP_INTERNAL].Pointer);
} else {
/* user-space elements, or buffer already mapped */
ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
}
- if (ib->type == GL_UNSIGNED_INT && VB->Primitive[0].basevertex == 0) {
+ if (ib->index_size == 4 && VB->Primitive[0].basevertex == 0) {
VB->Elts = (GLuint *) ptr;
}
else {
GLuint *elts = (GLuint *)get_space(ctx, ib->count * sizeof(GLuint));
VB->Elts = elts;
- if (ib->type == GL_UNSIGNED_INT) {
+ if (ib->index_size == 4) {
const GLuint *in = (GLuint *)ptr;
for (i = 0; i < ib->count; i++)
*elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex;
}
- else if (ib->type == GL_UNSIGNED_SHORT) {
+ else if (ib->index_size == 2) {
const GLushort *in = (GLushort *)ptr;
for (i = 0; i < ib->count; i++)
*elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex;
}
else {
const GLubyte *in = (GLubyte *)ptr;
for (i = 0; i < ib->count; i++)
*elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex;
}
}
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index d62ab4e..79f7538 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -62,21 +62,21 @@ struct _mesa_prim {
GLsizeiptr indirect_offset;
};
/* Would like to call this a "vbo_index_buffer", but this would be
* confusing as the indices are not neccessarily yet in a non-null
* buffer object.
*/
struct _mesa_index_buffer {
GLuint count;
- GLenum type;
+ unsigned index_size;
struct gl_buffer_object *obj;
const void *ptr;
};
GLboolean _vbo_CreateContext( struct gl_context *ctx );
void _vbo_DestroyContext( struct gl_context *ctx );
void _vbo_InvalidateState( struct gl_context *ctx, GLbitfield new_state );
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 30c52d5..4e22900 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -712,21 +712,21 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
GLint basevertex, GLuint numInstances,
GLuint baseInstance)
{
struct vbo_context *vbo = vbo_context(ctx);
struct _mesa_index_buffer ib;
struct _mesa_prim prim[1];
vbo_bind_arrays(ctx);
ib.count = count;
- ib.type = type;
+ ib.index_size = vbo_sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = indices;
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
prim[0].pad = 0;
prim[0].mode = mode;
prim[0].start = 0;
prim[0].count = count;
@@ -1105,21 +1105,21 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
/* If the index buffer isn't in a VBO, then treating the application's
* subranges of the index buffer as one large index buffer may lead to
* us reading unmapped memory.
*/
if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj))
fallback = GL_TRUE;
if (!fallback) {
ib.count = (max_index_ptr - min_index_ptr) / index_type_size;
- ib.type = type;
+ ib.index_size = vbo_sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = (void *) min_index_ptr;
for (i = 0; i < primcount; i++) {
prim[i].begin = (i == 0);
prim[i].end = (i == primcount - 1);
prim[i].weak = 0;
prim[i].pad = 0;
prim[i].mode = mode;
prim[i].start =
@@ -1138,21 +1138,21 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
vbo->draw_prims(ctx, prim, primcount, &ib,
false, ~0, ~0, NULL, 0, NULL);
}
else {
/* render one prim at a time */
for (i = 0; i < primcount; i++) {
if (count[i] == 0)
continue;
ib.count = count[i];
- ib.type = type;
+ ib.index_size = vbo_sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = indices[i];
prim[0].begin = 1;
prim[0].end = 1;
prim[0].weak = 0;
prim[0].pad = 0;
prim[0].mode = mode;
prim[0].start = 0;
prim[0].count = count[i];
@@ -1373,21 +1373,21 @@ static void
vbo_validated_drawelementsindirect(struct gl_context *ctx,
GLenum mode, GLenum type,
const GLvoid *indirect)
{
struct vbo_context *vbo = vbo_context(ctx);
struct _mesa_index_buffer ib;
vbo_bind_arrays(ctx);
ib.count = 0; /* unknown */
- ib.type = type;
+ ib.index_size = vbo_sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
vbo->draw_indirect_prims(ctx, mode,
ctx->DrawIndirectBuffer, (GLsizeiptr) indirect,
1 /* draw_count */ , 20 /* stride */ ,
NULL, 0, &ib);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_mesa_flush(ctx);
@@ -1405,21 +1405,21 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx,
GLsizeiptr offset = (GLsizeiptr) indirect;
if (primcount == 0)
return;
vbo_bind_arrays(ctx);
/* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */
- ib.type = type;
+ ib.index_size = vbo_sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
vbo->draw_indirect_prims(ctx, mode,
ctx->DrawIndirectBuffer, offset,
primcount, stride, NULL, 0, &ib);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_mesa_flush(ctx);
}
@@ -1549,21 +1549,21 @@ vbo_validated_multidrawelementsindirectcount(struct gl_context *ctx,
GLsizeiptr offset = (GLsizeiptr) indirect;
if (maxdrawcount == 0)
return;
vbo_bind_arrays(ctx);
/* NOTE: IndexBufferObj is guaranteed to be a VBO. */
ib.count = 0; /* unknown */
- ib.type = type;
+ ib.index_size = vbo_sizeof_ib_type(type);
ib.obj = ctx->Array.VAO->IndexBufferObj;
ib.ptr = NULL;
vbo->draw_indirect_prims(ctx, mode,
ctx->DrawIndirectBuffer, offset,
maxdrawcount, stride,
ctx->ParameterBuffer, drawcount, &ib);
if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH)
_mesa_flush(ctx);
diff --git a/src/mesa/vbo/vbo_minmax_index.c b/src/mesa/vbo/vbo_minmax_index.c
index 0f75a87..4c17a08 100644
--- a/src/mesa/vbo/vbo_minmax_index.c
+++ b/src/mesa/vbo/vbo_minmax_index.c
@@ -31,21 +31,21 @@
#include "main/varray.h"
#include "main/macros.h"
#include "main/sse_minmax.h"
#include "x86/common_x86_asm.h"
#include "util/hash_table.h"
struct minmax_cache_key {
GLintptr offset;
GLuint count;
- GLenum type;
+ unsigned index_size;
};
struct minmax_cache_entry {
struct minmax_cache_key key;
GLuint min;
GLuint max;
};
@@ -53,21 +53,22 @@ static uint32_t
vbo_minmax_cache_hash(const struct minmax_cache_key *key)
{
return _mesa_hash_data(key, sizeof(*key));
}
static bool
vbo_minmax_cache_key_equal(const struct minmax_cache_key *a,
const struct minmax_cache_key *b)
{
- return (a->offset == b->offset) && (a->count == b->count) && (a->type == b->type);
+ return (a->offset == b->offset) && (a->count == b->count) &&
+ (a->index_size == b->index_size);
}
static void
vbo_minmax_cache_delete_entry(struct hash_entry *entry)
{
free(entry->data);
}
@@ -94,21 +95,21 @@ vbo_use_minmax_cache(struct gl_buffer_object *bufferObj)
void
vbo_delete_minmax_cache(struct gl_buffer_object *bufferObj)
{
_mesa_hash_table_destroy(bufferObj->MinMaxCache, vbo_minmax_cache_delete_entry);
bufferObj->MinMaxCache = NULL;
}
static GLboolean
vbo_get_minmax_cached(struct gl_buffer_object *bufferObj,
- GLenum type, GLintptr offset, GLuint count,
+ unsigned index_size, GLintptr offset, GLuint count,
GLuint *min_index, GLuint *max_index)
{
GLboolean found = GL_FALSE;
struct minmax_cache_key key;
uint32_t hash;
struct hash_entry *result;
if (!bufferObj->MinMaxCache)
return GL_FALSE;
if (!vbo_use_minmax_cache(bufferObj))
@@ -130,21 +131,21 @@ vbo_get_minmax_cached(struct gl_buffer_object *bufferObj,
bufferObj->UsageHistory |= USAGE_DISABLE_MINMAX_CACHE;
vbo_delete_minmax_cache(bufferObj);
goto out_disable;
}
_mesa_hash_table_clear(bufferObj->MinMaxCache, vbo_minmax_cache_delete_entry);
bufferObj->MinMaxCacheDirty = false;
goto out_invalidate;
}
- key.type = type;
+ key.index_size = index_size;
key.offset = offset;
key.count = count;
hash = vbo_minmax_cache_hash(&key);
result = _mesa_hash_table_search_pre_hashed(bufferObj->MinMaxCache, hash, &key);
if (result) {
struct minmax_cache_entry *entry = result->data;
*min_index = entry->min;
*max_index = entry->max;
found = GL_TRUE;
}
@@ -166,21 +167,21 @@ out_invalidate:
out_disable:
mtx_unlock(&bufferObj->Mutex);
return found;
}
static void
vbo_minmax_cache_store(struct gl_context *ctx,
struct gl_buffer_object *bufferObj,
- GLenum type, GLintptr offset, GLuint count,
+ unsigned index_size, GLintptr offset, GLuint count,
GLuint min, GLuint max)
{
struct minmax_cache_entry *entry;
struct hash_entry *table_entry;
uint32_t hash;
if (!vbo_use_minmax_cache(bufferObj))
return;
mtx_lock(&bufferObj->Mutex);
@@ -193,21 +194,21 @@ vbo_minmax_cache_store(struct gl_context *ctx,
if (!bufferObj->MinMaxCache)
goto out;
}
entry = MALLOC_STRUCT(minmax_cache_entry);
if (!entry)
goto out;
entry->key.offset = offset;
entry->key.count = count;
- entry->key.type = type;
+ entry->key.index_size = index_size;
entry->min = min;
entry->max = max;
hash = vbo_minmax_cache_hash(&entry->key);
table_entry = _mesa_hash_table_search_pre_hashed(bufferObj->MinMaxCache,
hash, &entry->key);
if (table_entry) {
/* It seems like this could happen when two contexts are rendering using
* the same buffer object from multiple threads.
*/
@@ -233,40 +234,40 @@ out:
* indexes when computing min/max.
*/
static void
vbo_get_minmax_index(struct gl_context *ctx,
const struct _mesa_prim *prim,
const struct _mesa_index_buffer *ib,
GLuint *min_index, GLuint *max_index,
const GLuint count)
{
const GLboolean restart = ctx->Array._PrimitiveRestart;
- const GLuint restartIndex = _mesa_primitive_restart_index(ctx, ib->type);
- const int index_size = vbo_sizeof_ib_type(ib->type);
+ const GLuint restartIndex =
+ _mesa_primitive_restart_index(ctx, ib->index_size);
const char *indices;
GLuint i;
- indices = (char *) ib->ptr + prim->start * index_size;
+ indices = (char *) ib->ptr + prim->start * ib->index_size;
if (_mesa_is_bufferobj(ib->obj)) {
- GLsizeiptr size = MIN2(count * index_size, ib->obj->Size);
+ GLsizeiptr size = MIN2(count * ib->index_size, ib->obj->Size);
- if (vbo_get_minmax_cached(ib->obj, ib->type, (GLintptr) indices, count,
- min_index, max_index))
+ if (vbo_get_minmax_cached(ib->obj, ib->index_size, (GLintptr) indices,
+ count, min_index, max_index))
return;
indices = ctx->Driver.MapBufferRange(ctx, (GLintptr) indices, size,
GL_MAP_READ_BIT, ib->obj,
MAP_INTERNAL);
}
- switch (ib->type) {
- case GL_UNSIGNED_INT: {
+ switch (ib->index_size) {
+ case 4: {
const GLuint *ui_indices = (const GLuint *)indices;
GLuint max_ui = 0;
GLuint min_ui = ~0U;
if (restart) {
for (i = 0; i < count; i++) {
if (ui_indices[i] != restartIndex) {
if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
}
}
@@ -280,21 +281,21 @@ vbo_get_minmax_index(struct gl_context *ctx,
#endif
for (i = 0; i < count; i++) {
if (ui_indices[i] > max_ui) max_ui = ui_indices[i];
if (ui_indices[i] < min_ui) min_ui = ui_indices[i];
}
}
*min_index = min_ui;
*max_index = max_ui;
break;
}
- case GL_UNSIGNED_SHORT: {
+ case 2: {
const GLushort *us_indices = (const GLushort *)indices;
GLuint max_us = 0;
GLuint min_us = ~0U;
if (restart) {
for (i = 0; i < count; i++) {
if (us_indices[i] != restartIndex) {
if (us_indices[i] > max_us) max_us = us_indices[i];
if (us_indices[i] < min_us) min_us = us_indices[i];
}
}
@@ -302,21 +303,21 @@ vbo_get_minmax_index(struct gl_context *ctx,
else {
for (i = 0; i < count; i++) {
if (us_indices[i] > max_us) max_us = us_indices[i];
if (us_indices[i] < min_us) min_us = us_indices[i];
}
}
*min_index = min_us;
*max_index = max_us;
break;
}
- case GL_UNSIGNED_BYTE: {
+ case 1: {
const GLubyte *ub_indices = (const GLubyte *)indices;
GLuint max_ub = 0;
GLuint min_ub = ~0U;
if (restart) {
for (i = 0; i < count; i++) {
if (ub_indices[i] != restartIndex) {
if (ub_indices[i] > max_ub) max_ub = ub_indices[i];
if (ub_indices[i] < min_ub) min_ub = ub_indices[i];
}
}
@@ -329,21 +330,21 @@ vbo_get_minmax_index(struct gl_context *ctx,
}
*min_index = min_ub;
*max_index = max_ub;
break;
}
default:
unreachable("not reached");
}
if (_mesa_is_bufferobj(ib->obj)) {
- vbo_minmax_cache_store(ctx, ib->obj, ib->type, prim->start, count,
+ vbo_minmax_cache_store(ctx, ib->obj, ib->index_size, prim->start, count,
*min_index, *max_index);
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
}
}
/**
* Compute min and max elements for nr_prims
*/
void
vbo_get_minmax_indices(struct gl_context *ctx,
diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c
index 0662c5c..8f04def 100644
--- a/src/mesa/vbo/vbo_primitive_restart.c
+++ b/src/mesa/vbo/vbo_primitive_restart.c
@@ -168,21 +168,21 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
{
GLuint prim_num;
struct _mesa_prim new_prim;
struct _mesa_index_buffer new_ib;
struct sub_primitive *sub_prims;
struct sub_primitive *sub_prim;
GLuint num_sub_prims;
GLuint sub_prim_num;
GLuint end_index;
GLuint sub_end_index;
- GLuint restart_index = _mesa_primitive_restart_index(ctx, ib->type);
+ GLuint restart_index = _mesa_primitive_restart_index(ctx, ib->index_size);
struct _mesa_prim temp_prim;
struct vbo_context *vbo = vbo_context(ctx);
vbo_draw_func draw_prims_func = vbo->draw_prims;
GLboolean map_ib = ib->obj->Name && !ib->obj->Mappings[MAP_INTERNAL].Pointer;
void *ptr;
/* If there is an indirect buffer, map it and extract the draw params */
if (indirect && prims[0].is_indirect) {
const uint32_t *indirect_params;
if (!ctx->Driver.MapBufferRange(ctx, 0, indirect->Size, GL_MAP_READ_BIT,
@@ -219,21 +219,21 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
/* Find the sub-primitives. These are regions in the index buffer which
* are split based on the primitive restart index value.
*/
if (map_ib) {
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
ib->obj, MAP_INTERNAL);
}
ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
- sub_prims = find_sub_primitives(ptr, vbo_sizeof_ib_type(ib->type),
+ sub_prims = find_sub_primitives(ptr, ib->index_size,
0, ib->count, restart_index,
&num_sub_prims);
if (map_ib) {
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
}
/* Loop over the primitives, and use the located sub-primitives to draw
* each primitive with a break to implement each primitive restart.
*/
diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c
index f40c59f..9f5dc46 100644
--- a/src/mesa/vbo/vbo_rebase.c
+++ b/src/mesa/vbo/vbo_rebase.c
@@ -175,43 +175,43 @@ void vbo_rebase_prims( struct gl_context *ctx,
if (map_ib)
ctx->Driver.MapBufferRange(ctx, 0, ib->obj->Size, GL_MAP_READ_BIT,
ib->obj, MAP_INTERNAL);
ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
/* Some users might prefer it if we translated elements to
* GLuints here. Others wouldn't...
*/
- switch (ib->type) {
- case GL_UNSIGNED_INT:
+ switch (ib->index_size) {
+ case 4:
tmp_indices = rebase_GLuint( ptr, ib->count, min_index );
break;
- case GL_UNSIGNED_SHORT:
+ case 2:
tmp_indices = rebase_GLushort( ptr, ib->count, min_index );
break;
- case GL_UNSIGNED_BYTE:
+ case 1:
tmp_indices = rebase_GLubyte( ptr, ib->count, min_index );
break;
}
if (map_ib)
ctx->Driver.UnmapBuffer(ctx, ib->obj, MAP_INTERNAL);
if (tmp_indices == NULL) {
return;
}
tmp_ib.obj = ctx->Shared->NullBufferObj;
tmp_ib.ptr = tmp_indices;
tmp_ib.count = ib->count;
- tmp_ib.type = ib->type;
+ tmp_ib.index_size = ib->index_size;
ib = &tmp_ib;
}
else {
/* Otherwise the primitives need adjustment.
*/
tmp_prims = malloc(sizeof(*prim) * nr_prims);
if (tmp_prims == NULL) {
_mesa_error_no_memory(__func__);
diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c
index ce8831d..8e35e44 100644
--- a/src/mesa/vbo/vbo_split_copy.c
+++ b/src/mesa/vbo/vbo_split_copy.c
@@ -472,38 +472,38 @@ replay_init( struct copy_context *copy )
*/
if (_mesa_is_bufferobj(copy->ib->obj) &&
!_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL))
ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
copy->ib->obj, MAP_INTERNAL);
srcptr = (const GLubyte *)
ADD_POINTERS(copy->ib->obj->Mappings[MAP_INTERNAL].Pointer,
copy->ib->ptr);
- switch (copy->ib->type) {
- case GL_UNSIGNED_BYTE:
+ switch (copy->ib->index_size) {
+ case 1:
copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
for (i = 0; i < copy->ib->count; i++)
copy->translated_elt_buf[i] = ((const GLubyte *)srcptr)[i];
break;
- case GL_UNSIGNED_SHORT:
+ case 2:
copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
for (i = 0; i < copy->ib->count; i++)
copy->translated_elt_buf[i] = ((const GLushort *)srcptr)[i];
break;
- case GL_UNSIGNED_INT:
+ case 4:
copy->translated_elt_buf = NULL;
copy->srcelt = (const GLuint *)srcptr;
break;
}
/* Figure out the maximum allowed vertex buffer size:
*/
if (copy->vertex_size * copy->limits->max_verts <= copy->limits->max_vb_size) {
copy->dstbuf_size = copy->limits->max_verts;
}
@@ -544,21 +544,21 @@ replay_init( struct copy_context *copy )
copy->ib->count * 2 + 3);
copy->dstelt_size = MIN2(copy->dstelt_size,
copy->limits->max_indices);
copy->dstelt = malloc(sizeof(GLuint) * copy->dstelt_size);
copy->dstelt_nr = 0;
/* Setup the new index buffer to point to the allocated element
* list:
*/
copy->dstib.count = 0; /* duplicates dstelt_nr */
- copy->dstib.type = GL_UNSIGNED_INT;
+ copy->dstib.index_size = 4;
copy->dstib.obj = ctx->Shared->NullBufferObj;
copy->dstib.ptr = copy->dstelt;
}
/**
* Free up everything allocated during split/replay.
*/
static void
replay_finish( struct copy_context *copy )
diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c
index 1430ac9..9c5c288 100644
--- a/src/mesa/vbo/vbo_split_inplace.c
+++ b/src/mesa/vbo/vbo_split_inplace.c
@@ -68,21 +68,21 @@ static void flush_vertex( struct split_context *split )
GLuint i;
if (!split->dstprim_nr)
return;
if (split->ib) {
ib = *split->ib;
ib.count = split->max_index - split->min_index + 1;
ib.ptr = (const void *)((const char *)ib.ptr +
- split->min_index * _mesa_sizeof_type(ib.type));
+ split->min_index * ib.index_size);
/* Rebase the primitives to save index buffer entries. */
for (i = 0; i < split->dstprim_nr; i++)
split->dstprim[i].start -= split->min_index;
}
assert(split->max_index >= split->min_index);
ctx->Array._DrawArrays = split->array;
ctx->NewDriverState |= ctx->DriverFlags.NewArray;
@@ -216,21 +216,21 @@ static void split_prims( struct split_context *split)
*/
struct _mesa_index_buffer ib;
struct _mesa_prim tmpprim;
GLuint *elts = malloc(count * sizeof(GLuint));
GLuint j;
for (j = 0; j < count; j++)
elts[j] = prim->start + j;
ib.count = count;
- ib.type = GL_UNSIGNED_INT;
+ ib.index_size = 4;
ib.obj = split->ctx->Shared->NullBufferObj;
ib.ptr = elts;
tmpprim = *prim;
tmpprim.indexed = 1;
tmpprim.start = 0;
tmpprim.count = count;
tmpprim.num_instances = 1;
tmpprim.base_instance = 0;
--
2.7.4
More information about the mesa-dev
mailing list