[Mesa-dev] [RFC PATCH 16/26] mesa: support multisample textures in framebuffer completeness check

Brian Paul brianp at vmware.com
Wed Jan 2 10:11:39 PST 2013


On 12/29/2012 05:35 AM, Chris Forbes wrote:
> - sample count must be the same on all attachments
> - fixedsamplepositions must be the same on all attachments
> (renderbuffers have fixedsamplepositions=true implicitly; only
> multisample textures can choose to have it false)
>
> Signed-off-by: Chris Forbes<chrisf at ijw.co.nz>
> ---
>   src/mesa/main/fbobject.c | 35 ++++++++++++++++++++++++++---------
>   1 file changed, 26 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index c541695..b1d2eb4 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -681,6 +681,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>      GLenum intFormat = GL_NONE; /* color buffers' internal format */
>      GLuint minWidth = ~0, minHeight = ~0, maxWidth = 0, maxHeight = 0;
>      GLint numSamples = -1;
> +   GLint fixedSampleLocations = -1;
>      GLint i;
>      GLuint j;
>
> @@ -756,6 +757,12 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>               fbo_incomplete("texture attachment incomplete", -1);
>               return;
>            }
> +
> +         if (numSamples<  0)
> +            numSamples = att->Texture->NumSamples;
> +
> +         if (fixedSampleLocations<  0)
> +            fixedSampleLocations = att->Texture->FixedSampleLocations;
>         }
>         else if (att->Type == GL_RENDERBUFFER_EXT) {
>            minWidth = MIN2(minWidth, att->Renderbuffer->Width);
> @@ -765,21 +772,23 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>            f = att->Renderbuffer->InternalFormat;
>            attFormat = att->Renderbuffer->Format;
>            numImages++;
> +
> +         if (numSamples<  0)
> +            numSamples = att->Renderbuffer->NumSamples;
> +
> +         /* RENDERBUFFER has fixedSampleLocations implicitly true */
> +         if (fixedSampleLocations<  0)
> +            fixedSampleLocations = GL_TRUE;
>         }
>         else {
>            assert(att->Type == GL_NONE);
>            continue;
>         }
>
> -      if (att->Renderbuffer&&  numSamples<  0) {
> -         /* first buffer */
> -         numSamples = att->Renderbuffer->NumSamples;
> -      }
> -
>         /* check if integer color */
>         fb->_IntegerColor = _mesa_is_format_integer_color(attFormat);
>
> -      /* Error-check width, height, format, samples
> +      /* Error-check width, height, format, samples, fixedSampleLocations
>          */
>         if (numImages == 1) {
>            /* save format, num samples */
> @@ -802,10 +811,18 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>                  return;
>               }
>            }
> -         if (att->Renderbuffer&&
> -             att->Renderbuffer->NumSamples != numSamples) {
> +
> +         if ((att->Type == GL_RENDERBUFFER&&  att->Renderbuffer->NumSamples != numSamples) ||
> +             (att->Type == GL_TEXTURE&&  att->Texture->NumSamples != numSamples)) {
> +            fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
> +            fbo_incomplete("inconsistent number of samples", i);
> +            return;
> +         }
> +
> +         if ((att->Type == GL_RENDERBUFFER&&  GL_TRUE != fixedSampleLocations) ||
> +             (att->Type == GL_TEXTURE&&  att->Texture->FixedSampleLocations != fixedSampleLocations)) {
>               fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;

Could you try to wrap those lines to < 80 columns?


> -            fbo_incomplete("inconsistant number of samples", i);
> +            fbo_incomplete("inconsistent fixedsamplelocations", i);

You can use spaces in an internal debug message like that ("fixed 
sample locations").


>               return;
>            }
>         }



More information about the mesa-dev mailing list