summaryrefslogtreecommitdiff
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-02-28 10:58:57 -0700
committerBrian Paul <brianp@vmware.com>2009-02-28 11:17:26 -0700
commit4c4268dd31ce119d5d3db090adf0935bf3c27831 (patch)
tree987961a45ecf031d9affe28421de92c95f832800 /src/mesa/main/context.c
parentfe353787698153216e5fc68c63ad0a48e71d49bf (diff)
mesa: convert some #defines to enums
This makes debugging with gdb a bit easier. Ex: (gdb) p ctx->DrawBuffer.Attachment[BUFFER_STENCIL] Note however that gdb only seems to recognize enum types that are actually used to declare a variable somewhere. For example, gl_buffer_index isn't used to declare any vars so it's invisible to gdb. Work around this by adding a dummy function in context.c that declares some vars with these new types.
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index fb43054cdd..97ee925c0b 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -351,6 +351,36 @@ _mesa_destroy_visual( GLvisual *vis )
/**********************************************************************/
/*@{*/
+
+/**
+ * This is lame. gdb only seems to recognize enum types that are
+ * actually used somewhere. We want to be able to print/use enum
+ * values such as TEXTURE_2D_INDEX in gdb. But we don't actually use
+ * the gl_texture_index type anywhere. Thus, this lame function.
+ */
+static void
+dummy_enum_func(void)
+{
+ gl_buffer_index bi;
+ gl_colortable_index ci;
+ gl_face_index fi;
+ gl_frag_attrib fa;
+ gl_frag_result fr;
+ gl_texture_index ti;
+ gl_vert_attrib va;
+ gl_vert_result vr;
+
+ (void) bi;
+ (void) ci;
+ (void) fi;
+ (void) fa;
+ (void) fr;
+ (void) ti;
+ (void) va;
+ (void) vr;
+}
+
+
/**
* One-time initialization mutex lock.
*
@@ -406,6 +436,8 @@ one_time_init( GLcontext *ctx )
alreadyCalled = GL_TRUE;
}
_glthread_UNLOCK_MUTEX(OneTimeLock);
+
+ dummy_enum_func();
}