diff options
author | Chia-I Wu <[email protected]> | 2014-04-22 10:23:47 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2014-04-27 10:06:20 +0800 |
commit | 880183fee8933fee62131a61e54b7fcc09a9d6b1 (patch) | |
tree | 6314e5957a1b183d8c880def34171962c6c7287d /src | |
parent | 7554d27de456848e882f4eae1ef47f2b402b93e3 (diff) |
mesa: refactor debug output set_message_state
Move message state update to debug_set_message_enable. No functional change.
Signed-off-by: Chia-I Wu <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/errors.c | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 55b50b3e8d0..d2d072f2af8 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -217,6 +217,43 @@ debug_create(void) return debug; } +/* + * Sets the state of the given message source/type/ID tuple. + */ +static void +debug_set_message_enable(struct gl_debug_state *debug, + enum mesa_debug_source source, + enum mesa_debug_type type, + GLuint id, GLboolean enabled) +{ + GLint gstack = debug->GroupStackDepth; + struct gl_debug_namespace *nspace = + &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. + */ + if (id) + state = (uintptr_t)_mesa_HashLookup(nspace->IDs, id); + else + state = nspace->ZeroID; + + if (state == NOT_FOUND) + state = enabled ? ENABLED : DISABLED; + else { + if (enabled) + state |= ENABLED_BIT; + else + state &= ~ENABLED_BIT; + } + + if (id) + _mesa_HashInsert(nspace->IDs, id, (void*)state); + else + nspace->ZeroID = state; +} + /** * Returns if the given message source/type/ID tuple is enabled. */ @@ -316,9 +353,6 @@ should_log(struct gl_context *ctx, } -/** - * Sets the state of the given message source/type/ID tuple. - */ static void set_message_state(struct gl_context *ctx, enum mesa_debug_source source, @@ -327,34 +361,8 @@ set_message_state(struct gl_context *ctx, { struct gl_debug_state *debug = _mesa_get_debug_state(ctx); - if (debug) { - GLint gstack = debug->GroupStackDepth; - struct gl_debug_namespace *nspace = - &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. - */ - if (id) - state = (uintptr_t)_mesa_HashLookup(nspace->IDs, id); - else - state = nspace->ZeroID; - - if (state == NOT_FOUND) - state = enabled ? ENABLED : DISABLED; - else { - if (enabled) - state |= ENABLED_BIT; - else - state &= ~ENABLED_BIT; - } - - if (id) - _mesa_HashInsert(nspace->IDs, id, (void*)state); - else - nspace->ZeroID = state; - } + if (debug) + debug_set_message_enable(debug, source, type, id, enabled); } |