summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2020-03-03 15:03:28 -0500
committerMarek Olšák <marek.olsak@amd.com>2020-03-04 19:54:43 -0500
commit450152f8d85f9f54498ea5116561f2aefe7378dc (patch)
tree942ee64ee9a18e556fa57340d09673bd074c76ab /src/mesa/tnl
parentdf3891e74a72d275aceba91adc94a9e7dc9aa029 (diff)
mesa: remove _mesa_index_buffer::index_size in favor of index_size_shift
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Suggested-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4052>
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_draw.c8
-rw-r--r--src/mesa/tnl/t_rebase.c9
-rw-r--r--src/mesa/tnl/t_split_copy.c9
-rw-r--r--src/mesa/tnl/t_split_inplace.c3
4 files changed, 13 insertions, 16 deletions
diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c
index b39c8443814..ee77e802678 100644
--- a/src/mesa/tnl/t_draw.c
+++ b/src/mesa/tnl/t_draw.c
@@ -368,7 +368,7 @@ static void bind_indices( struct gl_context *ctx,
bo[*nr_bo] = ib->obj;
(*nr_bo)++;
ptr = ctx->Driver.MapBufferRange(ctx, (GLsizeiptr) ib->ptr,
- ib->count * ib->index_size,
+ ib->count << ib->index_size_shift,
GL_MAP_READ_BIT, ib->obj,
MAP_INTERNAL);
assert(ib->obj->Mappings[MAP_INTERNAL].Pointer);
@@ -377,19 +377,19 @@ static void bind_indices( struct gl_context *ctx,
ptr = ADD_POINTERS(ib->obj->Mappings[MAP_INTERNAL].Pointer, ib->ptr);
}
- if (ib->index_size == 4 && VB->Primitive[0].basevertex == 0) {
+ if (ib->index_size_shift == 2 && 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->index_size == 4) {
+ if (ib->index_size_shift == 2) {
const GLuint *in = (GLuint *)ptr;
for (i = 0; i < ib->count; i++)
*elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex;
}
- else if (ib->index_size == 2) {
+ else if (ib->index_size_shift == 1) {
const GLushort *in = (GLushort *)ptr;
for (i = 0; i < ib->count; i++)
*elts++ = (GLuint)(*in++) + VB->Primitive[0].basevertex;
diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c
index 3c2a0e0afcc..54d39df733b 100644
--- a/src/mesa/tnl/t_rebase.c
+++ b/src/mesa/tnl/t_rebase.c
@@ -165,14 +165,14 @@ void t_rebase_prims( struct gl_context *ctx,
/* Some users might prefer it if we translated elements to
* GLuints here. Others wouldn't...
*/
- switch (ib->index_size) {
- case 4:
+ switch (ib->index_size_shift) {
+ case 2:
tmp_indices = rebase_GLuint( ptr, ib->count, min_index );
break;
- case 2:
+ case 1:
tmp_indices = rebase_GLushort( ptr, ib->count, min_index );
break;
- case 1:
+ case 0:
tmp_indices = rebase_GLubyte( ptr, ib->count, min_index );
break;
}
@@ -187,7 +187,6 @@ void t_rebase_prims( struct gl_context *ctx,
tmp_ib.obj = ctx->Shared->NullBufferObj;
tmp_ib.ptr = tmp_indices;
tmp_ib.count = ib->count;
- tmp_ib.index_size = ib->index_size;
tmp_ib.index_size_shift = ib->index_size_shift;
ib = &tmp_ib;
diff --git a/src/mesa/tnl/t_split_copy.c b/src/mesa/tnl/t_split_copy.c
index f20a97755cb..9d5c324ebef 100644
--- a/src/mesa/tnl/t_split_copy.c
+++ b/src/mesa/tnl/t_split_copy.c
@@ -481,8 +481,8 @@ replay_init(struct copy_context *copy)
ADD_POINTERS(copy->ib->obj->Mappings[MAP_INTERNAL].Pointer,
copy->ib->ptr);
- switch (copy->ib->index_size) {
- case 1:
+ switch (copy->ib->index_size_shift) {
+ case 0:
copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
@@ -490,7 +490,7 @@ replay_init(struct copy_context *copy)
copy->translated_elt_buf[i] = ((const GLubyte *)srcptr)[i];
break;
- case 2:
+ case 1:
copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
@@ -498,7 +498,7 @@ replay_init(struct copy_context *copy)
copy->translated_elt_buf[i] = ((const GLushort *)srcptr)[i];
break;
- case 4:
+ case 2:
copy->translated_elt_buf = NULL;
copy->srcelt = (const GLuint *)srcptr;
break;
@@ -550,7 +550,6 @@ replay_init(struct copy_context *copy)
* list:
*/
copy->dstib.count = 0; /* duplicates dstelt_nr */
- copy->dstib.index_size = 4;
copy->dstib.index_size_shift = 2;
copy->dstib.obj = ctx->Shared->NullBufferObj;
copy->dstib.ptr = copy->dstelt;
diff --git a/src/mesa/tnl/t_split_inplace.c b/src/mesa/tnl/t_split_inplace.c
index ee229b6a97f..76d3d89094a 100644
--- a/src/mesa/tnl/t_split_inplace.c
+++ b/src/mesa/tnl/t_split_inplace.c
@@ -78,7 +78,7 @@ flush_vertex( struct split_context *split)
ib.count = split->max_index - split->min_index + 1;
ib.ptr = (const void *)((const char *)ib.ptr +
- split->min_index * ib.index_size);
+ (split->min_index << ib.index_size_shift));
/* Rebase the primitives to save index buffer entries. */
for (i = 0; i < split->dstprim_nr; i++)
@@ -227,7 +227,6 @@ split_prims(struct split_context *split)
elts[j] = prim->start + j;
ib.count = count;
- ib.index_size = 4;
ib.index_size_shift = 2;
ib.obj = split->ctx->Shared->NullBufferObj;
ib.ptr = elts;