Add sanity check for Cg/GLSL attrib indices.

This commit is contained in:
Themaister 2014-05-28 19:30:03 +02:00
parent 115758a09f
commit f1db922c26
2 changed files with 6 additions and 0 deletions

View File

@ -149,6 +149,9 @@ static char cg_alias_define[GFX_MAX_SHADERS][128];
static void gl_cg_reset_attrib(void)
{
unsigned i;
// Add sanity check that we did not overflow.
rarch_assert(cg_attrib_index <= ARRAY_SIZE(cg_attribs));
for (i = 0; i < cg_attrib_index; i++)
cgGLDisableClientState(cg_attribs[i]);
cg_attrib_index = 0;

View File

@ -459,6 +459,9 @@ static bool compile_programs(GLuint *gl_prog)
static void gl_glsl_reset_attrib(void)
{
unsigned i;
// Add sanity check that we did not overflow.
rarch_assert(gl_attrib_index <= ARRAY_SIZE(gl_attribs));
for (i = 0; i < gl_attrib_index; i++)
glDisableVertexAttribArray(gl_attribs[i]);
gl_attrib_index = 0;