[Mesa-dev] [RFC PATCH 18/26] fbo: allow stencil textures

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


In the description the "fbo:" should just be "mesa:".

On 12/29/2012 05:35 AM, Chris Forbes wrote:
> ARB_texture_multisample allows STENCIL_INDEX and sized variants with the
> multisample texture targets; similar to renderbuffers.
>
> Signed-off-by: Chris Forbes<chrisf at ijw.co.nz>
> ---
>   src/mesa/main/fbobject.c | 29 ++++++-----------------------
>   1 file changed, 6 insertions(+), 23 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index b1d2eb4..122d689 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -503,22 +503,6 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
>
>
>   /**
> - * Is the given base format a legal format for a depth/stencil renderbuffer?
> - */
> -static GLboolean
> -is_legal_depth_format(const struct gl_context *ctx, GLenum baseFormat)
> -{
> -   switch (baseFormat) {
> -   case GL_DEPTH_COMPONENT:
> -   case GL_DEPTH_STENCIL_EXT:
> -      return GL_TRUE;
> -   default:
> -      return GL_FALSE;
> -   }
> -}
> -
> -
> -/**
>    * Test if an attachment point is complete and update its Complete field.
>    * \param format if GL_COLOR, this is a color attachment point,
>    *               if GL_DEPTH, this is a depth component attachment point,
> @@ -600,8 +584,13 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
>                baseFormat == GL_DEPTH_STENCIL_EXT) {
>               /* OK */
>            }
> +         else if (ctx->Extensions.ARB_texture_multisample&&
> +               baseFormat == GL_STENCIL_INDEX) {
> +            /* OK */
> +         }
>            else {
> -            /* no such thing as stencil-only textures */
> +            /* no such thing as stencil-only textures before
> +             * multisample textures */
>               att_incomplete("illegal stencil texture");
>               att->Complete = GL_FALSE;
>               return;
> @@ -751,12 +740,6 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
>            f = texImg->_BaseFormat;
>            attFormat = texImg->TexFormat;
>            numImages++;
> -         if (!_mesa_is_legal_color_format(ctx, f)&&
> -             !is_legal_depth_format(ctx, f)) {
> -            fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
> -            fbo_incomplete("texture attachment incomplete", -1);
> -            return;
> -         }
>
>            if (numSamples<  0)
>               numSamples = att->Texture->NumSamples;

Rather than remove this code, how about predicating it on 
ctx->Extensions.ARB_texture_multisample?  The check should still be 
done if that extension isn't supported.

-Brian


More information about the mesa-dev mailing list