aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-15 15:07:22 +0200
committermarha <marha@users.sourceforge.net>2012-05-15 15:07:22 +0200
commit9818207986d5db9831e43eb2a640be68f54bb2ef (patch)
treee1ac6d17b2da887a2110c1337f01fc6fbdfa68fd /mesalib/src/mesa/main
parente6ff1fe09702cb307729b3208175c84f623f2968 (diff)
parent062c45ff0df6a52080dcd74433710d47127cbe29 (diff)
downloadvcxsrv-9818207986d5db9831e43eb2a640be68f54bb2ef.tar.gz
vcxsrv-9818207986d5db9831e43eb2a640be68f54bb2ef.tar.bz2
vcxsrv-9818207986d5db9831e43eb2a640be68f54bb2ef.zip
Merge remote-tracking branch 'origin/released'
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
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp10
-rw-r--r--mesalib/src/mesa/main/version.c12
11 files changed, 123 insertions, 64 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;
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index da41ee84c..08d330a52 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -782,6 +782,16 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
return;
}
+ /* GL_INVALID_VALUE is generated if `transpose' is not GL_FALSE.
+ * http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml */
+ if (ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2) {
+ if (transpose) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glUniformMatrix(matrix transpose is not GL_FALSE)");
+ return;
+ }
+ }
+
if (ctx->Shader.Flags & GLSL_UNIFORMS) {
log_uniform(values, GLSL_TYPE_FLOAT, components, vectors, count,
bool(transpose), shProg, location, uni);
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 09a930cf2..d2e34ca1e 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -259,7 +259,11 @@ compute_version_es1(struct gl_context *ctx)
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
- "OpenGL ES-CM 1.%d Mesa " MESA_VERSION_STRING,
+ "OpenGL ES-CM 1.%d Mesa " MESA_VERSION_STRING
+#ifdef MESA_GIT_SHA1
+ " (" MESA_GIT_SHA1 ")"
+#endif
+ ,
ctx->VersionMinor);
}
}
@@ -289,7 +293,11 @@ compute_version_es2(struct gl_context *ctx)
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
- "OpenGL ES 2.0 Mesa " MESA_VERSION_STRING);
+ "OpenGL ES 2.0 Mesa " MESA_VERSION_STRING
+#ifdef MESA_GIT_SHA1
+ " (" MESA_GIT_SHA1 ")"
+#endif
+ );
}
}