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

Eduardo Lima Mitev elima at igalia.com
Tue Mar 24 23:45:02 PDT 2015


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



More information about the mesa-dev mailing list