[Mesa-dev] [PATCH] main: return error if asking for GL_TEXTURE_BORDER_COLOR in TEXTURE_2D_MULTISAMPLE{_ARRAY} through TexParameterI{i, ui}v()

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Nov 15 06:41:49 UTC 2016


On Mon, 2016-11-14 at 20:05 -0800, Kenneth Graunke wrote:
> On Monday, November 7, 2016 11:49:13 AM PST Samuel Iglesias Gonsálvez
> wrote:
> > OpenGL ES 3.2 says in section 8.10. "TEXTURE PARAMETERS", at the
> > end of
> > the section:
> > 
> > "An INVALID_ENUM error is generated if target is TEXTURE_2D_-
> > MULTISAMPLE or TEXTURE_2D_MULTISAMPLE_ARRAY , and pname is any
> > sampler state from table 21.12."
> > 
> > GL_TEXTURE_BORDER_COLOR is present in that table.
> > 
> > Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98250
> > ---
> >  src/mesa/main/texparam.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> > index 29eed07..ae96bd8 100644
> > --- a/src/mesa/main/texparam.c
> > +++ b/src/mesa/main/texparam.c
> > @@ -974,6 +974,10 @@ _mesa_texture_parameterIiv(struct gl_context
> > *ctx,
> >  {
> >     switch (pname) {
> >     case GL_TEXTURE_BORDER_COLOR:
> > +      if (!_mesa_target_allows_setting_sampler_parameters(texObj-
> > >Target)) {
> > +         _mesa_error(ctx, GL_INVALID_ENUM,
> > "glTextureParameterIiv(texture)");
> > +         return;
> > +      }
> >        FLUSH_VERTICES(ctx, _NEW_TEXTURE);
> >        /* set the integer-valued border color */
> >        COPY_4V(texObj->Sampler.BorderColor.i, params);
> > @@ -992,6 +996,10 @@ _mesa_texture_parameterIuiv(struct gl_context
> > *ctx,
> >  {
> >     switch (pname) {
> >     case GL_TEXTURE_BORDER_COLOR:
> > +      if (!_mesa_target_allows_setting_sampler_parameters(texObj-
> > >Target)) {
> > +         _mesa_error(ctx, GL_INVALID_ENUM,
> > "glTextureParameterIuiv(texture)");
> > +         return;
> > +      }
> >        FLUSH_VERTICES(ctx, _NEW_TEXTURE);
> >        /* set the unsigned integer-valued border color */
> >        COPY_4V(texObj->Sampler.BorderColor.ui, params);
> > 
> 
> You need to add this check in _mesa_texture_parameteriv as well.
> 
> - glTexParameterfv: already checks this (confirms we need this) :)
> - glTexParameterIiv: fixed by your patch
> - glTexParameterIuiv: fixed by your patch
> - glTexParameteriv: needs the error check also.
> 
> With that fixed, this is:
> Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

OK, thanks!

Sam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161115/eea2866e/attachment.sig>


More information about the mesa-dev mailing list