[Mesa-dev] [PATCH 3/7] mesa: correctly manage GroupStackDepth

Ilia Mirkin imirkin at alum.mit.edu
Sun Nov 22 15:22:48 PST 2015


There are some places that you're not fixing up... would this
alternatively be resolved by returning GroupStackDepth+1 in
_mesa_get_debug_state_int and leaving everything else alone?

On Sun, Nov 22, 2015 at 6:21 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> The variable represents the length/size of the stack, thus (based on the
> spec requirement and the allocation above) it should be set to 1.
>
> This means that we have to use GroupStackDepth-1 to access the correct
> entry in the array.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  src/mesa/main/errors.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c
> index 366b119..52dbd50 100644
> --- a/src/mesa/main/errors.c
> +++ b/src/mesa/main/errors.c
> @@ -406,6 +406,7 @@ debug_create(void)
>        free(debug);
>        return NULL;
>     }
> +   debug->GroupStackDepth = 1;
>
>     /* Initialize state for filtering known debug messages. */
>     for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) {
> @@ -422,7 +423,7 @@ debug_create(void)
>  static bool
>  debug_is_group_read_only(const struct gl_debug_state *debug)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>     return (gstack > 0 && debug->Groups[gstack] == debug->Groups[gstack - 1]);
>  }
>
> @@ -432,7 +433,7 @@ debug_is_group_read_only(const struct gl_debug_state *debug)
>  static bool
>  debug_make_group_writable(struct gl_debug_state *debug)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>     const struct gl_debug_group *src = debug->Groups[gstack];
>     struct gl_debug_group *dst;
>     int s, t;
> @@ -472,7 +473,7 @@ debug_make_group_writable(struct gl_debug_state *debug)
>  static void
>  debug_clear_group(struct gl_debug_state *debug)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>
>     if (!debug_is_group_read_only(debug)) {
>        struct gl_debug_group *grp = debug->Groups[gstack];
> @@ -514,7 +515,7 @@ debug_set_message_enable(struct gl_debug_state *debug,
>                           enum mesa_debug_type type,
>                           GLuint id, GLboolean enabled)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>     struct gl_debug_namespace *ns;
>
>     debug_make_group_writable(debug);
> @@ -541,7 +542,7 @@ debug_set_message_enable_all(struct gl_debug_state *debug,
>                               enum mesa_debug_severity severity,
>                               GLboolean enabled)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>     int s, t, smax, tmax;
>
>     if (source == MESA_DEBUG_SOURCE_COUNT) {
> @@ -579,7 +580,7 @@ debug_is_message_enabled(const struct gl_debug_state *debug,
>                           GLuint id,
>                           enum mesa_debug_severity severity)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>     struct gl_debug_group *grp = debug->Groups[gstack];
>     struct gl_debug_namespace *nspace = &grp->Namespaces[source][type];
>
> @@ -657,13 +658,13 @@ debug_delete_messages(struct gl_debug_state *debug, int count)
>  static struct gl_debug_message *
>  debug_get_group_message(struct gl_debug_state *debug)
>  {
> -   return &debug->GroupMessages[debug->GroupStackDepth];
> +   return &debug->GroupMessages[debug->GroupStackDepth - 1];
>  }
>
>  static void
>  debug_push_group(struct gl_debug_state *debug)
>  {
> -   const GLint gstack = debug->GroupStackDepth;
> +   const GLint gstack = debug->GroupStackDepth - 1;
>
>     /* just point to the previous stack */
>     debug->Groups[gstack + 1] = debug->Groups[gstack];
> --
> 2.6.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list