diff options
author | Brian Paul <[email protected]> | 2010-03-26 10:08:52 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-03-26 10:14:00 -0600 |
commit | 22cd6f2cb4996de0a30c8f865f7011898ac8b8e2 (patch) | |
tree | dfb448023898a570ce260f968e027c88b3144a53 /src/mesa/main/get.c | |
parent | e57405e8d516c09b890c6f1c3bd8fe7780417c95 (diff) |
mesa: only call _mesa_update_state() when necessary in glGet functions
Only a few state vars require state validation before querying them.
This potentially speeds up state queries.
Encode that info into the state tuple table.
Also, use the new tuple field to indicate when FLUSH_CURRENT() must
be called to validate other state vars.
Based on a patch submitted by Robert Bragg on Feb 12, 2010.
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 115 |
1 files changed, 46 insertions, 69 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 523dc2e4f7e..266fda40ec5 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -77,9 +77,6 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - if (ctx->Driver.GetBooleanv && ctx->Driver.GetBooleanv(ctx, pname, params)) return; @@ -107,6 +104,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: @@ -167,6 +166,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: @@ -221,27 +222,21 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = ENUM_TO_BOOLEAN(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - } break; case GL_CURRENT_INDEX: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - } break; case GL_CURRENT_NORMAL: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - } break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_BOOLEAN(ctx->Current.RasterColor[0]); @@ -334,10 +329,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = ENUM_TO_BOOLEAN(ctx->DrawBuffer->ColorDrawBuffer[0]); break; case GL_EDGE_FLAG: - { FLUSH_CURRENT(ctx, 0); params[0] = (ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0); - } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = INT_TO_BOOLEAN(ctx->Feedback.BufferSize); @@ -379,12 +372,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: @@ -815,6 +812,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = FLOAT_TO_BOOLEAN(ctx->Pixel.RedBias); break; case GL_RED_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: @@ -1345,13 +1344,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); params[1] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); params[2] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); params[3] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXT1(EXT_secondary_color, "GetBooleanv"); @@ -1371,10 +1368,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_BOOLEAN(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXT1(EXT_fog_coord, "GetBooleanv"); @@ -1953,9 +1948,6 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - if (ctx->Driver.GetFloatv && ctx->Driver.GetFloatv(ctx, pname, params)) return; @@ -1983,6 +1975,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Pixel.AlphaBias; break; case GL_ALPHA_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: @@ -2043,6 +2037,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Pixel.BlueBias; break; case GL_BLUE_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: @@ -2097,27 +2093,21 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ENUM_TO_FLOAT(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]; params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]; - } break; case GL_CURRENT_INDEX: - { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]; - } break; case GL_CURRENT_NORMAL: - { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]; - } break; case GL_CURRENT_RASTER_COLOR: params[0] = ctx->Current.RasterColor[0]; @@ -2210,10 +2200,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ENUM_TO_FLOAT(ctx->DrawBuffer->ColorDrawBuffer[0]); break; case GL_EDGE_FLAG: - { FLUSH_CURRENT(ctx, 0); params[0] = BOOLEAN_TO_FLOAT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = (GLfloat)(ctx->Feedback.BufferSize); @@ -2255,12 +2243,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Pixel.GreenBias; break; case GL_GREEN_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = ctx->Pixel.GreenScale; break; case GL_INDEX_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: @@ -2691,6 +2683,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = ctx->Pixel.RedBias; break; case GL_RED_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: @@ -3221,13 +3215,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXT1(EXT_secondary_color, "GetFloatv"); - { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]; params[1] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]; params[2] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]; params[3] = ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]; - } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXT1(EXT_secondary_color, "GetFloatv"); @@ -3247,10 +3239,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXT1(EXT_fog_coord, "GetFloatv"); - { FLUSH_CURRENT(ctx, 0); params[0] = ctx->Current.Attrib[VERT_ATTRIB_FOG][0]; - } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXT1(EXT_fog_coord, "GetFloatv"); @@ -3829,9 +3819,6 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - if (ctx->Driver.GetIntegerv && ctx->Driver.GetIntegerv(ctx, pname, params)) return; @@ -3859,6 +3846,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = ctx->DrawBuffer->Visual.alphaBits; break; case GL_ALPHA_SCALE: @@ -3919,6 +3908,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = ctx->DrawBuffer->Visual.blueBits; break; case GL_BLUE_SCALE: @@ -3973,27 +3964,21 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = ENUM_TO_INT(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - } break; case GL_CURRENT_INDEX: - { FLUSH_CURRENT(ctx, 0); params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - } break; case GL_CURRENT_NORMAL: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - } break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_INT(ctx->Current.RasterColor[0]); @@ -4086,10 +4071,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = ENUM_TO_INT(ctx->DrawBuffer->ColorDrawBuffer[0]); break; case GL_EDGE_FLAG: - { FLUSH_CURRENT(ctx, 0); params[0] = BOOLEAN_TO_INT((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = ctx->Feedback.BufferSize; @@ -4131,12 +4114,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = ctx->DrawBuffer->Visual.greenBits; break; case GL_GREEN_SCALE: params[0] = IROUND(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = ctx->DrawBuffer->Visual.indexBits; break; case GL_INDEX_CLEAR_VALUE: @@ -4567,6 +4554,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = IROUND(ctx->Pixel.RedBias); break; case GL_RED_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = ctx->DrawBuffer->Visual.redBits; break; case GL_RED_SCALE: @@ -5097,13 +5086,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); params[1] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); params[2] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); params[3] = FLOAT_TO_INT(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXT1(EXT_secondary_color, "GetIntegerv"); @@ -5123,10 +5110,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); - { FLUSH_CURRENT(ctx, 0); params[0] = IROUND(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXT1(EXT_fog_coord, "GetIntegerv"); @@ -5706,9 +5691,6 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - if (ctx->Driver.GetInteger64v && ctx->Driver.GetInteger64v(ctx, pname, params)) return; @@ -5736,6 +5718,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: @@ -5796,6 +5780,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: @@ -5850,27 +5836,21 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Polygon.CullFaceMode); break; case GL_CURRENT_COLOR: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]); params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]); params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]); params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]); - } break; case GL_CURRENT_INDEX: - { FLUSH_CURRENT(ctx, 0); params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]); - } break; case GL_CURRENT_NORMAL: - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]); params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]); params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]); - } break; case GL_CURRENT_RASTER_COLOR: params[0] = FLOAT_TO_INT64(ctx->Current.RasterColor[0]); @@ -5963,10 +5943,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); break; case GL_EDGE_FLAG: - { FLUSH_CURRENT(ctx, 0); params[0] = BOOLEAN_TO_INT64((ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)); - } break; case GL_FEEDBACK_BUFFER_SIZE: params[0] = (GLint64)(ctx->Feedback.BufferSize); @@ -6008,12 +5986,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = IROUND64(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: @@ -6444,6 +6426,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.RedBias); break; case GL_RED_BITS: + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: @@ -6974,13 +6958,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_CURRENT_SECONDARY_COLOR_EXT: CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - { FLUSH_CURRENT(ctx, 0); params[0] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]); params[1] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]); params[2] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]); params[3] = FLOAT_TO_INT64(ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]); - } break; case GL_SECONDARY_COLOR_ARRAY_EXT: CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); @@ -7000,10 +6982,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - { FLUSH_CURRENT(ctx, 0); params[0] = IROUND64(ctx->Current.Attrib[VERT_ATTRIB_FOG][0]); - } break; case GL_FOG_COORDINATE_ARRAY_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); @@ -7606,14 +7586,12 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - switch (pname) { case GL_BLEND: CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv"); if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); + return; } params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1)); break; @@ -7621,6 +7599,7 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params ) CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv"); if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); + return; } params[0] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0); params[1] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0); @@ -7641,14 +7620,12 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - switch (pname) { case GL_BLEND: CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv"); if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); + return; } params[0] = ((ctx->Color.BlendEnabled >> index) & 1); break; @@ -7656,6 +7633,7 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params ) CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv"); if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); + return; } params[0] = ctx->Color.ColorMask[index][RCOMP] ? 1 : 0; params[1] = ctx->Color.ColorMask[index][GCOMP] ? 1 : 0; @@ -7677,14 +7655,12 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params ) if (!params) return; - if (ctx->NewState) - _mesa_update_state(ctx); - switch (pname) { case GL_BLEND: CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv"); if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); + return; } params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1)); break; @@ -7692,6 +7668,7 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params ) CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv"); if (index >= ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); + return; } params[0] = (GLint64)(ctx->Color.ColorMask[index][RCOMP] ? 1 : 0); params[1] = (GLint64)(ctx->Color.ColorMask[index][GCOMP] ? 1 : 0); |