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>
{
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;
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;
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;
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[] */
/* 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 */