-/* $Id: get.c,v 1.104 2003/01/22 00:42:45 brianp Exp $ */
+/**
+ * \file get.c
+ * State query functions.
+ */
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.0
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+/*
+ * Regarding GL_NV_light_max_exponent:
+ *
+ * Portions of this software may use or implement intellectual
+ * property owned and licensed by NVIDIA Corporation. NVIDIA disclaims
+ * any and all warranties with respect to such intellectual property,
+ * including any use thereof or modifications thereto.
+ */
#include "glheader.h"
#include "colormac.h"
#include "extensions.h"
#include "get.h"
#include "macros.h"
-#include "mmath.h"
#include "mtypes.h"
#include "texcompress.h"
+#include "version.h"
#include "math/m_matrix.h"
-
#define FLOAT_TO_BOOL(X) ( (X)==0.0F ? GL_FALSE : GL_TRUE )
#define INT_TO_BOOL(I) ( (I)==0 ? GL_FALSE : GL_TRUE )
#define ENUM_TO_BOOL(E) ( (E)==0 ? GL_FALSE : GL_TRUE )
/* Check if named extension is enabled, if not generate error and return */
-#define CHECK_EXTENSION_B(EXTNAME, PNAME) \
- if (!ctx->Extensions.EXTNAME) { \
+#define CHECK1(E1, str, PNAME) \
+ if (!ctx->Extensions.E1) { \
_mesa_error(ctx, GL_INVALID_VALUE, \
- "glGetBooleanv(0x%x)", (int) PNAME); \
+ "glGet" str "v(0x%x)", (int) PNAME); \
return; \
- }
-
-#define CHECK_EXTENSION_I(EXTNAME, PNAME) \
- if (!ctx->Extensions.EXTNAME) { \
+ }
+
+#define CHECK2(E1, E2, str, PNAME) \
+ if (!ctx->Extensions.E1 && !ctx->Extensions.E2) { \
_mesa_error(ctx, GL_INVALID_VALUE, \
- "glGetIntegerv(0x%x)", (int) PNAME); \
+ "glGet" str "v(0x%x)", (int) PNAME); \
return; \
- }
+ }
+
+#define CHECK_EXTENSION_B(EXTNAME, PNAME) \
+ CHECK1(EXTNAME, "Boolean", PNAME )
+
+#define CHECK_EXTENSION_I(EXTNAME, PNAME) \
+ CHECK1(EXTNAME, "Integer", PNAME )
#define CHECK_EXTENSION_F(EXTNAME, PNAME) \
- if (!ctx->Extensions.EXTNAME) { \
- _mesa_error(ctx, GL_INVALID_VALUE, \
- "glGetFloatv(0x%x)", (int) PNAME); \
- return; \
- }
+ CHECK1(EXTNAME, "Float", PNAME )
#define CHECK_EXTENSION_D(EXTNAME, PNAME) \
- if (!ctx->Extensions.EXTNAME) { \
- _mesa_error(ctx, GL_INVALID_VALUE, \
- "glGetDoublev(0x%x)", (int) PNAME); \
- return; \
- }
+ CHECK1(EXTNAME, "Double", PNAME )
+
+#define CHECK_EXTENSION2_B(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Boolean", PNAME)
+#define CHECK_EXTENSION2_I(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Integer", PNAME)
+
+#define CHECK_EXTENSION2_F(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Float", PNAME)
+
+#define CHECK_EXTENSION2_D(EXT1, EXT2, PNAME) \
+ CHECK2(EXT1, EXT2, "Double", PNAME)
}
-void
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetBooleanv().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetBooleanv,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLboolean.
+ */
+void GLAPIENTRY
_mesa_GetBooleanv( GLenum pname, GLboolean *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
- /* We need this in order to get correct results for
- * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
- */
- FLUSH_VERTICES(ctx, 0);
-
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetBooleanv %s\n", _mesa_lookup_enum_by_nr(pname));
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
if (ctx->Driver.GetBooleanv
&& (*ctx->Driver.GetBooleanv)(ctx, pname, params))
return;
case GL_BLEND_DST_ALPHA_EXT:
*params = ENUM_TO_BOOL(ctx->Color.BlendDstA);
break;
- case GL_BLEND_EQUATION_EXT:
- *params = ENUM_TO_BOOL( ctx->Color.BlendEquation );
+ case GL_BLEND_EQUATION:
+ *params = ENUM_TO_BOOL( ctx->Color.BlendEquationRGB );
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = ENUM_TO_BOOL( ctx->Color.BlendEquationA );
break;
case GL_BLEND_COLOR_EXT:
params[0] = FLOAT_TO_BOOL( ctx->Color.BlendColor[0] );
break;
case GL_CURRENT_INDEX:
FLUSH_CURRENT(ctx, 0);
- *params = INT_TO_BOOL(ctx->Current.Index);
+ *params = FLOAT_TO_BOOL(ctx->Current.Index);
break;
case GL_CURRENT_NORMAL:
FLUSH_CURRENT(ctx, 0);
*params = INT_TO_BOOL(ctx->List.ListBase);
break;
case GL_LIST_INDEX:
- *params = INT_TO_BOOL( ctx->CurrentListNum );
+ *params = INT_TO_BOOL( ctx->ListState.CurrentListNum );
break;
case GL_LIST_MODE:
- *params = ENUM_TO_BOOL( ctx->ExecuteFlag
- ? GL_COMPILE_AND_EXECUTE : GL_COMPILE );
+ if (!ctx->CompileFlag)
+ *params = 0;
+ else if (ctx->ExecuteFlag)
+ *params = ENUM_TO_BOOL(GL_COMPILE_AND_EXECUTE);
+ else
+ *params = ENUM_TO_BOOL(GL_COMPILE);
break;
case GL_INDEX_LOGIC_OP:
*params = ctx->Color.IndexLogicOpEnabled;
*params = INT_TO_BOOL(0);
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = ctx->Array.TexCoord[texUnit].Enabled;
+ *params = ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Size);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].Size);
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ENUM_TO_BOOL(ctx->Array.TexCoord[texUnit].Type);
+ *params = ENUM_TO_BOOL(ctx->Array.TexCoord[clientUnit].Type);
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = INT_TO_BOOL(ctx->Array.TexCoord[texUnit].Stride);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].Stride);
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = INT_TO_BOOL(0);
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_B(ARB_multitexture, pname);
- *params = INT_TO_BOOL(ctx->Const.MaxTextureUnits);
+ *params = INT_TO_BOOL(MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits));
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_B(ARB_multitexture, pname);
break;
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_B(ARB_multitexture, pname);
- *params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
+ *params = INT_TO_BOOL(GL_TEXTURE0_ARB + clientUnit);
break;
/* GL_ARB_texture_cube_map */
/* GL_SGI_texture_color_table */
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXTENSION_B(SGI_texture_color_table, pname);
- *params = ctx->Texture.ColorTableEnabled;
+ *params = textureUnit->ColorTableEnabled;
break;
/* GL_EXT_secondary_color */
break;
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
CHECK_EXTENSION_B(EXT_secondary_color, pname);
- *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Stride);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.Size);
break;
/* GL_EXT_fog_coord */
CHECK_EXTENSION_B(EXT_fog_coord, pname);
*params = INT_TO_BOOL(ctx->Array.FogCoord.Stride);
break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_B(EXT_fog_coord, pname);
+ *params = ENUM_TO_BOOL(ctx->Fog.FogCoordinateSource);
+ break;
/* GL_EXT_texture_lod_bias */
case GL_MAX_TEXTURE_LOD_BIAS_EXT:
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- CHECK_EXTENSION_B(NV_point_sprite, pname);
+ CHECK_EXTENSION2_B(NV_point_sprite, ARB_point_sprite, pname);
*params = ctx->Point.PointSprite;
break;
case GL_POINT_SPRITE_R_MODE_NV:
break;
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_B(NV_vertex_program, pname);
- *params = (MAX_PROGRAM_STACK_DEPTH > 0) ? GL_TRUE : GL_FALSE;
+ *params = (ctx->Const.MaxProgramMatrixStackDepth > 0) ? GL_TRUE : GL_FALSE;
break;
case GL_MAX_TRACK_MATRICES_NV:
CHECK_EXTENSION_B(NV_vertex_program, pname);
- *params = (MAX_PROGRAM_MATRICES > 0) ? GL_TRUE : GL_FALSE;
+ *params = (ctx->Const.MaxProgramMatrices > 0) ? GL_TRUE : GL_FALSE;
break;
case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_B(NV_vertex_program, pname);
- *params = (ctx->CurrentStack->Depth > 0) ? GL_TRUE : GL_FALSE;
+ *params = GL_TRUE;
break;
case GL_CURRENT_MATRIX_NV:
CHECK_EXTENSION_B(NV_vertex_program, pname);
- *params = (ctx->Transform.MatrixMode != 0) ? GL_TRUE : GL_FALSE;
+ for (i = 0; i < 16; i++)
+ params[i] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[i]);
break;
case GL_VERTEX_PROGRAM_BINDING_NV:
CHECK_EXTENSION_B(NV_vertex_program, pname);
#endif /* FEATURE_NV_vertex_program */
#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_B(NV_fragment_program, pname);
+ *params = ctx->FragmentProgram.Enabled;
+ break;
case GL_MAX_TEXTURE_COORDS_NV:
CHECK_EXTENSION_B(NV_fragment_program, pname);
*params = INT_TO_BOOL(ctx->Const.MaxTextureCoordUnits);
*params = ENUM_TO_BOOL(ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxShininess);
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = FLOAT_TO_BOOL(ctx->Const.MaxSpotExponent);
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ArrayBufferObj->Name);
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Vertex.BufferObj->Name);
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Normal.BufferObj->Name);
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Color.BufferObj->Name);
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.Index.BufferObj->Name);
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.TexCoord[clientUnit].BufferObj->Name);
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.EdgeFlag.BufferObj->Name);
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.SecondaryColor.BufferObj->Name);
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.FogCoord.BufferObj->Name);
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_B(ARB_vertex_buffer_object, pname);
+ *params = INT_TO_BOOL(ctx->Array.ElementArrayBufferObj->Name);
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_B(ARB_fragment_program, pname);
+ *params = ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_B(ARB_fragment_program, pname);
+ params[0] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[0]);
+ params[1] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[4]);
+ params[2] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[8]);
+ params[3] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[12]);
+ params[4] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[1]);
+ params[5] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[5]);
+ params[6] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[9]);
+ params[7] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[13]);
+ params[8] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[2]);
+ params[9] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[6]);
+ params[10] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[10]);
+ params[11] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[14]);
+ params[12] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[3]);
+ params[13] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[7]);
+ params[14] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[11]);
+ params[15] = FLOAT_TO_BOOL(ctx->CurrentStack->Top->m[15]);
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_B(EXT_depth_bounds_test, pname);
+ params[0] = FLOAT_TO_BOOL(ctx->Depth.BoundsMin);
+ params[1] = FLOAT_TO_BOOL(ctx->Depth.BoundsMax);
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = INT_TO_BOOL(ctx->FragmentProgram.CurrentPosition);
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_B(MESA_program_debug, pname);
+ *params = INT_TO_BOOL(ctx->VertexProgram.CurrentPosition);
+ break;
+#endif
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv(pname=0x%x)", pname);
}
}
-void
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetDoublev().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetDoublev,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLdouble.
+ */
+void GLAPIENTRY
_mesa_GetDoublev( GLenum pname, GLdouble *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
- /* We need this in order to get correct results for
- * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
- */
- FLUSH_VERTICES(ctx, 0);
-
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetDoublev %s\n", _mesa_lookup_enum_by_nr(pname));
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
if (ctx->Driver.GetDoublev && (*ctx->Driver.GetDoublev)(ctx, pname, params))
return;
case GL_BLEND_DST_ALPHA_EXT:
*params = ENUM_TO_DOUBLE(ctx->Color.BlendDstA);
break;
- case GL_BLEND_EQUATION_EXT:
- *params = ENUM_TO_DOUBLE(ctx->Color.BlendEquation);
+ case GL_BLEND_EQUATION:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendEquationRGB);
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = ENUM_TO_DOUBLE(ctx->Color.BlendEquationA);
break;
case GL_BLEND_COLOR_EXT:
params[0] = (GLdouble) ctx->Color.BlendColor[0];
*params = (GLdouble) ctx->List.ListBase;
break;
case GL_LIST_INDEX:
- *params = (GLdouble) ctx->CurrentListNum;
+ *params = (GLdouble) ctx->ListState.CurrentListNum;
break;
case GL_LIST_MODE:
- *params = ctx->ExecuteFlag ? ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE)
- : ENUM_TO_DOUBLE(GL_COMPILE);
+ if (!ctx->CompileFlag)
+ *params = 0.0;
+ else if (ctx->ExecuteFlag)
+ *params = ENUM_TO_DOUBLE(GL_COMPILE_AND_EXECUTE);
+ else
+ *params = ENUM_TO_DOUBLE(GL_COMPILE);
break;
case GL_INDEX_LOGIC_OP:
*params = (GLdouble) ctx->Color.IndexLogicOpEnabled;
*params = 0.0;
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = (GLdouble) ctx->Array.TexCoord[texUnit].Enabled;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = (GLdouble) ctx->Array.TexCoord[texUnit].Size;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Size;
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[texUnit].Type);
+ *params = ENUM_TO_DOUBLE(ctx->Array.TexCoord[clientUnit].Type);
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = (GLdouble) ctx->Array.TexCoord[texUnit].Stride;
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].Stride;
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = 0.0;
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_D(ARB_multitexture, pname);
- *params = (GLdouble) ctx->Const.MaxTextureUnits;
+ *params = (GLdouble) MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_D(ARB_multitexture, pname);
break;
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_D(ARB_multitexture, pname);
- *params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
+ *params = (GLdouble) (GL_TEXTURE0_ARB + clientUnit);
break;
/* GL_ARB_texture_cube_map */
/* GL_SGI_texture_color_table */
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXTENSION_D(SGI_texture_color_table, pname);
- *params = (GLdouble) ctx->Texture.ColorTableEnabled;
+ *params = (GLdouble) textureUnit->ColorTableEnabled;
break;
/* GL_EXT_secondary_color */
break;
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
CHECK_EXTENSION_D(EXT_secondary_color, pname);
- *params = (GLdouble) ctx->Array.SecondaryColor.Stride;
+ *params = (GLdouble) ctx->Array.SecondaryColor.Size;
break;
/* GL_EXT_fog_coord */
CHECK_EXTENSION_D(EXT_fog_coord, pname);
*params = (GLdouble) ctx->Array.FogCoord.Stride;
break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_D(EXT_fog_coord, pname);
+ *params = (GLdouble) ctx->Fog.FogCoordinateSource;
+ break;
/* GL_EXT_texture_lod_bias */
case GL_MAX_TEXTURE_LOD_BIAS_EXT:
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- CHECK_EXTENSION_B(NV_point_sprite, pname);
+ CHECK_EXTENSION2_D(NV_point_sprite, ARB_point_sprite, pname);
*params = (GLdouble) ctx->Point.PointSprite;
break;
case GL_POINT_SPRITE_R_MODE_NV:
- CHECK_EXTENSION_B(NV_point_sprite, pname);
+ CHECK_EXTENSION_D(NV_point_sprite, pname);
*params = (GLdouble) ctx->Point.SpriteRMode;
break;
break;
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_D(NV_vertex_program, pname);
- *params = (GLdouble) MAX_PROGRAM_STACK_DEPTH;
+ *params = (GLdouble) ctx->Const.MaxProgramMatrixStackDepth;
break;
case GL_MAX_TRACK_MATRICES_NV:
CHECK_EXTENSION_D(NV_vertex_program, pname);
- *params = (GLdouble) MAX_PROGRAM_MATRICES;
+ *params = (GLdouble) ctx->Const.MaxProgramMatrices;
break;
case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_D(NV_vertex_program, pname);
- *params = (GLdouble) ctx->CurrentStack->Depth;
+ *params = (GLdouble) ctx->CurrentStack->Depth + 1;
break;
case GL_CURRENT_MATRIX_NV:
CHECK_EXTENSION_D(NV_vertex_program, pname);
- *params = (GLdouble) ctx->Transform.MatrixMode;
+ for (i = 0; i < 16; i++)
+ params[i] = (GLdouble) ctx->CurrentStack->Top->m[i];
break;
case GL_VERTEX_PROGRAM_BINDING_NV:
CHECK_EXTENSION_D(NV_vertex_program, pname);
#endif /* FEATURE_NV_vertex_program */
#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_D(NV_fragment_program, pname);
+ *params = (GLdouble) ctx->FragmentProgram.Enabled;
+ break;
case GL_MAX_TEXTURE_COORDS_NV:
CHECK_EXTENSION_B(NV_fragment_program, pname);
*params = (GLdouble) ctx->Const.MaxTextureCoordUnits;
*params = (GLdouble) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = (GLdouble) ctx->Const.MaxShininess;
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = (GLdouble) ctx->Const.MaxSpotExponent;
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ArrayBufferObj->Name;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Vertex.BufferObj->Name;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Normal.BufferObj->Name;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Color.BufferObj->Name;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.Index.BufferObj->Name;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.EdgeFlag.BufferObj->Name;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.SecondaryColor.BufferObj->Name;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.FogCoord.BufferObj->Name;
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_D(ARB_vertex_buffer_object, pname);
+ *params = (GLdouble) ctx->Array.ElementArrayBufferObj->Name;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_D(ARB_fragment_program, pname);
+ *params = (GLdouble) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_D(ARB_fragment_program, pname);
+ params[0] = ctx->CurrentStack->Top->m[0];
+ params[1] = ctx->CurrentStack->Top->m[4];
+ params[2] = ctx->CurrentStack->Top->m[8];
+ params[3] = ctx->CurrentStack->Top->m[12];
+ params[4] = ctx->CurrentStack->Top->m[1];
+ params[5] = ctx->CurrentStack->Top->m[5];
+ params[6] = ctx->CurrentStack->Top->m[9];
+ params[7] = ctx->CurrentStack->Top->m[13];
+ params[8] = ctx->CurrentStack->Top->m[2];
+ params[9] = ctx->CurrentStack->Top->m[6];
+ params[10] = ctx->CurrentStack->Top->m[10];
+ params[11] = ctx->CurrentStack->Top->m[14];
+ params[12] = ctx->CurrentStack->Top->m[3];
+ params[13] = ctx->CurrentStack->Top->m[7];
+ params[14] = ctx->CurrentStack->Top->m[11];
+ params[15] = ctx->CurrentStack->Top->m[15];
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_D(EXT_depth_bounds_test, pname);
+ params[0] = (GLdouble) ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_D(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsMin;
+ params[1] = ctx->Depth.BoundsMax;
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->FragmentProgram.CurrentPosition;
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_D(MESA_program_debug, pname);
+ *params = (GLdouble) ctx->VertexProgram.CurrentPosition;
+ break;
+#endif
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev(pname=0x%x)", pname);
}
}
-void
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetFloatv().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetFloatv,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLfloat.
+ */
+void GLAPIENTRY
_mesa_GetFloatv( GLenum pname, GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
- /* We need this in order to get correct results for
- * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
- */
- FLUSH_VERTICES(ctx, 0);
-
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetFloatv %s\n", _mesa_lookup_enum_by_nr(pname));
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
if (ctx->Driver.GetFloatv && (*ctx->Driver.GetFloatv)(ctx, pname, params))
return;
case GL_BLEND_DST_ALPHA_EXT:
*params = ENUM_TO_FLOAT(ctx->Color.BlendDstA);
break;
- case GL_BLEND_EQUATION_EXT:
- *params = ENUM_TO_FLOAT(ctx->Color.BlendEquation);
+ case GL_BLEND_EQUATION:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendEquationRGB);
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = ENUM_TO_FLOAT(ctx->Color.BlendEquationA);
break;
case GL_BLEND_COLOR_EXT:
params[0] = ctx->Color.BlendColor[0];
params[0] = ctx->Current.RasterDistance;
break;
case GL_CURRENT_RASTER_INDEX:
- *params = (GLfloat) ctx->Current.RasterIndex;
+ *params = ctx->Current.RasterIndex;
break;
case GL_CURRENT_RASTER_POSITION:
params[0] = ctx->Current.RasterPos[0];
*params = (GLfloat) ctx->List.ListBase;
break;
case GL_LIST_INDEX:
- *params = (GLfloat) ctx->CurrentListNum;
+ *params = (GLfloat) ctx->ListState.CurrentListNum;
break;
case GL_LIST_MODE:
- *params = ctx->ExecuteFlag ? ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE)
- : ENUM_TO_FLOAT(GL_COMPILE);
+ if (!ctx->CompileFlag)
+ *params = 0.0F;
+ else if (ctx->ExecuteFlag)
+ *params = ENUM_TO_FLOAT(GL_COMPILE_AND_EXECUTE);
+ else
+ *params = ENUM_TO_FLOAT(GL_COMPILE);
break;
case GL_INDEX_LOGIC_OP:
*params = (GLfloat) ctx->Color.IndexLogicOpEnabled;
*params = 0.0;
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = (GLfloat) ctx->Array.TexCoord[texUnit].Enabled;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = (GLfloat) ctx->Array.TexCoord[texUnit].Size;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Size;
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ENUM_TO_FLOAT(ctx->Array.TexCoord[texUnit].Type);
+ *params = ENUM_TO_FLOAT(ctx->Array.TexCoord[clientUnit].Type);
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = (GLfloat) ctx->Array.TexCoord[texUnit].Stride;
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].Stride;
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = 0.0;
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_F(ARB_multitexture, pname);
- *params = (GLfloat) ctx->Const.MaxTextureUnits;
+ *params = (GLfloat) MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_F(ARB_multitexture, pname);
break;
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_F(ARB_multitexture, pname);
- *params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture);
+ *params = (GLfloat) (GL_TEXTURE0_ARB + clientUnit);
break;
/* GL_ARB_texture_cube_map */
/* GL_SGI_texture_color_table */
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXTENSION_F(SGI_texture_color_table, pname);
- *params = (GLfloat) ctx->Texture.ColorTableEnabled;
+ *params = (GLfloat) textureUnit->ColorTableEnabled;
break;
/* GL_EXT_secondary_color */
break;
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
CHECK_EXTENSION_F(EXT_secondary_color, pname);
- *params = (GLfloat) ctx->Array.SecondaryColor.Stride;
+ *params = (GLfloat) ctx->Array.SecondaryColor.Size;
break;
/* GL_EXT_fog_coord */
CHECK_EXTENSION_F(EXT_fog_coord, pname);
*params = (GLfloat) ctx->Array.FogCoord.Stride;
break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_F(EXT_fog_coord, pname);
+ *params = (GLfloat) ctx->Fog.FogCoordinateSource;
+ break;
/* GL_EXT_texture_lod_bias */
case GL_MAX_TEXTURE_LOD_BIAS_EXT:
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- CHECK_EXTENSION_F(NV_point_sprite, pname);
+ CHECK_EXTENSION2_F(NV_point_sprite, ARB_point_sprite, pname);
*params = (GLfloat) ctx->Point.PointSprite;
break;
case GL_POINT_SPRITE_R_MODE_NV:
break;
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_F(NV_vertex_program, pname);
- *params = (GLfloat) MAX_PROGRAM_STACK_DEPTH;
+ *params = (GLfloat) ctx->Const.MaxProgramMatrixStackDepth;
break;
case GL_MAX_TRACK_MATRICES_NV:
CHECK_EXTENSION_F(NV_vertex_program, pname);
- *params = (GLfloat) MAX_PROGRAM_MATRICES;
+ *params = (GLfloat) ctx->Const.MaxProgramMatrices;
break;
case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_F(NV_vertex_program, pname);
- *params = (GLfloat) ctx->CurrentStack->Depth;
+ *params = (GLfloat) ctx->CurrentStack->Depth + 1;
break;
case GL_CURRENT_MATRIX_NV:
CHECK_EXTENSION_F(NV_vertex_program, pname);
- *params = (GLfloat) ctx->Transform.MatrixMode;
+ for (i = 0; i < 16; i++)
+ params[i] = ctx->CurrentStack->Top->m[i];
break;
case GL_VERTEX_PROGRAM_BINDING_NV:
CHECK_EXTENSION_F(NV_vertex_program, pname);
#endif /* FEATURE_NV_vertex_program */
#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_F(NV_fragment_program, pname);
+ *params = (GLfloat) ctx->FragmentProgram.Enabled;
+ break;
case GL_MAX_TEXTURE_COORDS_NV:
CHECK_EXTENSION_F(NV_fragment_program, pname);
*params = (GLfloat) ctx->Const.MaxTextureCoordUnits;
*params = (GLfloat) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = ctx->Const.MaxShininess;
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = ctx->Const.MaxSpotExponent;
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ArrayBufferObj->Name;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Vertex.BufferObj->Name;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Normal.BufferObj->Name;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Color.BufferObj->Name;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.Index.BufferObj->Name;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.EdgeFlag.BufferObj->Name;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.SecondaryColor.BufferObj->Name;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.FogCoord.BufferObj->Name;
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_F(ARB_vertex_buffer_object, pname);
+ *params = (GLfloat) ctx->Array.ElementArrayBufferObj->Name;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_F(ARB_fragment_program, pname);
+ *params = (GLfloat) ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_F(ARB_fragment_program, pname);
+ params[0] = ctx->CurrentStack->Top->m[0];
+ params[1] = ctx->CurrentStack->Top->m[4];
+ params[2] = ctx->CurrentStack->Top->m[8];
+ params[3] = ctx->CurrentStack->Top->m[12];
+ params[4] = ctx->CurrentStack->Top->m[1];
+ params[5] = ctx->CurrentStack->Top->m[5];
+ params[6] = ctx->CurrentStack->Top->m[9];
+ params[7] = ctx->CurrentStack->Top->m[13];
+ params[8] = ctx->CurrentStack->Top->m[2];
+ params[9] = ctx->CurrentStack->Top->m[6];
+ params[10] = ctx->CurrentStack->Top->m[10];
+ params[11] = ctx->CurrentStack->Top->m[14];
+ params[12] = ctx->CurrentStack->Top->m[3];
+ params[13] = ctx->CurrentStack->Top->m[7];
+ params[14] = ctx->CurrentStack->Top->m[11];
+ params[15] = ctx->CurrentStack->Top->m[15];
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+ params[0] = (GLfloat) ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_F(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsMin;
+ params[1] = ctx->Depth.BoundsMax;
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->FragmentProgram.CurrentPosition;
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_F(MESA_program_debug, pname);
+ *params = (GLfloat) ctx->VertexProgram.CurrentPosition;
+ break;
+#endif
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv(0x%x)", pname);
}
}
-void
+/**
+ * Get the value(s) of a selected parameter.
+ *
+ * \param pname parameter to be returned.
+ * \param params will hold the value(s) of the speficifed parameter.
+ *
+ * \sa glGetIntegerv().
+ *
+ * Tries to get the specified parameter via dd_function_table::GetIntegerv,
+ * otherwise gets the specified parameter from the current context, converting
+ * it value into GLinteger.
+ */
+void GLAPIENTRY
_mesa_GetIntegerv( GLenum pname, GLint *params )
{
GET_CURRENT_CONTEXT(ctx);
GLuint i;
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
+ const GLuint texUnit = ctx->Texture.CurrentUnit;
const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit];
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
return;
- /* We need this in order to get correct results for
- * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
- */
- FLUSH_VERTICES(ctx, 0);
-
if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glGetIntegerv %s\n", _mesa_lookup_enum_by_nr(pname));
+ if (!ctx->_CurrentProgram) {
+ /* We need this in order to get correct results for
+ * GL_OCCLUSION_TEST_RESULT_HP. There might be other important cases.
+ */
+ FLUSH_VERTICES(ctx, 0);
+ }
+
if (ctx->Driver.GetIntegerv
&& (*ctx->Driver.GetIntegerv)(ctx, pname, params))
return;
case GL_BLEND_DST_ALPHA_EXT:
*params = (GLint) ctx->Color.BlendDstA;
break;
- case GL_BLEND_EQUATION_EXT:
- *params = (GLint) ctx->Color.BlendEquation;
+ case GL_BLEND_EQUATION:
+ *params = (GLint) ctx->Color.BlendEquationRGB;
+ break;
+ case GL_BLEND_EQUATION_ALPHA_EXT:
+ *params = (GLint) ctx->Color.BlendEquationA;
break;
case GL_BLEND_COLOR_EXT:
params[0] = FLOAT_TO_INT( ctx->Color.BlendColor[0] );
*params = (GLint) ctx->List.ListBase;
break;
case GL_LIST_INDEX:
- *params = (GLint) ctx->CurrentListNum;
+ *params = (GLint) ctx->ListState.CurrentListNum;
break;
case GL_LIST_MODE:
- *params = ctx->ExecuteFlag ? (GLint) GL_COMPILE_AND_EXECUTE
- : (GLint) GL_COMPILE;
+ if (!ctx->CompileFlag)
+ *params = 0;
+ else if (ctx->ExecuteFlag)
+ *params = (GLint) GL_COMPILE_AND_EXECUTE;
+ else
+ *params = (GLint) GL_COMPILE;
break;
case GL_INDEX_LOGIC_OP:
*params = (GLint) ctx->Color.IndexLogicOpEnabled;
*params = 0;
break;
case GL_TEXTURE_COORD_ARRAY:
- *params = (GLint) ctx->Array.TexCoord[texUnit].Enabled;
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].Enabled;
break;
case GL_TEXTURE_COORD_ARRAY_SIZE:
- *params = ctx->Array.TexCoord[texUnit].Size;
+ *params = ctx->Array.TexCoord[clientUnit].Size;
break;
case GL_TEXTURE_COORD_ARRAY_TYPE:
- *params = ctx->Array.TexCoord[texUnit].Type;
+ *params = ctx->Array.TexCoord[clientUnit].Type;
break;
case GL_TEXTURE_COORD_ARRAY_STRIDE:
- *params = ctx->Array.TexCoord[texUnit].Stride;
+ *params = ctx->Array.TexCoord[clientUnit].Stride;
break;
case GL_TEXTURE_COORD_ARRAY_COUNT_EXT:
*params = 0;
/* GL_ARB_multitexture */
case GL_MAX_TEXTURE_UNITS_ARB:
CHECK_EXTENSION_I(ARB_multitexture, pname);
- *params = ctx->Const.MaxTextureUnits;
+ *params = MIN2(ctx->Const.MaxTextureImageUnits,
+ ctx->Const.MaxTextureCoordUnits);
break;
case GL_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_I(ARB_multitexture, pname);
break;
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
CHECK_EXTENSION_I(ARB_multitexture, pname);
- *params = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture;
+ *params = GL_TEXTURE0_ARB + clientUnit;
break;
/* GL_ARB_texture_cube_map */
/* GL_SGI_texture_color_table */
case GL_TEXTURE_COLOR_TABLE_SGI:
CHECK_EXTENSION_I(SGI_texture_color_table, pname);
- *params = (GLint) ctx->Texture.ColorTableEnabled;
+ *params = (GLint) textureUnit->ColorTableEnabled;
break;
/* GL_EXT_secondary_color */
break;
case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT:
CHECK_EXTENSION_I(EXT_secondary_color, pname);
- *params = (GLint) ctx->Array.SecondaryColor.Stride;
+ *params = (GLint) ctx->Array.SecondaryColor.Size;
break;
/* GL_EXT_fog_coord */
CHECK_EXTENSION_I(EXT_fog_coord, pname);
*params = (GLint) ctx->Array.FogCoord.Stride;
break;
+ case GL_FOG_COORDINATE_SOURCE_EXT:
+ CHECK_EXTENSION_I(EXT_fog_coord, pname);
+ *params = (GLint) ctx->Fog.FogCoordinateSource;
+ break;
/* GL_EXT_texture_lod_bias */
case GL_MAX_TEXTURE_LOD_BIAS_EXT:
/* GL_NV_point_sprite */
case GL_POINT_SPRITE_NV:
- CHECK_EXTENSION_I(NV_point_sprite, pname);
+ CHECK_EXTENSION2_I(NV_point_sprite, ARB_point_sprite, pname);
*params = (GLint) ctx->Point.PointSprite;
break;
case GL_POINT_SPRITE_R_MODE_NV:
break;
case GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_I(NV_vertex_program, pname);
- *params = MAX_PROGRAM_STACK_DEPTH;
+ *params = ctx->Const.MaxProgramMatrixStackDepth;
break;
case GL_MAX_TRACK_MATRICES_NV:
CHECK_EXTENSION_I(NV_vertex_program, pname);
- *params = MAX_PROGRAM_MATRICES;
+ *params = ctx->Const.MaxProgramMatrices;
break;
case GL_CURRENT_MATRIX_STACK_DEPTH_NV:
CHECK_EXTENSION_I(NV_vertex_program, pname);
- *params = ctx->CurrentStack->Depth;
+ *params = ctx->CurrentStack->Depth + 1;
break;
case GL_CURRENT_MATRIX_NV:
CHECK_EXTENSION_I(NV_vertex_program, pname);
- *params = (GLint) ctx->Transform.MatrixMode;
+ for (i = 0; i < 16; i++)
+ params[i] = (GLint) ctx->CurrentStack->Top->m[i];
break;
case GL_VERTEX_PROGRAM_BINDING_NV:
CHECK_EXTENSION_I(NV_vertex_program, pname);
#endif /* FEATURE_NV_vertex_program */
#if FEATURE_NV_fragment_program
+ case GL_FRAGMENT_PROGRAM_NV:
+ CHECK_EXTENSION_I(NV_fragment_program, pname);
+ *params = (GLint) ctx->FragmentProgram.Enabled;
+ break;
case GL_MAX_TEXTURE_COORDS_NV:
CHECK_EXTENSION_I(NV_fragment_program, pname);
*params = (GLint) ctx->Const.MaxTextureCoordUnits;
*params = (GLint) (ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT);
break;
+ /* GL_NV_light_max_exponent */
+ case GL_MAX_SHININESS_NV:
+ *params = (GLint) ctx->Const.MaxShininess;
+ break;
+ case GL_MAX_SPOT_EXPONENT_NV:
+ *params = (GLint) ctx->Const.MaxSpotExponent;
+ break;
+
+#if FEATURE_ARB_vertex_buffer_object
+ case GL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ArrayBufferObj->Name;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Vertex.BufferObj->Name;
+ break;
+ case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Normal.BufferObj->Name;
+ break;
+ case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Color.BufferObj->Name;
+ break;
+ case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.Index.BufferObj->Name;
+ break;
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.TexCoord[clientUnit].BufferObj->Name;
+ break;
+ case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.EdgeFlag.BufferObj->Name;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.SecondaryColor.BufferObj->Name;
+ break;
+ case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.FogCoord.BufferObj->Name;
+ break;
+ /*case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB: - not supported */
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
+ CHECK_EXTENSION_I(ARB_vertex_buffer_object, pname);
+ *params = (GLint) ctx->Array.ElementArrayBufferObj->Name;
+ break;
+#endif
+
+#if FEATURE_ARB_fragment_program
+ case GL_FRAGMENT_PROGRAM_ARB:
+ CHECK_EXTENSION_I(ARB_fragment_program, pname);
+ *params = ctx->FragmentProgram.Enabled;
+ break;
+ case GL_TRANSPOSE_CURRENT_MATRIX_ARB:
+ CHECK_EXTENSION_I(ARB_fragment_program, pname);
+ params[0] = (GLint) ctx->CurrentStack->Top->m[0];
+ params[1] = (GLint) ctx->CurrentStack->Top->m[4];
+ params[2] = (GLint) ctx->CurrentStack->Top->m[8];
+ params[3] = (GLint) ctx->CurrentStack->Top->m[12];
+ params[4] = (GLint) ctx->CurrentStack->Top->m[1];
+ params[5] = (GLint) ctx->CurrentStack->Top->m[5];
+ params[6] = (GLint) ctx->CurrentStack->Top->m[9];
+ params[7] = (GLint) ctx->CurrentStack->Top->m[13];
+ params[8] = (GLint) ctx->CurrentStack->Top->m[2];
+ params[9] = (GLint) ctx->CurrentStack->Top->m[6];
+ params[10] = (GLint) ctx->CurrentStack->Top->m[10];
+ params[11] = (GLint) ctx->CurrentStack->Top->m[14];
+ params[12] = (GLint) ctx->CurrentStack->Top->m[3];
+ params[13] = (GLint) ctx->CurrentStack->Top->m[7];
+ params[14] = (GLint) ctx->CurrentStack->Top->m[11];
+ params[15] = (GLint) ctx->CurrentStack->Top->m[15];
+ break;
+ /* Remaining ARB_fragment_program queries alias with
+ * the GL_NV_fragment_program queries.
+ */
+#endif
+
+ /* GL_EXT_depth_bounds_test */
+ case GL_DEPTH_BOUNDS_TEST_EXT:
+ CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+ params[0] = ctx->Depth.BoundsTest;
+ break;
+ case GL_DEPTH_BOUNDS_EXT:
+ CHECK_EXTENSION_I(EXT_depth_bounds_test, pname);
+ params[0] = (GLint) ctx->Depth.BoundsMin;
+ params[1] = (GLint) ctx->Depth.BoundsMax;
+ break;
+
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->FragmentProgram.CallbackEnabled;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->VertexProgram.CallbackEnabled;
+ break;
+ case GL_FRAGMENT_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->FragmentProgram.CurrentPosition;
+ break;
+ case GL_VERTEX_PROGRAM_POSITION_MESA:
+ CHECK_EXTENSION_I(MESA_program_debug, pname);
+ *params = (GLint) ctx->VertexProgram.CurrentPosition;
+ break;
+#endif
+
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv(pname=0x%x)", pname);
}
}
-
-void
+/**
+ * Get the address of a selected pointer.
+ *
+ * \param pname array or buffer to be returned.
+ * \param params will hold the pointer speficifed by \p pname.
+ *
+ * \sa glGetPointerv().
+ *
+ * Tries to get the specified pointer via dd_function_table::GetPointerv,
+ * otherwise gets the specified pointer from the current context.
+ */
+void GLAPIENTRY
_mesa_GetPointerv( GLenum pname, GLvoid **params )
{
GET_CURRENT_CONTEXT(ctx);
- GLuint texUnit = ctx->Texture.CurrentUnit;
+ const GLuint clientUnit = ctx->Array.ActiveTexture;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (!params)
switch (pname) {
case GL_VERTEX_ARRAY_POINTER:
- *params = ctx->Array.Vertex.Ptr;
+ *params = (GLvoid *) ctx->Array.Vertex.Ptr;
break;
case GL_NORMAL_ARRAY_POINTER:
- *params = ctx->Array.Normal.Ptr;
+ *params = (GLvoid *) ctx->Array.Normal.Ptr;
break;
case GL_COLOR_ARRAY_POINTER:
- *params = ctx->Array.Color.Ptr;
+ *params = (GLvoid *) ctx->Array.Color.Ptr;
break;
case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT:
- *params = ctx->Array.SecondaryColor.Ptr;
+ *params = (GLvoid *) ctx->Array.SecondaryColor.Ptr;
break;
case GL_FOG_COORDINATE_ARRAY_POINTER_EXT:
- *params = ctx->Array.FogCoord.Ptr;
+ *params = (GLvoid *) ctx->Array.FogCoord.Ptr;
break;
case GL_INDEX_ARRAY_POINTER:
- *params = ctx->Array.Index.Ptr;
+ *params = (GLvoid *) ctx->Array.Index.Ptr;
break;
case GL_TEXTURE_COORD_ARRAY_POINTER:
- *params = ctx->Array.TexCoord[texUnit].Ptr;
+ *params = (GLvoid *) ctx->Array.TexCoord[clientUnit].Ptr;
break;
case GL_EDGE_FLAG_ARRAY_POINTER:
- *params = ctx->Array.EdgeFlag.Ptr;
+ *params = (GLvoid *) ctx->Array.EdgeFlag.Ptr;
break;
case GL_FEEDBACK_BUFFER_POINTER:
*params = ctx->Feedback.Buffer;
case GL_SELECTION_BUFFER_POINTER:
*params = ctx->Select.Buffer;
break;
+#if FEATURE_MESA_program_debug
+ case GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = (GLvoid *) ctx->FragmentProgram.Callback;
+ break;
+ case GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = ctx->FragmentProgram.CallbackData;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = (GLvoid *) ctx->VertexProgram.Callback;
+ break;
+ case GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA:
+ if (!ctx->Extensions.MESA_program_debug) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetPointerv");
+ return;
+ }
+ *params = ctx->VertexProgram.CallbackData;
+ break;
+#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPointerv" );
return;
}
-
-const GLubyte *
+/**
+ * Get a string describing the current GL connection.
+ *
+ * \param name name symbolic constant.
+ *
+ * \sa glGetString().
+ *
+ * Tries to get the string from dd_function_table::GetString, otherwise returns
+ * the hardcoded strings.
+ */
+const GLubyte * GLAPIENTRY
_mesa_GetString( GLenum name )
{
GET_CURRENT_CONTEXT(ctx);
static const char *vendor = "Brian Paul";
static const char *renderer = "Mesa";
- static const char *version_1_2 = "1.2 Mesa 5.1";
- static const char *version_1_3 = "1.3 Mesa 5.1";
- static const char *version_1_4 = "1.4 Mesa 5.1";
+ static const char *version_1_2 = "1.2 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_3 = "1.3 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
+ static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
ctx->Extensions.EXT_point_parameters && /*aka ARB*/
ctx->Extensions.EXT_secondary_color &&
ctx->Extensions.EXT_stencil_wrap &&
+ ctx->Extensions.EXT_texture_lod_bias &&
ctx->Extensions.SGIS_generate_mipmap) {
- return (const GLubyte *) version_1_4;
+ if (ctx->Extensions.ARB_occlusion_query &&
+ ctx->Extensions.ARB_vertex_buffer_object &&
+ ctx->Extensions.ARB_texture_non_power_of_two &&
+ ctx->Extensions.EXT_shadow_funcs) {
+ return (const GLubyte *) version_1_5;
+ }
+ else {
+ return (const GLubyte *) version_1_4;
+ }
}
else {
return (const GLubyte *) version_1_3;
return (const GLubyte *) version_1_2;
}
case GL_EXTENSIONS:
- return (const GLubyte *) _mesa_extensions_get_string(ctx);
+ if (!ctx->Extensions.String)
+ ctx->Extensions.String = _mesa_make_extension_string(ctx);
+ return (const GLubyte *) ctx->Extensions.String;
#if FEATURE_NV_fragment_program
case GL_PROGRAM_ERROR_STRING_NV:
if (ctx->Extensions.NV_fragment_program) {
}
-/*
- * Execute a glGetError command
+/**
+ * Execute a glGetError() command.
+ *
+ * \return error number.
+ *
+ * Returns __GLcontextRec::ErrorValue.
*/
-GLenum
+GLenum GLAPIENTRY
_mesa_GetError( void )
{
GET_CURRENT_CONTEXT(ctx);