summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/get.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/get.c')
-rw-r--r--src/mesa/main/get.c61
1 files changed, 44 insertions, 17 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index cb456fb64d8..da9df27bdb6 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -36,17 +36,17 @@
/* This is a table driven implemetation of the glGet*v() functions.
* The basic idea is that most getters just look up an int somewhere
- * in GLcontext and then convert it to a bool or float according to
+ * in struct gl_context and then convert it to a bool or float according to
* which of glGetIntegerv() glGetBooleanv() etc is being called.
* Instead of generating code to do this, we can just record the enum
- * value and the offset into GLcontext in an array of structs. Then
+ * value and the offset into struct gl_context in an array of structs. Then
* in glGet*(), we lookup the struct for the enum in question, and use
* the offset to get the int we need.
*
* Sometimes we need to look up a float, a boolean, a bit in a
* bitfield, a matrix or other types instead, so we need to track the
- * type of the value in GLcontext. And sometimes the value isn't in
- * GLcontext but in the drawbuffer, the array object, current texture
+ * type of the value in struct gl_context. And sometimes the value isn't in
+ * struct gl_context but in the drawbuffer, the array object, current texture
* unit, or maybe it's a computed value. So we need to also track
* where or how to find the value. Finally, we sometimes need to
* check that one of a number of extensions are enabled, the GL
@@ -165,7 +165,7 @@ union value {
#define BUFFER_FIELD(field, type) \
LOC_BUFFER, type, offsetof(struct gl_framebuffer, field)
#define CONTEXT_FIELD(field, type) \
- LOC_CONTEXT, type, offsetof(GLcontext, field)
+ LOC_CONTEXT, type, offsetof(struct gl_context, field)
#define ARRAY_FIELD(field, type) \
LOC_ARRAY, type, offsetof(struct gl_array_object, field)
#define CONST(value) \
@@ -173,6 +173,7 @@ union value {
#define BUFFER_INT(field) BUFFER_FIELD(field, TYPE_INT)
#define BUFFER_ENUM(field) BUFFER_FIELD(field, TYPE_ENUM)
+#define BUFFER_BOOL(field) BUFFER_FIELD(field, TYPE_BOOLEAN)
#define CONTEXT_INT(field) CONTEXT_FIELD(field, TYPE_INT)
#define CONTEXT_INT2(field) CONTEXT_FIELD(field, TYPE_INT_2)
@@ -260,6 +261,12 @@ static const int extra_EXT_fog_coord_flush_current[] = {
EXTRA_END
};
+static const int extra_EXT_texture_integer[] = {
+ EXT(EXT_texture_integer),
+ EXTRA_END
+};
+
+
EXTRA_EXT(ARB_multitexture);
EXTRA_EXT(ARB_texture_cube_map);
EXTRA_EXT(MESA_texture_array);
@@ -320,6 +327,12 @@ extra_NV_vertex_program_ARB_vertex_program_ARB_fragment_program_NV_vertex_progra
EXTRA_END
};
+static const int
+extra_NV_primitive_restart[] = {
+ EXT(NV_primitive_restart),
+ EXTRA_END
+};
+
static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
@@ -371,7 +384,7 @@ static const struct value_desc values[] = {
{ GL_MAX_ELEMENTS_VERTICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA },
{ GL_MAX_ELEMENTS_INDICES, CONTEXT_INT(Const.MaxArrayLockSize), NO_EXTRA },
{ GL_MAX_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.MaxTextureLevels), NO_EXTRA },
+ offsetof(struct gl_context, Const.MaxTextureLevels), NO_EXTRA },
{ GL_MAX_VIEWPORT_DIMS, CONTEXT_INT2(Const.MaxViewportWidth), NO_EXTRA },
{ GL_PACK_ALIGNMENT, CONTEXT_INT(Pack.Alignment), NO_EXTRA },
{ GL_ALIASED_POINT_SIZE_RANGE, CONTEXT_FLOAT2(Const.MinPointSize), NO_EXTRA },
@@ -410,7 +423,7 @@ static const struct value_desc values[] = {
{ GL_TEXTURE_BINDING_CUBE_MAP_ARB, LOC_CUSTOM, TYPE_INT,
TEXTURE_CUBE_INDEX, extra_ARB_texture_cube_map },
{ GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.MaxCubeTextureLevels),
+ offsetof(struct gl_context, Const.MaxCubeTextureLevels),
extra_ARB_texture_cube_map }, /* XXX: OES_texture_cube_map */
/* XXX: OES_blend_subtract */
@@ -522,7 +535,7 @@ static const struct value_desc values[] = {
{ GL_MAX_TEXTURE_STACK_DEPTH, CONST(MAX_TEXTURE_STACK_DEPTH), NO_EXTRA },
{ GL_MODELVIEW_MATRIX, CONTEXT_MATRIX(ModelviewMatrixStack.Top), NO_EXTRA },
{ GL_MODELVIEW_STACK_DEPTH, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, ModelviewMatrixStack.Depth), NO_EXTRA },
+ offsetof(struct gl_context, ModelviewMatrixStack.Depth), NO_EXTRA },
{ GL_NORMALIZE, CONTEXT_BOOL(Transform.Normalize), NO_EXTRA },
{ GL_PACK_SKIP_IMAGES_EXT, CONTEXT_INT(Pack.SkipImages), NO_EXTRA },
{ GL_PERSPECTIVE_CORRECTION_HINT, CONTEXT_ENUM(Hint.PerspectiveCorrection), NO_EXTRA },
@@ -535,7 +548,7 @@ static const struct value_desc values[] = {
{ GL_POINT_FADE_THRESHOLD_SIZE_EXT, CONTEXT_FLOAT(Point.Threshold), NO_EXTRA },
{ GL_PROJECTION_MATRIX, CONTEXT_MATRIX(ProjectionMatrixStack.Top), NO_EXTRA },
{ GL_PROJECTION_STACK_DEPTH, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, ProjectionMatrixStack.Depth), NO_EXTRA },
+ offsetof(struct gl_context, ProjectionMatrixStack.Depth), NO_EXTRA },
{ GL_RESCALE_NORMAL, CONTEXT_BOOL(Transform.RescaleNormals), NO_EXTRA },
{ GL_SHADE_MODEL, CONTEXT_ENUM(Light.ShadeModel), NO_EXTRA },
{ GL_TEXTURE_2D, LOC_CUSTOM, TYPE_BOOLEAN, 0, NO_EXTRA },
@@ -672,7 +685,7 @@ static const struct value_desc values[] = {
/* OES_texture_3D */
{ GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA },
{ GL_MAX_3D_TEXTURE_SIZE, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.Max3DTextureLevels), NO_EXTRA },
+ offsetof(struct gl_context, Const.Max3DTextureLevels), NO_EXTRA },
/* GL_ARB_fragment_program/OES_standard_derivatives */
{ GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB,
@@ -683,11 +696,11 @@ static const struct value_desc values[] = {
/* Enums unique to OpenGL ES 2.0 */
{ 0, 0, TYPE_API_MASK, API_OPENGLES2_BIT, NO_EXTRA },
{ GL_MAX_FRAGMENT_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA },
+ offsetof(struct gl_context, Const.FragmentProgram.MaxUniformComponents), NO_EXTRA },
{ GL_MAX_VARYING_VECTORS, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.MaxVarying), NO_EXTRA },
+ offsetof(struct gl_context, Const.MaxVarying), NO_EXTRA },
{ GL_MAX_VERTEX_UNIFORM_VECTORS, LOC_CUSTOM, TYPE_INT,
- offsetof(GLcontext, Const.VertexProgram.MaxUniformComponents), NO_EXTRA },
+ offsetof(struct gl_context, Const.VertexProgram.MaxUniformComponents), NO_EXTRA },
{ GL_SHADER_COMPILER, CONST(1), NO_EXTRA },
/* OES_get_program_binary */
{ GL_NUM_SHADER_BINARY_FORMATS, CONST(0), NO_EXTRA },
@@ -1019,6 +1032,12 @@ static const struct value_desc values[] = {
{ GL_MAX_SPOT_EXPONENT_NV, CONTEXT_FLOAT(Const.MaxSpotExponent),
extra_NV_light_max_exponent },
+ /* GL_NV_primitive_restart */
+ { GL_PRIMITIVE_RESTART_NV, CONTEXT_BOOL(Array.PrimitiveRestart),
+ extra_NV_primitive_restart },
+ { GL_PRIMITIVE_RESTART_INDEX_NV, CONTEXT_INT(Array.RestartIndex),
+ extra_NV_primitive_restart },
+
/* GL_ARB_vertex_buffer_object */
{ GL_INDEX_ARRAY_BUFFER_BINDING_ARB, LOC_CUSTOM, TYPE_INT,
offsetof(struct gl_array_object, Index.BufferObj), NO_EXTRA },
@@ -1132,6 +1151,10 @@ static const struct value_desc values[] = {
{ GL_MAX_SERVER_WAIT_TIMEOUT,
CONTEXT_INT64(Const.MaxServerWaitTimeout), extra_ARB_sync },
+ /* GL_EXT_texture_integer */
+ { GL_RGBA_INTEGER_MODE_EXT, BUFFER_BOOL(_IntegerColor),
+ extra_EXT_texture_integer },
+
/* GL_EXT_transform_feedback */
{ GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, LOC_CUSTOM, TYPE_INT, 0,
extra_EXT_transform_feedback },
@@ -1182,11 +1205,15 @@ static const struct value_desc values[] = {
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
/* GL 3.1 */
+ /* NOTE: different enum values for GL_PRIMITIVE_RESTART_NV
+ * vs. GL_PRIMITIVE_RESTART!
+ */
{ GL_PRIMITIVE_RESTART, CONTEXT_BOOL(Array.PrimitiveRestart),
extra_version_31 },
{ GL_PRIMITIVE_RESTART_INDEX, CONTEXT_INT(Array.RestartIndex),
extra_version_31 },
+
/* GL 3.2 */
{ GL_CONTEXT_PROFILE_MASK, CONTEXT_INT(Const.ProfileMask),
extra_version_32 },
@@ -1256,7 +1283,7 @@ print_table_stats(void)
*
* \param the current context, for determining the API in question
*/
-void _mesa_init_get_hash(GLcontext *ctx)
+void _mesa_init_get_hash(struct gl_context *ctx)
{
int i, hash, index, mask;
int api_mask = 0, api_bit;
@@ -1305,7 +1332,7 @@ void _mesa_init_get_hash(GLcontext *ctx)
* \param v pointer to the tmp declared in the calling glGet*v() function
*/
static void
-find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v)
+find_custom_value(struct gl_context *ctx, const struct value_desc *d, union value *v)
{
struct gl_buffer_object *buffer_obj;
struct gl_client_array *array;
@@ -1552,7 +1579,7 @@ find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v)
break;
case GL_CURRENT_PROGRAM:
v->value_int =
- ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0;
+ ctx->Shader.ActiveProgram ? ctx->Shader.ActiveProgram->Name : 0;
break;
case GL_READ_FRAMEBUFFER_BINDING_EXT:
v->value_int = ctx->ReadBuffer->Name;
@@ -1583,7 +1610,7 @@ find_custom_value(GLcontext *ctx, const struct value_desc *d, union value *v)
* otherwise GL_TRUE.
*/
static GLboolean
-check_extra(GLcontext *ctx, const char *func, const struct value_desc *d)
+check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d)
{
const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
int total, enabled;