From 126b35bd3acbf486471879531cd2e6f446b14497 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Dec 2009 15:09:16 -0700 Subject: mesa: implement indexed glGet functions The functions are _mesa_GetBooleanIndexedv(), _mesa_GetIntegerIndexedv(), and _mesa_GetInteger64Indexedv(). These will be called from API functions such as glGetBooleanIndexedvEXT() and glGetBooleani_v(). Only the GL_BLEND query is supported at this time. --- src/mesa/main/get.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'src/mesa/main/get.c') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 07507414d7..aff67466bc 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -7434,3 +7434,77 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) params[i] = (GLdouble) values[i]; } +void GLAPIENTRY +_mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (ctx->NewState) + _mesa_update_state(ctx); + + switch (pname) { + case GL_BLEND: + if (index >= MAX_DRAW_BUFFERS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); + } + params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1)); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanIndexedv(pname=0x%x)", pname); + } +} + +void GLAPIENTRY +_mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (ctx->NewState) + _mesa_update_state(ctx); + + switch (pname) { + case GL_BLEND: + if (index >= MAX_DRAW_BUFFERS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); + } + params[0] = ((ctx->Color.BlendEnabled >> index) & 1); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerIndexedv(pname=0x%x)", pname); + } +} + +#if FEATURE_ARB_sync +void GLAPIENTRY +_mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params ) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (!params) + return; + + if (ctx->NewState) + _mesa_update_state(ctx); + + switch (pname) { + case GL_BLEND: + if (index >= MAX_DRAW_BUFFERS) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); + } + params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1)); + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64Indexedv(pname=0x%x)", pname); + } +} +#endif /* FEATURE_ARB_sync */ + -- cgit v1.2.3