aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-14 16:52:51 +0200
committermarha <marha@users.sourceforge.net>2012-05-14 16:52:51 +0200
commit1a71b50696cc230cd055905a5f9fdbd3fa7c89af (patch)
tree23d0afa2e1458a54c656116205e485900e8edd9d /mesalib/src/mesa/main
parent13a63d4f69c0692539448cb3d8e4a0e1ffdf2183 (diff)
downloadvcxsrv-1a71b50696cc230cd055905a5f9fdbd3fa7c89af.tar.gz
vcxsrv-1a71b50696cc230cd055905a5f9fdbd3fa7c89af.tar.bz2
vcxsrv-1a71b50696cc230cd055905a5f9fdbd3fa7c89af.zip
fontconfig libX11 mesa xkeyboard-config pixman git update 14 May 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/context.c6
-rw-r--r--mesalib/src/mesa/main/debug.c75
-rw-r--r--mesalib/src/mesa/main/drawpix.c12
-rw-r--r--mesalib/src/mesa/main/errors.c21
-rw-r--r--mesalib/src/mesa/main/fbobject.c20
-rw-r--r--mesalib/src/mesa/main/light.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h5
-rw-r--r--mesalib/src/mesa/main/teximage.h7
-rw-r--r--mesalib/src/mesa/main/texobj.c17
9 files changed, 103 insertions, 62 deletions
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 7e2ac98b9..bafd250a1 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -1635,6 +1635,7 @@ _mesa_record_error(struct gl_context *ctx, GLenum error)
void
_mesa_finish(struct gl_context *ctx)
{
+ FLUSH_VERTICES( ctx, 0 );
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Finish) {
ctx->Driver.Finish(ctx);
@@ -1648,6 +1649,7 @@ _mesa_finish(struct gl_context *ctx)
void
_mesa_flush(struct gl_context *ctx)
{
+ FLUSH_VERTICES( ctx, 0 );
FLUSH_CURRENT( ctx, 0 );
if (ctx->Driver.Flush) {
ctx->Driver.Flush(ctx);
@@ -1666,7 +1668,7 @@ void GLAPIENTRY
_mesa_Finish(void)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_finish(ctx);
}
@@ -1681,7 +1683,7 @@ void GLAPIENTRY
_mesa_Flush(void)
{
GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
_mesa_flush(ctx);
}
diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c
index f7b1f71f4..62b8e00c1 100644
--- a/mesalib/src/mesa/main/debug.c
+++ b/mesalib/src/mesa/main/debug.c
@@ -149,21 +149,19 @@ void _mesa_print_info( void )
/**
- * Set the debugging flags.
- *
- * \param debug debug string
- *
- * If compiled with debugging support then search for keywords in \p debug and
- * enables the verbose debug output of the respective feature.
+ * Set verbose logging flags. When these flags are set, GL API calls
+ * in the various categories will be printed to stderr.
+ * \param str a comma-separated list of keywords
*/
-static void add_debug_flags( const char *debug )
+static void
+set_verbose_flags(const char *str)
{
#ifdef DEBUG
- struct debug_option {
+ struct option {
const char *name;
GLbitfield flag;
};
- static const struct debug_option debug_opt[] = {
+ static const struct option opts[] = {
{ "varray", VERBOSE_VARRAY },
{ "tex", VERBOSE_TEXTURE },
{ "mat", VERBOSE_MATERIAL },
@@ -179,34 +177,59 @@ static void add_debug_flags( const char *debug )
};
GLuint i;
+ if (!str)
+ return;
+
MESA_VERBOSE = 0x0;
- for (i = 0; i < Elements(debug_opt); i++) {
- if (strstr(debug, debug_opt[i].name) || strcmp(debug, "all") == 0)
- MESA_VERBOSE |= debug_opt[i].flag;
+ for (i = 0; i < Elements(opts); i++) {
+ if (strstr(str, opts[i].name) || strcmp(str, "all") == 0)
+ MESA_VERBOSE |= opts[i].flag;
}
+#endif
+}
- /* Debug flag:
- */
- if (strstr(debug, "flush"))
- MESA_DEBUG_FLAGS |= DEBUG_ALWAYS_FLUSH;
-#else
- (void) debug;
+/**
+ * Set debugging flags. When these flags are set, Mesa will do additional
+ * debug checks or actions.
+ * \param str a comma-separated list of keywords
+ */
+static void
+set_debug_flags(const char *str)
+{
+#ifdef DEBUG
+ struct option {
+ const char *name;
+ GLbitfield flag;
+ };
+ static const struct option opts[] = {
+ { "silent", DEBUG_SILENT }, /* turn off debug messages */
+ { "flush", DEBUG_ALWAYS_FLUSH }, /* flush after each drawing command */
+ { "incomplete_tex", DEBUG_INCOMPLETE_TEXTURE },
+ { "incomplete_fbo", DEBUG_INCOMPLETE_FBO }
+ };
+ GLuint i;
+
+ if (!str)
+ return;
+
+ MESA_DEBUG_FLAGS = 0x0;
+ for (i = 0; i < Elements(opts); i++) {
+ if (strstr(str, opts[i].name))
+ MESA_DEBUG_FLAGS |= opts[i].flag;
+ }
#endif
}
+/**
+ * Initialize debugging variables from env vars.
+ */
void
_mesa_init_debug( struct gl_context *ctx )
{
- char *c;
- c = _mesa_getenv("MESA_DEBUG");
- if (c)
- add_debug_flags(c);
-
- c = _mesa_getenv("MESA_VERBOSE");
- if (c)
- add_debug_flags(c);
+ set_debug_flags(_mesa_getenv("MESA_DEBUG"));
+ set_verbose_flags(_mesa_getenv("MESA_VERBOSE"));
}
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c
index c2f7db2e8..def55dddd 100644
--- a/mesalib/src/mesa/main/drawpix.c
+++ b/mesalib/src/mesa/main/drawpix.c
@@ -180,6 +180,10 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
end:
_mesa_set_vp_override(ctx, GL_FALSE);
+
+ if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+ _mesa_flush(ctx);
+ }
}
@@ -280,6 +284,10 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
end:
_mesa_set_vp_override(ctx, GL_FALSE);
+
+ if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+ _mesa_flush(ctx);
+ }
}
@@ -354,6 +362,10 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
/* update raster position */
ctx->Current.RasterPos[0] += xmove;
ctx->Current.RasterPos[1] += ymove;
+
+ if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
+ _mesa_flush(ctx);
+ }
}
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index 4a187b7b0..69dbb65cf 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -802,21 +802,20 @@ output_if_debug(const char *prefixString, const char *outputString,
{
static int debug = -1;
- /* Check the MESA_DEBUG environment variable if it hasn't
- * been checked yet. We only have to check it once...
+ /* Init the local 'debug' var once.
+ * Note: the _mesa_init_debug() function should have been called
+ * by now so MESA_DEBUG_FLAGS will be initialized.
*/
if (debug == -1) {
- char *env = _mesa_getenv("MESA_DEBUG");
-
- /* In a debug build, we print warning messages *unless*
- * MESA_DEBUG is 0. In a non-debug build, we don't
- * print warning messages *unless* MESA_DEBUG is
- * set *to any value*.
- */
#ifdef DEBUG
- debug = (env != NULL && atoi(env) == 0) ? 0 : 1;
+ /* in debug builds, print messages unless MESA_DEBUG="silent" */
+ if (MESA_DEBUG_FLAGS & DEBUG_SILENT)
+ debug = 0;
+ else
+ debug = 1;
#else
- debug = (env != NULL) ? 1 : 0;
+ /* in release builds, be silent unless MESA_DEBUG is set */
+ debug = _mesa_getenv("MESA_DEBUG") != NULL;
#endif
}
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index f56369483..777783eb7 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -49,9 +49,6 @@
#include "texobj.h"
-/** Set this to 1 to help debug FBO incompleteness problems */
-#define DEBUG_FBO 0
-
/** Set this to 1 to debug/log glBlitFramebuffer() calls */
#define DEBUG_BLIT 0
@@ -462,11 +459,9 @@ _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
static void
att_incomplete(const char *msg)
{
-#if DEBUG_FBO
- _mesa_debug(NULL, "attachment incomplete: %s\n", msg);
-#else
- (void) msg;
-#endif
+ if (MESA_DEBUG_FLAGS & DEBUG_INCOMPLETE_FBO) {
+ _mesa_debug(NULL, "attachment incomplete: %s\n", msg);
+ }
}
@@ -476,12 +471,9 @@ att_incomplete(const char *msg)
static void
fbo_incomplete(const char *msg, int index)
{
-#if DEBUG_FBO
- _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
-#else
- (void) msg;
- (void) index;
-#endif
+ if (MESA_DEBUG_FLAGS & DEBUG_INCOMPLETE_FBO) {
+ _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
+ }
}
diff --git a/mesalib/src/mesa/main/light.c b/mesalib/src/mesa/main/light.c
index 7bc22e2fa..38ec1b6e8 100644
--- a/mesalib/src/mesa/main/light.c
+++ b/mesalib/src/mesa/main/light.c
@@ -728,6 +728,8 @@ _mesa_ColorMaterial( GLenum face, GLenum mode )
_mesa_lookup_enum_by_nr(mode));
bitmask = _mesa_material_bitmask(ctx, face, mode, legal, "glColorMaterial");
+ if (bitmask == 0)
+ return; /* error was recorded */
if (ctx->Light.ColorMaterialBitmask == bitmask &&
ctx->Light.ColorMaterialFace == face &&
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 06ca0d5df..c306ac6b9 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -3522,7 +3522,10 @@ enum _verbose
/** The MESA_DEBUG_FLAGS var is a bitmask of these flags */
enum _debug
{
- DEBUG_ALWAYS_FLUSH = 0x1
+ DEBUG_SILENT = (1 << 0),
+ DEBUG_ALWAYS_FLUSH = (1 << 1),
+ DEBUG_INCOMPLETE_TEXTURE = (1 << 2),
+ DEBUG_INCOMPLETE_FBO = (1 << 3)
};
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h
index e2bdaca01..66a0c8895 100644
--- a/mesalib/src/mesa/main/teximage.h
+++ b/mesalib/src/mesa/main/teximage.h
@@ -35,6 +35,9 @@
#include "mtypes.h"
#include "formats.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/** Is the given value one of the 6 cube faces? */
static inline GLboolean
@@ -287,4 +290,8 @@ _mesa_TexBuffer(GLenum target, GLenum internalFormat, GLuint buffer);
/*@}*/
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 155b255a7..365169ddd 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -410,16 +410,17 @@ static void
incomplete(struct gl_texture_object *t, enum base_mipmap bm,
const char *fmt, ...)
{
-#if 0
- va_list args;
- char s[100];
+ if (MESA_DEBUG_FLAGS & DEBUG_INCOMPLETE_TEXTURE) {
+ va_list args;
+ char s[100];
- va_start(args, fmt);
- vsnprintf(s, sizeof(s), fmt, args);
- va_end(args);
+ va_start(args, fmt);
+ vsnprintf(s, sizeof(s), fmt, args);
+ va_end(args);
+
+ _mesa_debug(NULL, "Texture Obj %d incomplete because: %s\n", t->Name, s);
+ }
- printf("Texture Obj %d incomplete because: %s\n", t->Name, s);
-#endif
if (bm == BASE)
t->_BaseComplete = GL_FALSE;
t->_MipmapComplete = GL_FALSE;