* Helper to enable/disable VAO client-side state.
*/
static void
-vao_state(struct gl_context *ctx, gl_vert_attrib attr, GLboolean state)
+vao_state(struct gl_context *ctx, struct gl_vertex_array_object* vao,
+ gl_vert_attrib attr, GLboolean state)
{
if (state)
- _mesa_enable_vertex_array_attrib(ctx, ctx->Array.VAO, attr);
+ _mesa_enable_vertex_array_attrib(ctx, vao, attr);
else
- _mesa_disable_vertex_array_attrib(ctx, ctx->Array.VAO, attr);
+ _mesa_disable_vertex_array_attrib(ctx, vao, attr);
}
* Helper to enable/disable client-side state.
*/
static void
-client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
+client_state(struct gl_context *ctx, struct gl_vertex_array_object* vao,
+ GLenum cap, GLboolean state)
{
switch (cap) {
case GL_VERTEX_ARRAY:
- vao_state(ctx, VERT_ATTRIB_POS, state);
+ vao_state(ctx, vao, VERT_ATTRIB_POS, state);
break;
case GL_NORMAL_ARRAY:
- vao_state(ctx, VERT_ATTRIB_NORMAL, state);
+ vao_state(ctx, vao, VERT_ATTRIB_NORMAL, state);
break;
case GL_COLOR_ARRAY:
- vao_state(ctx, VERT_ATTRIB_COLOR0, state);
+ vao_state(ctx, vao, VERT_ATTRIB_COLOR0, state);
break;
case GL_INDEX_ARRAY:
- vao_state(ctx, VERT_ATTRIB_COLOR_INDEX, state);
+ vao_state(ctx, vao, VERT_ATTRIB_COLOR_INDEX, state);
break;
case GL_TEXTURE_COORD_ARRAY:
- vao_state(ctx, VERT_ATTRIB_TEX(ctx->Array.ActiveTexture), state);
+ vao_state(ctx, vao, VERT_ATTRIB_TEX(ctx->Array.ActiveTexture), state);
break;
case GL_EDGE_FLAG_ARRAY:
- vao_state(ctx, VERT_ATTRIB_EDGEFLAG, state);
+ vao_state(ctx, vao, VERT_ATTRIB_EDGEFLAG, state);
break;
case GL_FOG_COORDINATE_ARRAY_EXT:
- vao_state(ctx, VERT_ATTRIB_FOG, state);
+ vao_state(ctx, vao, VERT_ATTRIB_FOG, state);
break;
case GL_SECONDARY_COLOR_ARRAY_EXT:
- vao_state(ctx, VERT_ATTRIB_COLOR1, state);
+ vao_state(ctx, vao, VERT_ATTRIB_COLOR1, state);
break;
case GL_POINT_SIZE_ARRAY_OES:
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->VertexProgram.PointSizeEnabled = state;
- vao_state(ctx, VERT_ATTRIB_POINT_SIZE, state);
+ vao_state(ctx, vao, VERT_ATTRIB_POINT_SIZE, state);
break;
/* GL_NV_primitive_restart */
* - DisableClientStateiEXT
*/
static void
-client_state_i(struct gl_context *ctx, GLenum cap, GLuint index, GLboolean state)
+client_state_i(struct gl_context *ctx, struct gl_vertex_array_object* vao,
+ GLenum cap, GLuint index, GLboolean state)
{
int saved_active;
saved_active = ctx->Array.ActiveTexture;
_mesa_ClientActiveTexture(GL_TEXTURE0 + index);
- client_state(ctx, cap, state);
+ client_state(ctx, vao, cap, state);
_mesa_ClientActiveTexture(GL_TEXTURE0 + saved_active);
}
_mesa_EnableClientState( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
- client_state( ctx, cap, GL_TRUE );
+ client_state( ctx, ctx->Array.VAO, cap, GL_TRUE );
}
_mesa_EnableClientStateiEXT( GLenum cap, GLuint index )
{
GET_CURRENT_CONTEXT(ctx);
- client_state_i(ctx, cap, index, GL_TRUE);
+ client_state_i(ctx, ctx->Array.VAO, cap, index, GL_TRUE);
}
_mesa_DisableClientState( GLenum cap )
{
GET_CURRENT_CONTEXT(ctx);
- client_state( ctx, cap, GL_FALSE );
+ client_state( ctx, ctx->Array.VAO, cap, GL_FALSE );
}
void GLAPIENTRY
_mesa_DisableClientStateiEXT( GLenum cap, GLuint index )
{
GET_CURRENT_CONTEXT(ctx);
- client_state_i(ctx, cap, index, GL_FALSE);
+ client_state_i(ctx, ctx->Array.VAO, cap, index, GL_FALSE);
}
#define CHECK_EXTENSION(EXTNAME) \
case GL_TEXTURE_COORD_ARRAY:
if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES)
goto invalid_enum_error;
- client_state( ctx, cap, state );
+ client_state( ctx, ctx->Array.VAO, cap, state );
return;
case GL_INDEX_ARRAY:
case GL_EDGE_FLAG_ARRAY:
case GL_SECONDARY_COLOR_ARRAY_EXT:
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
- client_state( ctx, cap, state );
+ client_state( ctx, ctx->Array.VAO, cap, state );
return;
case GL_POINT_SIZE_ARRAY_OES:
if (ctx->API != API_OPENGLES)
goto invalid_enum_error;
- client_state( ctx, cap, state );
+ client_state( ctx, ctx->Array.VAO, cap, state );
return;
/* GL_ARB_texture_cube_map */