aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-03 13:38:22 +0200
committermarha <marha@users.sourceforge.net>2012-05-03 13:38:22 +0200
commit62068b3bc534d504e40df34847b4436f1a496f35 (patch)
tree7f67aa0910acff5830585e699be4098088244a85 /mesalib
parente67b35e7a899da5805fcce3d390cb10ebcaffe91 (diff)
downloadvcxsrv-62068b3bc534d504e40df34847b4436f1a496f35.tar.gz
vcxsrv-62068b3bc534d504e40df34847b4436f1a496f35.tar.bz2
vcxsrv-62068b3bc534d504e40df34847b4436f1a496f35.zip
xserver mesa git update 3 May 2012
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_format.h13
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp51
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h3
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.cpp6
-rw-r--r--mesalib/src/glsl/standalone_scaffolding.h4
-rw-r--r--mesalib/src/mesa/main/errors.c43
-rw-r--r--mesalib/src/mesa/main/errors.h3
7 files changed, 107 insertions, 16 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_format.h b/mesalib/src/gallium/auxiliary/util/u_format.h
index bd4e51d27..1718fb5e2 100644
--- a/mesalib/src/gallium/auxiliary/util/u_format.h
+++ b/mesalib/src/gallium/auxiliary/util/u_format.h
@@ -549,6 +549,19 @@ util_format_colormask(const struct util_format_description *desc)
}
+/**
+ * Checks if color mask covers every channel for the specified format
+ *
+ * @param desc a format description to check colormask with
+ * @param colormask a bit mask for channels, matches format of PIPE_MASK_RGBA
+ */
+static INLINE boolean
+util_format_colormask_full(const struct util_format_description *desc, unsigned colormask)
+{
+ return (~colormask & util_format_colormask(desc)) == 0;
+}
+
+
boolean
util_format_is_float(enum pipe_format format);
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index ae7a365f4..6f1c86b43 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -36,8 +36,9 @@ extern "C" {
#include "ir_optimization.h"
#include "loop_analysis.h"
-_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
+_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx,
GLenum target, void *mem_ctx)
+ : ctx(_ctx)
{
switch (target) {
case GL_VERTEX_SHADER: this->target = vertex_shader; break;
@@ -134,24 +135,49 @@ _mesa_glsl_shader_target_name(enum _mesa_glsl_parser_targets target)
return "unknown";
}
+/* This helper function will append the given message to the shader's
+ info log and report it via GL_ARB_debug_output. Per that extension,
+ 'type' is one of the enum values classifying the message, and
+ 'id' is the implementation-defined ID of the given message. */
+static void
+_mesa_glsl_msg(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
+ GLenum type, GLuint id, const char *fmt, va_list ap)
+{
+ bool error = (type == GL_DEBUG_TYPE_ERROR_ARB);
+
+ assert(state->info_log != NULL);
+
+ /* Get the offset that the new message will be written to. */
+ int msg_offset = strlen(state->info_log);
+
+ ralloc_asprintf_append(&state->info_log, "%u:%u(%u): %s: ",
+ locp->source,
+ locp->first_line,
+ locp->first_column,
+ error ? "error" : "warning");
+ ralloc_vasprintf_append(&state->info_log, fmt, ap);
+
+ const char *const msg = &state->info_log[msg_offset];
+ struct gl_context *ctx = state->ctx;
+ /* Report the error via GL_ARB_debug_output. */
+ if (error)
+ _mesa_shader_debug(ctx, type, id, msg, strlen(msg));
+
+ ralloc_strcat(&state->info_log, "\n");
+}
void
_mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
const char *fmt, ...)
{
va_list ap;
+ GLenum type = GL_DEBUG_TYPE_ERROR_ARB;
state->error = true;
- assert(state->info_log != NULL);
- ralloc_asprintf_append(&state->info_log, "%u:%u(%u): error: ",
- locp->source,
- locp->first_line,
- locp->first_column);
va_start(ap, fmt);
- ralloc_vasprintf_append(&state->info_log, fmt, ap);
+ _mesa_glsl_msg(locp, state, type, SHADER_ERROR_UNKNOWN, fmt, ap);
va_end(ap);
- ralloc_strcat(&state->info_log, "\n");
}
@@ -160,16 +186,11 @@ _mesa_glsl_warning(const YYLTYPE *locp, _mesa_glsl_parse_state *state,
const char *fmt, ...)
{
va_list ap;
+ GLenum type = GL_DEBUG_TYPE_OTHER_ARB;
- assert(state->info_log != NULL);
- ralloc_asprintf_append(&state->info_log, "%u:%u(%u): warning: ",
- locp->source,
- locp->first_line,
- locp->first_column);
va_start(ap, fmt);
- ralloc_vasprintf_append(&state->info_log, fmt, ap);
+ _mesa_glsl_msg(locp, state, type, 0, fmt, ap);
va_end(ap);
- ralloc_strcat(&state->info_log, "\n");
}
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index 55676f5a9..1a909c68b 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -57,7 +57,7 @@ struct glsl_switch_state {
};
struct _mesa_glsl_parse_state {
- _mesa_glsl_parse_state(struct gl_context *ctx, GLenum target,
+ _mesa_glsl_parse_state(struct gl_context *_ctx, GLenum target,
void *mem_ctx);
/* Callers of this ralloc-based new need not call delete. It's
@@ -77,6 +77,7 @@ struct _mesa_glsl_parse_state {
ralloc_free(mem);
}
+ struct gl_context *const ctx;
void *scanner;
exec_list translation_unit;
glsl_symbol_table *symbols;
diff --git a/mesalib/src/glsl/standalone_scaffolding.cpp b/mesalib/src/glsl/standalone_scaffolding.cpp
index 24cc64ad9..f15f2d882 100644
--- a/mesalib/src/glsl/standalone_scaffolding.cpp
+++ b/mesalib/src/glsl/standalone_scaffolding.cpp
@@ -41,6 +41,12 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
*ptr = sh;
}
+void
+_mesa_shader_debug(struct gl_context *, GLenum, GLuint,
+ const char *, int)
+{
+}
+
struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
{
diff --git a/mesalib/src/glsl/standalone_scaffolding.h b/mesalib/src/glsl/standalone_scaffolding.h
index 877332006..41ce35bef 100644
--- a/mesalib/src/glsl/standalone_scaffolding.h
+++ b/mesalib/src/glsl/standalone_scaffolding.h
@@ -40,6 +40,10 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
extern "C" struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
+extern "C" void
+_mesa_shader_debug(struct gl_context *ctx, GLenum type, GLuint id,
+ const char *msg, int len);
+
/**
* Initialize the given gl_context structure to a reasonable set of
* defaults representing the minimum capabilities required by the
diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c
index fcf873f18..4a187b7b0 100644
--- a/mesalib/src/mesa/main/errors.c
+++ b/mesalib/src/mesa/main/errors.c
@@ -1062,4 +1062,47 @@ _mesa_debug( const struct gl_context *ctx, const char *fmtString, ... )
(void) fmtString;
}
+
+/**
+ * Report debug information from the shader compiler via GL_ARB_debug_output.
+ *
+ * \param ctx GL context.
+ * \param type The namespace to which this message belongs.
+ * \param id The message ID within the given namespace.
+ * \param msg The message to output. Need not be null-terminated.
+ * \param len The length of 'msg'. If negative, 'msg' must be null-terminated.
+ */
+void
+_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id,
+ const char *msg, int len )
+{
+ GLenum source = GL_DEBUG_SOURCE_SHADER_COMPILER_ARB,
+ severity;
+
+ switch (type) {
+ case GL_DEBUG_TYPE_ERROR_ARB:
+ assert(id < SHADER_ERROR_COUNT);
+ severity = GL_DEBUG_SEVERITY_HIGH_ARB;
+ break;
+ case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB:
+ case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:
+ case GL_DEBUG_TYPE_PORTABILITY_ARB:
+ case GL_DEBUG_TYPE_PERFORMANCE_ARB:
+ case GL_DEBUG_TYPE_OTHER_ARB:
+ assert(0 && "other categories not implemented yet");
+ default:
+ _mesa_problem(ctx, "bad enum in _mesa_shader_debug()");
+ return;
+ }
+
+ if (len < 0)
+ len = strlen(msg);
+
+ /* Truncate the message if necessary. */
+ if (len >= MAX_DEBUG_MESSAGE_LENGTH)
+ len = MAX_DEBUG_MESSAGE_LENGTH - 1;
+
+ _mesa_log_msg(ctx, source, type, id, severity, len, msg);
+}
+
/*@}*/
diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h
index ed1c6fc7f..b4490fac9 100644
--- a/mesalib/src/mesa/main/errors.h
+++ b/mesalib/src/mesa/main/errors.h
@@ -68,6 +68,9 @@ _mesa_error( struct gl_context *ctx, GLenum error, const char *fmtString, ... )
extern void
_mesa_debug( const struct gl_context *ctx, const char *fmtString, ... ) PRINTFLIKE(2, 3);
+extern void
+_mesa_shader_debug( struct gl_context *ctx, GLenum type, GLuint id, const char *msg, int len );
+
#ifdef __cplusplus
}
#endif