summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/nouveau
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-04-02 19:07:49 +0200
committerMarek Olšák <[email protected]>2017-04-22 22:51:15 +0200
commit070072ad43bb41624d271f10697ea21a776b1ec1 (patch)
tree2f88efd83530f8a71e4dec1634378020a8826565 /src/mesa/drivers/dri/nouveau
parente137b9eed9501858e2037719a94aafee35179249 (diff)
mesa: replace _mesa_index_buffer::type with index_size
This avoids repeated translations of the enum. Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/nouveau')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_render_t.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c14
2 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
index 1625a87223f..db60b59c8fc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_render_t.c
@@ -158,16 +158,16 @@ get_max_vertices(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
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;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
index 51ffd5aef54..fdd135c5d7d 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
@@ -59,9 +59,19 @@ vbo_init_arrays(struct gl_context *ctx, const struct _mesa_index_buffer *ib,
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];