[Mesa-dev] [PATCH] mesa: Add ARB_texture_view to Mesa core

Courtney Goeltzenleuchter courtney at lunarg.com
Tue Nov 5 10:44:26 PST 2013


On Tue, Nov 5, 2013 at 9:40 AM, Ian Romanick <idr at freedesktop.org> wrote:

> On 11/04/2013 03:34 PM, Courtney Goeltzenleuchter wrote:
> >
> > On Fri, Nov 1, 2013 at 1:42 PM, Ian Romanick <idr at freedesktop.org
> > <mailto:idr at freedesktop.org>> wrote:
> >
> >     On 11/01/2013 09:54 AM, Courtney Goeltzenleuchter wrote:
> >     > @@ -1746,11 +1770,37 @@ _mesa_GetTexParameteriv( GLenum target,
> >     GLenum pname, GLint *params )
> >     >           break;
> >     >
> >     >        case GL_TEXTURE_IMMUTABLE_LEVELS:
> >     > -         if (!_mesa_is_gles3(ctx))
> >     > +         if (!_mesa_is_gles3(ctx)
> >     > +             && !_mesa_is_desktop_gl(ctx)
> >     > +             && !ctx->Extensions.ARB_texture_view)
> >
> >     This if-statement will never evaluate to true because at least one of
> >     _mesa_is_gles3 or _mesa_is_desktop_gl will be false.
> >
> >
> > The intent - as I understand it - is to only return
> > GL_TEXTURE_IMMUTABLE_LEVELS if we are being called using a context that
> > can support it. How about:
> > if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_texture_view)
> >    *params = obj->ImmutableLevels;
> > else
> >    goto invalid_pname;
> >
> > Does that protect GL_TEXTURE_IMMUTABLE_LEVELS properly?
>
> No... it still lets it slip through in OpenGL ES 1.x. :)
>
>    if (!_mesa_is_gles3(ctx) &&
>        !(_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
>       goto invalid_pname;
>
The !'s make my brain hurt.

This should be equivalent to:
 if (_mesa_is_gles3(ctx) || (_mesa_is_desktop_gl(ctx) &&
ctx->Extensions.ARB_texture_view)) {
      return param
 } else {
   goto invalid_pname
}

In English, if this is a gles3 context or this is a desktop context that
supports ARB_texture_view you can get the value of TEXTURE_IMMUTABLE_LEVELS.
If this is not a gles3 context, it's not sufficient to just support the
ARB_texture_view extension, this has to be a desktop context for this glGet
to succeed.

That makes me wonder about the other ARB_texture_view texture parameters.
I.e.
case GL_TEXTURE_VIEW_MIN_LEVEL:
         if (!ctx->Extensions.ARB_texture_view)
            goto invalid_pname;
         *params = (GLint) obj->MinLevel;

Is it sufficient to allow the query any time the extension is supported
regardless of the context?


> I'm also debating whether or not we should expose this compatibility
> profiles.  The extension spec doesn't mention anything about legacy
> texture formats (luminance, etc.).  I haven't looked at the OpenGL 4.3
> Compatibility Profile spec yet.  The only relevant text in the extension
> spec is:
>
>     "The two textures' internal formats must be compatible according
>     to Table 3.X.2 (Compatible internal formats for TextureView) if
>     the internal format exists in that table and the internal
>     formats must be identical if not in that table, or else an
>     INVALID_OPERATION error is generated."
>
> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.  Hmm...
>
>


-- 
Courtney Goeltzenleuchter
LunarG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131105/1aee78db/attachment.html>


More information about the mesa-dev mailing list