[Mesa-dev] [PATCH 2/2] mesa: Fix glFramebufferTexture* error codes (v2)

Tomasz Figa tfiga at chromium.org
Tue Oct 11 06:29:17 UTC 2016


[Fixing CC list.]

Ping. Would appreciate someone taking a look at this. Thanks in advance!

On Fri, Aug 26, 2016 at 2:57 AM, Chad Versace <chadversary at chromium.org>
wrote:

> Bump.
>
> On Thu 11 Aug 2016, Chad Versace wrote:
> > If check_textarget() determined that textarget was incorrect, it emitted
> > GL_INVALID_OPERATION.  This is the correct behavior when target and
> > textarget are mismatched but textarget is a valid textarget enum.
> >
> > When textarget is not a valid textarget enum, the GL spec requires that
> > GL_INVALID_ENUM be emitted.
> >
> > Fixes test dEQP-GLES3.functional.negative_api.buffer.framebuffer_
> texture2d.
> >
> > v2:
> >   - Continue emitting GL_INVALID_OPERATION when textarget is
> >     a valid textarget enum mismatched with target. [idr and imirkin]
> >
> > Cc: Ian Romanick <idr at freedesktop.org>
> > Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> > Cc: Haixia Shi <hshi at chromium.org>
> > Change-Id: I86c492f228720ec8cf9939e741cfc99a5d9fa1bc
> > ---
> >
> > I'm now checking that textarget is a valid textarget enum with a switch
> > at the top of the function, which emits error GL_INVALID_ENUM. The
> > switch lists every textarget I know of, but I'm not confident that it's
> > correct.
> >
> > Should some textargets not be in the switch?
> >
> >
> >
> >  src/mesa/main/fbobject.c | 33 ++++++++++++++++++++++++++-------
> >  1 file changed, 26 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> > index 2c01526..76adb29 100644
> > --- a/src/mesa/main/fbobject.c
> > +++ b/src/mesa/main/fbobject.c
> > @@ -2979,6 +2979,32 @@ check_textarget(struct gl_context *ctx, int dims,
> GLenum target,
> >  {
> >     bool err = false;
> >
> > +   /* Check that textarget is a valid textarget enum. */
> > +   switch (textarget) {
> > +      case GL_TEXTURE_1D:
> > +      case GL_TEXTURE_1D_ARRAY:
> > +      case GL_TEXTURE_2D:
> > +      case GL_TEXTURE_2D_ARRAY:
> > +      case GL_TEXTURE_2D_MULTISAMPLE:
> > +      case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> > +      case GL_TEXTURE_CUBE_MAP:
> > +      case GL_TEXTURE_CUBE_MAP_ARRAY:
> > +      case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
> > +      case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
> > +      case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
> > +      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
> > +      case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
> > +      case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
> > +      case GL_TEXTURE_RECTANGLE:
> > +      case GL_TEXTURE_3D:
> > +         break;
> > +      default:
> > +         _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid textarget %s)",
> > +                     caller, _mesa_enum_to_string(textarget));
> > +         return false;
> > +   }
> > +
> > +   /* Check that target and textarget match. */
> >     switch (dims) {
> >     case 1:
> >        switch (textarget) {
> > @@ -3029,13 +3055,6 @@ check_textarget(struct gl_context *ctx, int dims,
> GLenum target,
> >        err = true;
> >     }
> >
> > -   if (err) {
> > -      _mesa_error(ctx, GL_INVALID_OPERATION,
> > -                  "%s(invalid textarget %s)",
> > -                  caller, _mesa_enum_to_string(textarget));
> > -      return false;
> > -   }
> > -
> >     /* Make sure textarget is consistent with the texture's type */
> >     err = (target == GL_TEXTURE_CUBE_MAP) ?
> >            !_mesa_is_cube_face(textarget): (target != textarget);
> > --
> > 2.9.2
> >
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161011/70fcc4b3/attachment-0001.html>


More information about the mesa-dev mailing list