vbo: change vbo_context attribute map arrays to GLubyte
The values will never be larger than VBO_ATTRIB_MAX (currently 44). v2: add STATIC_ASSERT to be sure VBO_ATTRIB_MAX can fit in ubyte, per Emil. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
@@ -200,6 +200,9 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
|
||||
{
|
||||
GLuint i;
|
||||
|
||||
/* make sure all VBO_ATTRIB_ values can fit in an unsigned byte */
|
||||
STATIC_ASSERT(VBO_ATTRIB_MAX <= 255);
|
||||
|
||||
/* identity mapping */
|
||||
for (i = 0; i < ARRAY_SIZE(vbo->map_vp_none); i++)
|
||||
vbo->map_vp_none[i] = i;
|
||||
|
||||
@@ -67,8 +67,8 @@ struct vbo_context {
|
||||
struct gl_vertex_array currval[VBO_ATTRIB_MAX];
|
||||
|
||||
/** Map VERT_ATTRIB_x to VBO_ATTRIB_y */
|
||||
GLuint map_vp_none[VERT_ATTRIB_MAX];
|
||||
GLuint map_vp_arb[VERT_ATTRIB_MAX];
|
||||
GLubyte map_vp_none[VERT_ATTRIB_MAX];
|
||||
GLubyte map_vp_arb[VERT_ATTRIB_MAX];
|
||||
|
||||
struct vbo_exec_context exec;
|
||||
struct vbo_save_context save;
|
||||
|
||||
@@ -175,7 +175,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
|
||||
struct vbo_context *vbo = vbo_context(ctx);
|
||||
struct vbo_exec_context *exec = &vbo->exec;
|
||||
struct gl_vertex_array *arrays = exec->vtx.arrays;
|
||||
const GLuint *map;
|
||||
const GLubyte *map;
|
||||
GLuint attr;
|
||||
GLbitfield varying_inputs = 0x0;
|
||||
bool swap_pos = false;
|
||||
|
||||
@@ -137,7 +137,7 @@ bind_vertex_list(struct gl_context *ctx,
|
||||
struct vbo_save_context *save = &vbo->save;
|
||||
struct gl_vertex_array *arrays = save->arrays;
|
||||
GLuint buffer_offset = node->buffer_offset;
|
||||
const GLuint *map;
|
||||
const GLubyte *map;
|
||||
GLuint attr;
|
||||
GLubyte node_attrsz[VBO_ATTRIB_MAX]; /* copy of node->attrsz[] */
|
||||
GLenum node_attrtype[VBO_ATTRIB_MAX]; /* copy of node->attrtype[] */
|
||||
@@ -160,7 +160,7 @@ bind_vertex_list(struct gl_context *ctx,
|
||||
|
||||
/* Install the default (ie Current) attributes first */
|
||||
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
|
||||
save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
|
||||
save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS + attr];
|
||||
}
|
||||
|
||||
/* Overlay other active attributes */
|
||||
|
||||
Reference in New Issue
Block a user