[Mesa-dev] [PATCH 1/3] mesa: Improve validation of target, format and type of glTexSubImage[2, 3]D

Laura Ekstrand laura at jlekstrand.net
Wed Mar 25 08:28:54 PDT 2015


With your modifications in this patch, the target is already validated by
the time you get to this function, so it should be fine to move mesa select
tex image up above the format and type checks.
On Mar 24, 2015 11:44 PM, "Eduardo Lima Mitev" <elima at igalia.com> wrote:

> On 03/25/2015 12:02 AM, Laura Ekstrand wrote:
> >     >     +   if (_mesa_is_gles3(ctx)) {
> >     >     +      /* Validation of format and type for ES3 has to be done
> here
> >     >     +       * after the texture image is resolved, because the
> internal
> >     >     +       * format is needed for the verification
> >     >     +       */
> >     >     +      err = _mesa_es3_error_check_format_and_type(ctx,
> format, type,
> >     >     +
> >     >     texImage->InternalFormat);
> >     >     +      if (err != GL_NO_ERROR) {
> >     >     +         _mesa_error(ctx, err,
> >     >     +                     "%s(incompatible format = %s, type = %s,
> "
> >     >     +                     "internalformat = %s)",
> >     >     +                     callerName,
> _mesa_lookup_enum_by_nr(format),
> >     >     +                     _mesa_lookup_enum_by_nr(type),
> >     >     +
> >     >      _mesa_lookup_enum_by_nr(texImage->InternalFormat));
> >     >     +         return GL_TRUE;
> >     >     +      }
> >     >     +   }
> >     >     +
> >
> >
> > What does the (es)_error_check_format_and_type have to do with
> > validating the target?  I thought legal_texsubimage_target did all of
> > the target checking?  So if we move up _mesa_select_tex_image above the
> > format and type checks, it shouldn't be a problem because the target is
> > already checked.  (That's my understanding of the problem.)
>
> _mesa_es3_error_check_format_and_type() takes the tex object's internal
> format as argument, because gles3 impose additional restrictions that
> depend on the internal format.
>
> So, to check format and type for gles3 case, we need to have texIamge,
> and to obtain it, we first need to validate the target (otherwise we get
> the _mesa_problem() call we are trying to avoid here).
>
> That's why gles3 validation of format and type indirectly depends on
> having the target validated.
>
> cheers,
> Eduardo
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150325/0e882068/attachment.html>


More information about the mesa-dev mailing list