Mesa (master): nv30: report 8 maximum inputs

2014-02-08 Thread Ilia Mirkin
Module: Mesa
Branch: master
Commit: 356aff3a5c08be055d6befff99a72f5551b3ac2d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=356aff3a5c08be055d6befff99a72f5551b3ac2d

Author: Ilia Mirkin 
Date:   Wed Jan 29 12:36:13 2014 -0500

nv30: report 8 maximum inputs

nvfx_fragprog_assign_generic only allows for up to 10/8 texcoords for
nv40/nv30. This fixes compilation of the varying-packing tests.
Furthermore it appears that the last 2 inputs on nv4x don't seem to
work in those tests, so just report 8 everywhere for now.

Tested on NV42, NV44. NV4B appears to have additional problems.

Signed-off-by: Ilia Mirkin 
Cc: 9.1 9.2 10.0 10.1 

---

 src/gallium/drivers/nouveau/nv30/nv30_screen.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 787802d..4045fdc 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -217,7 +217,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, 
unsigned shader,
   case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
  return 0;
   case PIPE_SHADER_CAP_MAX_INPUTS:
- return (eng3d->oclass >= NV40_3D_CLASS) ? 12 : 10;
+ return 8; /* should be possible to do 10 with nv4x */
   case PIPE_SHADER_CAP_MAX_CONSTS:
  return (eng3d->oclass >= NV40_3D_CLASS) ? 224 : 32;
   case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nv50/ir/ra: some register spilling fixes

2014-02-08 Thread Christoph Bumiller
Module: Mesa
Branch: master
Commit: 2e9ee44797fcce10e2f11ecb8520655f1e30280a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e9ee44797fcce10e2f11ecb8520655f1e30280a

Author: Christoph Bumiller 
Date:   Sat Feb  8 19:32:54 2014 +0100

nv50/ir/ra: some register spilling fixes

Cc: 10.1 

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp |   39 +---
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp 
b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index bbf9838..dd3beb7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -284,6 +284,7 @@ public:
bool run(const std::list&);
 
Symbol *assignSlot(const Interval&, const unsigned int size);
+   Symbol *offsetSlot(Symbol *, const LValue *);
inline int32_t getStackSize() const { return stackSize; }
 
 private:
@@ -774,6 +775,7 @@ GCRA::RIG_Node::init(const RegisterSet& regs, LValue *lval)
weight = std::numeric_limits::infinity();
degree = 0;
degreeLimit = regs.getFileSize(f, lval->reg.size);
+   degreeLimit -= relDegree[1][colors] - 1;
 
livei.insert(lval->livei);
 }
@@ -1466,10 +1468,25 @@ SpillCodeInserter::assignSlot(const Interval &livei, 
const unsigned int size)
return slot.sym;
 }
 
+Symbol *
+SpillCodeInserter::offsetSlot(Symbol *base, const LValue *lval)
+{
+   if (!base || !lval->compound || (lval->compMask & 0x1))
+  return base;
+   Symbol *slot = cloneShallow(func, base);
+
+   slot->reg.data.offset += (ffs(lval->compMask) - 1) * lval->reg.size;
+   slot->reg.size = lval->reg.size;
+
+   return slot;
+}
+
 void
 SpillCodeInserter::spill(Instruction *defi, Value *slot, LValue *lval)
 {
-   const DataType ty = typeOfSize(slot->reg.size);
+   const DataType ty = typeOfSize(lval->reg.size);
+
+   slot = offsetSlot(slot->asSym(), lval);
 
Instruction *st;
if (slot->reg.file == FILE_MEMORY_LOCAL) {
@@ -1488,8 +1505,9 @@ SpillCodeInserter::spill(Instruction *defi, Value *slot, 
LValue *lval)
 LValue *
 SpillCodeInserter::unspill(Instruction *usei, LValue *lval, Value *slot)
 {
-   const DataType ty = typeOfSize(slot->reg.size);
+   const DataType ty = typeOfSize(lval->reg.size);
 
+   slot = offsetSlot(slot->asSym(), lval);
lval = cloneShallow(func, lval);
 
Instruction *ld;
@@ -1506,6 +1524,16 @@ SpillCodeInserter::unspill(Instruction *usei, LValue 
*lval, Value *slot)
return lval;
 }
 
+
+// For each value that is to be spilled, go through all its definitions.
+// A value can have multiple definitions if it has been coalesced before.
+// For each definition, first go through all its uses and insert an unspill
+// instruction before it, then replace the use with the temporary register.
+// Unspill can be either a load from memory or simply a move to another
+// register file.
+// For "Pseudo" instructions (like PHI, SPLIT, MERGE) we can erase the use
+// if we have spilled to a memory location, or simply with the new register.
+// No load or conversion instruction should be needed.
 bool
 SpillCodeInserter::run(const std::list& lst)
 {
@@ -1524,12 +1552,13 @@ SpillCodeInserter::run(const std::list& lst)
  LValue *dval = (*d)->get()->asLValue();
  Instruction *defi = (*d)->getInsn();
 
- // handle uses first or they'll contain the spill stores
+ // Unspill at each use *before* inserting spill instructions,
+ // we don't want to have the spill instructions in the use list here.
  while (!dval->uses.empty()) {
 ValueRef *u = dval->uses.front();
 Instruction *usei = u->getInsn();
 assert(usei);
-if (usei->op == OP_PHI) {
+if (usei->isPseudo()) {
tmp = (slot->reg.file == FILE_MEMORY_LOCAL) ? NULL : slot;
last = NULL;
 } else
@@ -1541,7 +1570,7 @@ SpillCodeInserter::run(const std::list& lst)
  }
 
  assert(defi);
- if (defi->op == OP_PHI) {
+ if (defi->isPseudo()) {
 d = lval->defs.erase(d);
 --d;
 if (slot->reg.file == FILE_MEMORY_LOCAL)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: update assertion in detach_shader() for geom shaders

2014-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: c325ec896545cc909f2f0e359f0bb0513a8a53b5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c325ec896545cc909f2f0e359f0bb0513a8a53b5

Author: Brian Paul 
Date:   Sat Feb  8 13:39:45 2014 -0700

mesa: update assertion in detach_shader() for geom shaders

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74723
Cc: "10.0" "10.1" 
Tested-by: Andreas Boll 

---

 src/mesa/main/shaderapi.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 65b6b16..97a57a4 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -404,6 +404,7 @@ detach_shader(struct gl_context *ctx, GLuint program, 
GLuint shader)
  {
 for (j = 0; j < shProg->NumShaders; j++) {
assert(shProg->Shaders[j]->Type == GL_VERTEX_SHADER ||
+  shProg->Shaders[j]->Type == GL_GEOMETRY_SHADER ||
   shProg->Shaders[j]->Type == GL_FRAGMENT_SHADER);
assert(shProg->Shaders[j]->RefCount > 0);
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): mesa: remove _mesa_ prefix from some static functions

2014-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 1dc209d8f244009a7a211012abb98cd8211dbb65
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1dc209d8f244009a7a211012abb98cd8211dbb65

Author: Brian Paul 
Date:   Thu Feb  6 18:21:58 2014 -0700

mesa: remove _mesa_ prefix from some static functions

Reviewed-by: Reviewed-by: Kenneth Graunke 

---

 src/mesa/main/errors.c |   50 ++--
 1 file changed, 23 insertions(+), 27 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index 28357e0..f84a3c1 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -346,9 +346,9 @@ remap_severity(GLenum severity) {
  * the null terminator this time.
  */
 static void
-_mesa_log_msg(struct gl_context *ctx, enum mesa_debug_source source,
-  enum mesa_debug_type type, GLuint id,
-  enum mesa_debug_severity severity, GLint len, const char *buf)
+log_msg(struct gl_context *ctx, enum mesa_debug_source source,
+enum mesa_debug_type type, GLuint id,
+enum mesa_debug_severity severity, GLint len, const char *buf)
 {
GLint nextEmpty;
struct gl_debug_msg *emptySlot;
@@ -400,9 +400,9 @@ _mesa_log_msg(struct gl_context *ctx, enum 
mesa_debug_source source,
  * indicates failure.
  */
 static GLsizei
-_mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
-  GLuint *id, GLenum *severity, GLsizei bufSize, char *buf,
-  unsigned caller)
+get_msg(struct gl_context *ctx, GLenum *source, GLenum *type,
+GLuint *id, GLenum *severity, GLsizei bufSize, char *buf,
+unsigned caller)
 {
struct gl_debug_msg *msg;
GLsizei length;
@@ -681,10 +681,10 @@ message_insert(GLenum source, GLenum type, GLuint id,
   return;
}
 
-   _mesa_log_msg(ctx,
- gl_enum_to_debug_source(source),
- gl_enum_to_debug_type(type), id,
- gl_enum_to_debug_severity(severity), length, buf);
+   log_msg(ctx,
+   gl_enum_to_debug_source(source),
+   gl_enum_to_debug_type(type), id,
+   gl_enum_to_debug_severity(severity), length, buf);
 }
 
 /**
@@ -711,8 +711,8 @@ get_message_log(GLuint count, GLsizei logSize, GLenum* 
sources,
}
 
for (ret = 0; ret < count; ret++) {
-  GLsizei written = _mesa_get_msg(ctx, sources, types, ids, severities,
-  logSize, messageLog, caller);
+  GLsizei written = get_msg(ctx, sources, types, ids, severities,
+logSize, messageLog, caller);
   if (!written)
  break;
 
@@ -893,7 +893,7 @@ _mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei 
length,
 }
 
 void GLAPIENTRY
-_mesa_PopDebugGroup()
+_mesa_PopDebugGroup(void)
 {
const char *callerstr = "glPopDebugGroup";
struct gl_debug_msg *gdmessage;
@@ -910,14 +910,14 @@ _mesa_PopDebugGroup()
ctx->Debug.GroupStackDepth--;
 
gdmessage = &ctx->Debug.DebugGroupMsgs[prevStackDepth];
-   /* using _mesa_log_msg() directly here as verification of parameters
+   /* using log_msg() directly here as verification of parameters
 * already done in push
 */
-   _mesa_log_msg(ctx, gdmessage->source,
- gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP),
- gdmessage->id,
- gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION),
- gdmessage->length, gdmessage->message);
+   log_msg(ctx, gdmessage->source,
+   gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP),
+   gdmessage->id,
+   gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION),
+   gdmessage->length, gdmessage->message);
 
if (gdmessage->message != (char*)out_of_memory)
   free(gdmessage->message);
@@ -1202,8 +1202,7 @@ _mesa_gl_debug(struct gl_context *ctx,
len = _mesa_vsnprintf(s, MAX_DEBUG_MESSAGE_LENGTH, fmtString, args);
va_end(args);
 
-   _mesa_log_msg(ctx, MESA_DEBUG_SOURCE_API, type,
- *id, severity, len, s);
+   log_msg(ctx, MESA_DEBUG_SOURCE_API, type, *id, severity, len, s);
 }
 
 
@@ -1268,11 +1267,8 @@ _mesa_error( struct gl_context *ctx, GLenum error, const 
char *fmtString, ... )
 
   /* Log the error via ARB_debug_output if needed.*/
   if (do_log) {
- _mesa_log_msg(ctx,
-   MESA_DEBUG_SOURCE_API,
-   MESA_DEBUG_TYPE_ERROR,
-   error_msg_id,
-   MESA_DEBUG_SEVERITY_HIGH, len, s2);
+ log_msg(ctx, MESA_DEBUG_SOURCE_API, MESA_DEBUG_TYPE_ERROR,
+ error_msg_id, MESA_DEBUG_SEVERITY_HIGH, len, s2);
   }
}
 
@@ -1329,7 +1325,7 @@ _mesa_shader_debug( struct gl_context *ctx, GLenum type, 
GLuint *id,
if (len >= MAX_DEBUG_MESSAGE_LENGTH)
   len = MAX_DEBUG_MESSAGE_LENGTH - 1;
 
-   _mesa_log_msg(ctx, source, type, *id, severity, len, msg);
+   log_msg(ctx, source, type, *id, severity, len, msg);
 }
 
 /*@}*/

___

Mesa (master): mesa: allocate gl_debug_state on demand

2014-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 6e8d04ac3e9074bffe25a1ef9e6b198caaa30385
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e8d04ac3e9074bffe25a1ef9e6b198caaa30385

Author: Brian Paul 
Date:   Thu Feb  6 18:21:58 2014 -0700

mesa: allocate gl_debug_state on demand

We don't need to allocate all the state related to GL_ARB_debug_output
until some aspect of that extension is actually needed.

The sizeof(gl_debug_state) is huge (~285KB on 64-bit systems), not even
counting the 54(!) hash tables and lists that it contains.  This change
reduces the size of gl_context alone from 431KB bytes to 145KB bytes on
64-bit systems and from 277KB bytes to 78KB bytes on 32-bit systems.

Reviewed-by: Reviewed-by: Kenneth Graunke 

---

 src/mesa/drivers/dri/common/dri_util.c |6 +-
 src/mesa/main/enable.c |   33 +++-
 src/mesa/main/errors.c |  331 +++-
 src/mesa/main/errors.h |3 +
 src/mesa/main/get.c|   21 ++
 src/mesa/main/get_hash_params.py   |6 +-
 src/mesa/main/getstring.c  |   16 +-
 src/mesa/main/mtypes.h |2 +-
 src/mesa/state_tracker/st_manager.c|9 +-
 9 files changed, 274 insertions(+), 153 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 83841de..d09d50a 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -49,6 +49,7 @@
 #include "../glsl/glsl_parser_extras.h"
 #include "main/mtypes.h"
 #include "main/version.h"
+#include "main/errors.h"
 #include "main/macros.h"
 
 PUBLIC const char __dri2ConfigOptions[] =
@@ -448,8 +449,11 @@ driContextSetFlags(struct gl_context *ctx, uint32_t flags)
 if ((flags & __DRI_CTX_FLAG_FORWARD_COMPATIBLE) != 0)
 ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
 if ((flags & __DRI_CTX_FLAG_DEBUG) != 0) {
+struct gl_debug_state *debug = _mesa_get_debug_state(ctx);
+if (debug) {
+debug->DebugOutput = GL_TRUE;
+}
 ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT;
-ctx->Debug.DebugOutput = GL_TRUE;
 }
 }
 
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 40508a4..edd4751 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -32,6 +32,7 @@
 #include "clip.h"
 #include "context.h"
 #include "enable.h"
+#include "errors.h"
 #include "light.h"
 #include "simple_list.h"
 #include "mtypes.h"
@@ -367,14 +368,26 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, 
GLboolean state)
  ctx->Depth.Test = state;
  break;
   case GL_DEBUG_OUTPUT:
- if (!_mesa_is_desktop_gl(ctx))
+ if (!_mesa_is_desktop_gl(ctx)) {
 goto invalid_enum_error;
- ctx->Debug.DebugOutput = state;
+ }
+ else {
+struct gl_debug_state *debug = _mesa_get_debug_state(ctx);
+if (debug) {
+   debug->DebugOutput = state;
+}
+ }
  break;
   case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
- if (!_mesa_is_desktop_gl(ctx))
+ if (!_mesa_is_desktop_gl(ctx)) {
 goto invalid_enum_error;
- ctx->Debug.SyncOutput = state;
+ }
+ else {
+struct gl_debug_state *debug = _mesa_get_debug_state(ctx);
+if (debug) {
+   debug->SyncOutput = state;
+}
+ }
  break;
   case GL_DITHER:
  if (ctx->Color.DitherFlag == state)
@@ -1228,11 +1241,19 @@ _mesa_IsEnabled( GLenum cap )
   case GL_DEBUG_OUTPUT:
  if (!_mesa_is_desktop_gl(ctx))
 goto invalid_enum_error;
- return ctx->Debug.DebugOutput;
+ if (ctx->Debug) {
+return ctx->Debug->DebugOutput;
+ } else {
+return GL_FALSE;
+ }
   case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB:
  if (!_mesa_is_desktop_gl(ctx))
 goto invalid_enum_error;
- return ctx->Debug.SyncOutput;
+ if (ctx->Debug) {
+return ctx->Debug->SyncOutput;
+ } else {
+return GL_FALSE;
+ }
   case GL_DEPTH_TEST:
  return ctx->Depth.Test;
   case GL_DITHER:
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index dcae2f5..5f4eac6 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -118,6 +118,7 @@ gl_enum_to_debug_severity(GLenum e)
return i;
 }
 
+
 /**
  * Handles generating a GL_ARB_debug_output message ID generated by the GL or
  * GLSL compiler.
@@ -186,6 +187,49 @@ enum {
 
 
 /**
+ * Return debug state for the context.  The debug state will be allocated
+ * and initialized upon the first call.
+ */
+struct gl_debug_state *
+_mesa_get_debug_state(struct gl_context *ctx)
+{
+   if (!ctx->Debug) {
+  ctx->Debug = CALLOC_STRUCT(gl_debug_state);
+  if (!ctx->Debug) {
+ _mesa_error(ctx, GL_OUT

Mesa (master): mesa: trivial clean-ups in errors.c

2014-02-08 Thread Brian Paul
Module: Mesa
Branch: master
Commit: 31b2625cb50da6c6ac40ca1c9f2729e846b1e371
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=31b2625cb50da6c6ac40ca1c9f2729e846b1e371

Author: Brian Paul 
Date:   Thu Feb  6 18:21:58 2014 -0700

mesa: trivial clean-ups in errors.c

Whitespace changes, 78-column rewrapping, comment clean-ups, add
some braces, etc.

Reviewed-by: Reviewed-by: Kenneth Graunke 

---

 src/mesa/main/errors.c |  125 
 1 file changed, 84 insertions(+), 41 deletions(-)

diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
index f84a3c1..dcae2f5 100644
--- a/src/mesa/main/errors.c
+++ b/src/mesa/main/errors.c
@@ -81,6 +81,7 @@ static const GLenum debug_severity_enums[] = {
GL_DEBUG_SEVERITY_NOTIFICATION,
 };
 
+
 static enum mesa_debug_source
 gl_enum_to_debug_source(GLenum e)
 {
@@ -141,6 +142,7 @@ debug_get_id(GLuint *id)
}
 }
 
+
 /*
  * We store a bitfield in the hash table, with five possible values total.
  *
@@ -182,6 +184,7 @@ enum {
ENABLED = ENABLED_BIT | FOUND_BIT
 };
 
+
 /**
  * Returns the state of the given message source/type/ID tuple.
  */
@@ -194,21 +197,23 @@ should_log(struct gl_context *ctx,
 {
GLint gstack = ctx->Debug.GroupStackDepth;
struct gl_debug_namespace *nspace =
- &ctx->Debug.Namespaces[gstack][source][type];
+  &ctx->Debug.Namespaces[gstack][source][type];
uintptr_t state;
 
if (!ctx->Debug.DebugOutput)
   return GL_FALSE;
 
/* In addition to not being able to store zero as a value, HashTable also
-  can't use zero as a key. */
+* can't use zero as a key.
+*/
if (id)
   state = (uintptr_t)_mesa_HashLookup(nspace->IDs, id);
else
   state = nspace->ZeroID;
 
/* Only do this once for each ID. This makes sure the ID exists in,
-  at most, one list, and does not pointlessly appear multiple times. */
+* at most, one list, and does not pointlessly appear multiple times.
+*/
if (!(state & KNOWN_SEVERITY)) {
   struct gl_debug_severity *entry;
 
@@ -238,6 +243,7 @@ out:
return !!(state & ENABLED_BIT);
 }
 
+
 /**
  * Sets the state of the given message source/type/ID tuple.
  */
@@ -249,11 +255,12 @@ set_message_state(struct gl_context *ctx,
 {
GLint gstack = ctx->Debug.GroupStackDepth;
struct gl_debug_namespace *nspace =
- &ctx->Debug.Namespaces[gstack][source][type];
+  &ctx->Debug.Namespaces[gstack][source][type];
uintptr_t state;
 
/* In addition to not being able to store zero as a value, HashTable also
-  can't use zero as a key. */
+* can't use zero as a key.
+*/
if (id)
   state = (uintptr_t)_mesa_HashLookup(nspace->IDs, id);
else
@@ -274,6 +281,7 @@ set_message_state(struct gl_context *ctx,
   nspace->ZeroID = state;
 }
 
+
 static void
 store_message_details(struct gl_debug_msg *emptySlot,
   enum mesa_debug_source source,
@@ -307,7 +315,8 @@ store_message_details(struct gl_debug_msg *emptySlot,
}
 }
 
- /**
+
+/**
  * Remap any type exclusive to KHR_debug to something suitable
  * for ARB_debug_output
  */
@@ -326,6 +335,7 @@ remap_type(GLenum type) {
   return type;
 }
 
+
 /**
  * Remap severity exclusive to KHR_debug to something suitable
  * for ARB_debug_output
@@ -339,6 +349,7 @@ remap_severity(GLenum severity) {
return severity;
 }
 
+
 /**
  * 'buf' is not necessarily a null-terminated string. When logging, copy
  * 'len' characters from it, store them in a new, null-terminated string,
@@ -366,10 +377,7 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source 
source,
   gl_severity = remap_severity(gl_severity);
   gl_type = remap_type(gl_type);
   }
-  ctx->Debug.Callback(debug_source_enums[source],
-  gl_type,
-  id,
-  gl_severity,
+  ctx->Debug.Callback(debug_source_enums[source], gl_type, id, gl_severity,
   len, buf, ctx->Debug.CallbackData);
   return;
}
@@ -389,6 +397,7 @@ log_msg(struct gl_context *ctx, enum mesa_debug_source 
source,
ctx->Debug.NumMessages++;
 }
 
+
 /**
  * Pop the oldest debug message out of the log.
  * Writes the message string, including the null terminator, into 'buf',
@@ -423,15 +432,20 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum 
*type,
   if (caller == MESSAGE_LOG_ARB)
  *severity = remap_severity(*severity);
}
-   if (source)
+
+   if (source) {
   *source = debug_source_enums[msg->source];
+   }
+
if (type) {
   *type = debug_type_enums[msg->type];
   if (caller == MESSAGE_LOG_ARB)
  *type = remap_type(*type);
}
-   if (id)
+
+   if (id) {
   *id = msg->id;
+   }
 
if (buf) {
   assert(msg->message[length-1] == '\0');
@@ -451,6 +465,7 @@ get_msg(struct gl_context *ctx, GLenum *source, GLenum 
*type,
return length;
 }
 
+
 /**
  * Verify that source, type, and severi