diff options
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r-- | src/mesa/main/get.c | 311 |
1 files changed, 242 insertions, 69 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index edc44009120..6f38658cc10 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: @@ -917,6 +916,10 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(MESA_texture_array, "GetBooleanv"); params[0] = INT_TO_BOOLEAN(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; + case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: + CHECK_EXT1(MESA_texture_array, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxArrayTextureLayers); + break; case GL_TEXTURE_GEN_S: params[0] = ((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0); break; @@ -1341,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"); @@ -1367,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"); @@ -1792,10 +1791,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetBooleanv"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetBooleanv"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: @@ -1923,6 +1926,26 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) CHECK_EXT1(ARB_sync, "GetBooleanv"); params[0] = INT64_TO_BOOLEAN(ctx->Const.MaxServerWaitTimeout); break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->TransformFeedback.CurrentBuffer->Name); + break; + case GL_RASTERIZER_DISCARD: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanv"); + params[0] = ctx->TransformFeedback.RasterDiscard; + break; + case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackInterleavedComponents); + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateAttribs); + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanv"); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxTransformFeedbackSeparateComponents); + break; case GL_NUM_EXTENSIONS: params[0] = INT_TO_BOOLEAN(_mesa_get_extension_count(ctx)); break; @@ -1932,6 +1955,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_MINOR_VERSION: params[0] = INT_TO_BOOLEAN(ctx->VersionMinor); break; + case GL_CONTEXT_FLAGS: + params[0] = INT_TO_BOOLEAN(ctx->Const.ContextFlags); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname); } @@ -1946,9 +1972,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; @@ -1976,6 +1999,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: @@ -2036,6 +2061,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: @@ -2090,27 +2117,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]; @@ -2203,10 +2224,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); @@ -2248,12 +2267,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: @@ -2684,6 +2707,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: @@ -2786,6 +2811,10 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(MESA_texture_array, "GetFloatv"); params[0] = (GLfloat)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; + case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: + CHECK_EXT1(MESA_texture_array, "GetFloatv"); + params[0] = (GLfloat)(ctx->Const.MaxArrayTextureLayers); + break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_FLOAT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; @@ -3210,13 +3239,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"); @@ -3236,10 +3263,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"); @@ -3661,10 +3686,14 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetFloatv"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetFloatv"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLfloat)(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: @@ -3792,6 +3821,26 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) CHECK_EXT1(ARB_sync, "GetFloatv"); params[0] = (GLfloat)(ctx->Const.MaxServerWaitTimeout); break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetFloatv"); + params[0] = (GLfloat)(ctx->TransformFeedback.CurrentBuffer->Name); + break; + case GL_RASTERIZER_DISCARD: + CHECK_EXT1(EXT_transform_feedback, "GetFloatv"); + params[0] = BOOLEAN_TO_FLOAT(ctx->TransformFeedback.RasterDiscard); + break; + case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetFloatv"); + params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackInterleavedComponents); + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: + CHECK_EXT1(EXT_transform_feedback, "GetFloatv"); + params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateAttribs); + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetFloatv"); + params[0] = (GLfloat)(ctx->Const.MaxTransformFeedbackSeparateComponents); + break; case GL_NUM_EXTENSIONS: params[0] = (GLfloat)(_mesa_get_extension_count(ctx)); break; @@ -3801,6 +3850,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_MINOR_VERSION: params[0] = (GLfloat)(ctx->VersionMinor); break; + case GL_CONTEXT_FLAGS: + params[0] = (GLfloat)(ctx->Const.ContextFlags); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(pname=0x%x)", pname); } @@ -3815,9 +3867,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; @@ -3845,6 +3894,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: @@ -3905,6 +3956,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: @@ -3959,27 +4012,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]); @@ -4072,10 +4119,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; @@ -4117,12 +4162,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: @@ -4553,6 +4602,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: @@ -4655,6 +4706,10 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(MESA_texture_array, "GetIntegerv"); params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name; break; + case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: + CHECK_EXT1(MESA_texture_array, "GetIntegerv"); + params[0] = ctx->Const.MaxArrayTextureLayers; + break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; @@ -5079,13 +5134,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"); @@ -5105,10 +5158,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"); @@ -5530,10 +5581,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetIntegerv"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = _mesa_get_color_read_type(ctx); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetIntegerv"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = _mesa_get_color_read_format(ctx); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: @@ -5661,6 +5716,26 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) CHECK_EXT1(ARB_sync, "GetIntegerv"); params[0] = INT64_TO_INT(ctx->Const.MaxServerWaitTimeout); break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerv"); + params[0] = ctx->TransformFeedback.CurrentBuffer->Name; + break; + case GL_RASTERIZER_DISCARD: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerv"); + params[0] = BOOLEAN_TO_INT(ctx->TransformFeedback.RasterDiscard); + break; + case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerv"); + params[0] = ctx->Const.MaxTransformFeedbackInterleavedComponents; + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerv"); + params[0] = ctx->Const.MaxTransformFeedbackSeparateAttribs; + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerv"); + params[0] = ctx->Const.MaxTransformFeedbackSeparateComponents; + break; case GL_NUM_EXTENSIONS: params[0] = _mesa_get_extension_count(ctx); break; @@ -5670,6 +5745,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_MINOR_VERSION: params[0] = ctx->VersionMinor; break; + case GL_CONTEXT_FLAGS: + params[0] = ctx->Const.ContextFlags; + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname); } @@ -5685,9 +5763,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; @@ -5715,6 +5790,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: @@ -5775,6 +5852,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: @@ -5829,27 +5908,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]); @@ -5942,10 +6015,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); @@ -5987,12 +6058,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: @@ -6423,6 +6498,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: @@ -6525,6 +6602,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) CHECK_EXT1(MESA_texture_array, "GetInteger64v"); params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; + case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: + CHECK_EXT1(MESA_texture_array, "GetInteger64v"); + params[0] = (GLint64)(ctx->Const.MaxArrayTextureLayers); + break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); break; @@ -6949,13 +7030,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"); @@ -6975,10 +7054,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"); @@ -7400,10 +7477,14 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); + if (ctx->NewState & _NEW_BUFFERS) + _mesa_update_state(ctx); params[0] = (GLint64)(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: @@ -7531,6 +7612,26 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) CHECK_EXT1(ARB_sync, "GetInteger64v"); params[0] = ctx->Const.MaxServerWaitTimeout; break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64v"); + params[0] = (GLint64)(ctx->TransformFeedback.CurrentBuffer->Name); + break; + case GL_RASTERIZER_DISCARD: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64v"); + params[0] = BOOLEAN_TO_INT64(ctx->TransformFeedback.RasterDiscard); + break; + case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64v"); + params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackInterleavedComponents); + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64v"); + params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateAttribs); + break; + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64v"); + params[0] = (GLint64)(ctx->Const.MaxTransformFeedbackSeparateComponents); + break; case GL_NUM_EXTENSIONS: params[0] = (GLint64)(_mesa_get_extension_count(ctx)); break; @@ -7540,6 +7641,9 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) case GL_MINOR_VERSION: params[0] = (GLint64)(ctx->VersionMinor); break; + case GL_CONTEXT_FLAGS: + params[0] = (GLint64)(ctx->Const.ContextFlags); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64v(pname=0x%x)", pname); } @@ -7578,14 +7682,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; @@ -7593,12 +7695,37 @@ _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); params[2] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0); params[3] = INT_TO_BOOLEAN(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0); break; + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanIndexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); + return; + } + params[0] = INT64_TO_BOOLEAN(ctx->TransformFeedback.Offset[index]); + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanIndexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); + return; + } + params[0] = INT64_TO_BOOLEAN(ctx->TransformFeedback.Size[index]); + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetBooleanIndexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname); + return; + } + params[0] = INT_TO_BOOLEAN(ctx->TransformFeedback.Buffers[index]->Name); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanIndexedv(pname=0x%x)", pname); } @@ -7613,14 +7740,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; @@ -7628,12 +7753,37 @@ _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; params[2] = ctx->Color.ColorMask[index][BCOMP] ? 1 : 0; params[3] = ctx->Color.ColorMask[index][ACOMP] ? 1 : 0; break; + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerIndexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); + return; + } + params[0] = INT64_TO_INT(ctx->TransformFeedback.Offset[index]); + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerIndexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); + return; + } + params[0] = INT64_TO_INT(ctx->TransformFeedback.Size[index]); + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetIntegerIndexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname); + return; + } + params[0] = ctx->TransformFeedback.Buffers[index]->Name; + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerIndexedv(pname=0x%x)", pname); } @@ -7649,14 +7799,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; @@ -7664,12 +7812,37 @@ _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); params[2] = (GLint64)(ctx->Color.ColorMask[index][BCOMP] ? 1 : 0); params[3] = (GLint64)(ctx->Color.ColorMask[index][ACOMP] ? 1 : 0); break; + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64Indexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); + return; + } + params[0] = ctx->TransformFeedback.Offset[index]; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64Indexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); + return; + } + params[0] = ctx->TransformFeedback.Size[index]; + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + CHECK_EXT1(EXT_transform_feedback, "GetInteger64Indexedv"); + if (index >= ctx->Const.MaxTransformFeedbackSeparateAttribs) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname); + return; + } + params[0] = (GLint64)(ctx->TransformFeedback.Buffers[index]->Name); + break; default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetInteger64Indexedv(pname=0x%x)", pname); } |