[Mesa-dev] [PATCH] mesa: Report core FBO incompleteness cases through GL_ARB_debug_output.

Brian Paul brianp at vmware.com
Thu Jun 6 12:16:01 PDT 2013


On 06/06/2013 11:16 AM, Eric Anholt wrote:
> Just like we produce from inside the Intel driver, this can help provide
> information quickly about FBO incompatibility problems (particularly when
> using apitrace replay).
>
> Currently, in driver-marked incompleteness cases, you'll get both the
> driver message and the core message on Intel.  Until the other drivers are
> fixed to produce output, I think this is better than not putting in a
> message for driver-marked incomplete.
> ---
>   src/mesa/main/fbobject.c | 43 +++++++++++++++++++++++++------------------
>   1 file changed, 25 insertions(+), 18 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index aa0f125..ba462e9 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -568,8 +568,15 @@ att_incomplete(const char *msg)
>    * For debug only.
>    */
>   static void
> -fbo_incomplete(const char *msg, int index)
> +fbo_incomplete(struct gl_context *ctx, const char *msg, int index)
>   {
> +   static GLuint msg_id;
> +
> +   _mesa_gl_debug(ctx, &msg_id,
> +                  MESA_DEBUG_TYPE_OTHER,
> +                  MESA_DEBUG_SEVERITY_MEDIUM,
> +                  "FBO incomplete: %s [%d]\n", msg, index);
> +
>      if (MESA_DEBUG_FLAGS & DEBUG_INCOMPLETE_FBO) {
>         _mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
>      }
> @@ -863,7 +870,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>            test_attachment_completeness(ctx, GL_DEPTH, att);
>            if (!att->Complete) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
> -            fbo_incomplete("depth attachment incomplete", -1);
> +            fbo_incomplete(ctx, "depth attachment incomplete", -1);
>               return;
>            }
>         }
> @@ -872,7 +879,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>            test_attachment_completeness(ctx, GL_STENCIL, att);
>            if (!att->Complete) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
> -            fbo_incomplete("stencil attachment incomplete", -1);
> +            fbo_incomplete(ctx, "stencil attachment incomplete", -1);
>               return;
>            }
>         }
> @@ -881,7 +888,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>            test_attachment_completeness(ctx, GL_COLOR, att);
>            if (!att->Complete) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
> -            fbo_incomplete("color attachment incomplete", i);
> +            fbo_incomplete(ctx, "color attachment incomplete", i);
>               return;
>            }
>         }
> @@ -901,7 +908,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>            if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&
>                !is_legal_depth_format(ctx, f)) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
> -            fbo_incomplete("texture attachment incomplete", -1);
> +            fbo_incomplete(ctx, "texture attachment incomplete", -1);
>               return;
>            }
>
> @@ -909,7 +916,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>               numSamples = texImg->NumSamples;
>            else if (numSamples != texImg->NumSamples) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
> -            fbo_incomplete("inconsistent sample count", -1);
> +            fbo_incomplete(ctx, "inconsistent sample count", -1);
>               return;
>            }
>
> @@ -917,7 +924,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>               fixedSampleLocations = texImg->FixedSampleLocations;
>            else if (fixedSampleLocations != texImg->FixedSampleLocations) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
> -            fbo_incomplete("inconsistent fixed sample locations", -1);
> +            fbo_incomplete(ctx, "inconsistent fixed sample locations", -1);
>               return;
>            }
>         }
> @@ -934,7 +941,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>               numSamples = att->Renderbuffer->NumSamples;
>            else if (numSamples != att->Renderbuffer->NumSamples) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
> -            fbo_incomplete("inconsistent sample count", -1);
> +            fbo_incomplete(ctx, "inconsistent sample count", -1);
>               return;
>            }
>
> @@ -943,7 +950,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>               fixedSampleLocations = GL_TRUE;
>            else if (fixedSampleLocations != GL_TRUE) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
> -            fbo_incomplete("inconsistent fixed sample locations", -1);
> +            fbo_incomplete(ctx, "inconsistent fixed sample locations", -1);
>               return;
>            }
>         }
> @@ -980,13 +987,13 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>               /* check that width, height, format are same */
>               if (minWidth != maxWidth || minHeight != maxHeight) {
>                  fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT;
> -               fbo_incomplete("width or height mismatch", -1);
> +               fbo_incomplete(ctx, "width or height mismatch", -1);
>                  return;
>               }
>               /* check that all color buffers are the same format */
>               if (intFormat != GL_NONE && f != intFormat) {
>                  fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
> -               fbo_incomplete("format mismatch", -1);
> +               fbo_incomplete(ctx, "format mismatch", -1);
>                  return;
>               }
>            }
> @@ -997,7 +1004,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>         if (att->Type == GL_RENDERBUFFER &&
>             att->Renderbuffer->Format == MESA_FORMAT_NONE) {
>            fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
> -         fbo_incomplete("unsupported renderbuffer format", i);
> +         fbo_incomplete(ctx, "unsupported renderbuffer format", i);
>            return;
>         }
>
> @@ -1009,10 +1016,10 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>         } else if (layer_count != att_layer_count) {
>            if (layer_count == 0 || att_layer_count == 0) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS;
> -            fbo_incomplete("framebuffer attachment layer mode is inconsistent", i);
> +            fbo_incomplete(ctx, "framebuffer attachment layer mode is inconsistent", i);
>            } else {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB;
> -            fbo_incomplete("framebuffer attachment layer count is inconsistent", i);
> +            fbo_incomplete(ctx, "framebuffer attachment layer count is inconsistent", i);
>            }
>            return;
>         }
> @@ -1029,7 +1036,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>   	    assert(att);
>   	    if (att->Type == GL_NONE) {
>   	       fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT;
> -	       fbo_incomplete("missing drawbuffer", j);
> +	       fbo_incomplete(ctx, "missing drawbuffer", j);
>   	       return;
>   	    }
>   	 }
> @@ -1042,7 +1049,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>   	 assert(att);
>   	 if (att->Type == GL_NONE) {
>   	    fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT;
> -            fbo_incomplete("missing readbuffer", -1);
> +            fbo_incomplete(ctx, "missing readbuffer", -1);
>   	    return;
>   	 }
>         }
> @@ -1050,7 +1057,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>
>      if (numImages == 0) {
>         fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT;
> -      fbo_incomplete("no attachments", -1);
> +      fbo_incomplete(ctx, "no attachments", -1);
>         return;
>      }
>
> @@ -1064,7 +1071,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>      if (ctx->Driver.ValidateFramebuffer) {
>         ctx->Driver.ValidateFramebuffer(ctx, fb);
>         if (fb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
> -         fbo_incomplete("driver marked FBO as incomplete", -1);
> +         fbo_incomplete(ctx, "driver marked FBO as incomplete", -1);
>         }
>      }

Looks good.  But as long as you're there, maybe we should make better 
use of the 'index' parameter.  It looks like some of the -1 args might 
be replaced by 'i'.  And fbo_incomplete() could check for -1, -2 
(stencil buf, depth buf) and emit more informative messages.

Mesa also has some debug/info code for incomplete textures.  But knowing 
when to call _mesa_gl_debug() isn't as clear because it depends on 
sampler state, etc.  It might be too messy to do anything.

Reviewed-by: Brian Paul <brianp at vmware.com>

-Brian



More information about the mesa-dev mailing list