[Mesa-dev] [PATCH 04/16] mesa: Depth ans stencil attachments must be the same in OpenGL ES3

Iago Toral itoral at igalia.com
Fri Dec 12 03:10:36 PST 2014


On Thu, 2014-12-11 at 18:10 -0800, Ian Romanick wrote:
> On 12/11/2014 02:34 PM, Eduardo Lima Mitev wrote:
> > From: Iago Toral Quiroga <itoral at igalia.com>
> > 
> > From the OpenGL ES3 spec:
> > 
> > "9.4. FRAMEBUFFER COMPLETENESS
> >  ...
> >  Depth and stencil attachments, if present, are the same image.
> >  ...
> > "
> > 
> > Notice that this restriction is not included in the OpenGL ES2 spec.
> > 
> > Fixes 18 dEQP tests in:
> > dEQP-GLES3.functional.fbo.completeness.attachment_combinations.*
> > ---
> >  src/mesa/main/fbobject.c | 35 +++++++++++++++++++++++++++++++++++
> >  1 file changed, 35 insertions(+)
> > 
> > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> > index 4c3c157..db2f43e 100644
> > --- a/src/mesa/main/fbobject.c
> > +++ b/src/mesa/main/fbobject.c
> > @@ -886,6 +886,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
> >     GLuint max_layer_count = 0, att_layer_count;
> >     bool is_layered = false;
> >     GLenum layer_tex_target = 0;
> > +   bool has_depth_attachment = false;
> > +   bool has_stencil_attachment = false;
> >  
> >     assert(_mesa_is_user_fbo(fb));
> >  
> > @@ -923,6 +925,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
> >              fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
> >              fbo_incomplete(ctx, "depth attachment incomplete", -1);
> >              return;
> > +         } else if (att->Type != GL_NONE) {
> > +            has_depth_attachment = true;
> >           }
> >        }
> >        else if (i == -1) {
> > @@ -932,6 +936,8 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
> >              fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
> >              fbo_incomplete(ctx, "stencil attachment incomplete", -1);
> >              return;
> > +         } else if (att->Type != GL_NONE) {
> > +            has_stencil_attachment = true;
> >           }
> >        }
> >        else {
> > @@ -1128,6 +1134,35 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
> >        }
> >     }
> >  
> > +   /* The OpenGL ES3 spec, in chapter 9.4. FRAMEBUFFER COMPLETENESS, says:
> > +    *
> > +    *    "Depth and stencil attachments, if present, are the same image."
> > +    *
> > +    * This restriction is not present in the OpenGL ES2 spec.
> > +    */
> > +   if (_mesa_is_gles3(ctx) &&
> > +       has_stencil_attachment && has_depth_attachment) {
> > +      struct gl_renderbuffer_attachment *att_depth, *att_stencil;
> > +      att_depth = &fb->Attachment[BUFFER_DEPTH];
> > +      att_stencil = &fb->Attachment[BUFFER_STENCIL];
> > +      if (att_depth->Type != att_stencil->Type) {
> > +         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
> > +         fbo_incomplete(ctx, "Depth and stencil attachments must be the same image", -1);
> > +         return;
> > +      }
> > +      if (att_depth->Type == GL_TEXTURE &&
> > +          att_depth->Texture != att_stencil->Texture) {
> > +         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
> > +         fbo_incomplete(ctx, "Depth and stencil attachments must be the same image", -1);
> > +         return;
> > +      } else if (att_depth->Type == GL_RENDERBUFFER &&
> > +                 att_depth->Renderbuffer != att_stencil->Renderbuffer) {
> > +         fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
> > +         fbo_incomplete(ctx, "Depth and stencil attachments must be the same image", -1);
> > +         return;
> > +      }
> 
> I think this would be better as a single if-statement, and you can use
> _mesa_has_depthstencil_combined.

Sure, I'll do this change.
Thanks for reviewing!

Iago

> > +   }
> > +
> >     /* Provisionally set status = COMPLETE ... */
> >     fb->_Status = GL_FRAMEBUFFER_COMPLETE_EXT;
> >  
> > 
> 
> _______________________________________________
> 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