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

Courtney Goeltzenleuchter courtney at lunarg.com
Mon Nov 11 12:43:50 PST 2013


On Mon, Nov 11, 2013 at 11:15 AM, Ian Romanick <idr at freedesktop.org> wrote:

> On 11/05/2013 11:36 AM, Courtney Goeltzenleuchter wrote:
> > On Tue, Nov 5, 2013 at 12:22 PM, Ian Romanick <idr at freedesktop.org
> > <mailto:idr at freedesktop.org>> wrote:
> >
> >     On 11/05/2013 09:44 AM, Chris Forbes wrote:
> >     >> So, you can create a GL_LUMINANCE view of a GL_LUMINANCE texture.
> >      Hmm...
> >     >
> >     > My understanding is you can't actually, since views can only be
> >     > created from immutable-format textures, and GL_LUMINANCE is not a
> >     > sized internalformat, so it can't be used with TexStorage?
> >
> >     I was just using GL_LUMINANCE as shorthand for GL_LUMINANCE4,
> >     GL_LUMINANCE8, GL_LUMINANCE12, and GL_LUMINANCE16.  As far as I can
> >     tell,
> >
> >         glGenTextures(1, &tex);
> >         glBindTexture(GL_TEXTURE_2D, tex);
> >         glTexStorage2D(GL_TEXTURE_2D,
> >                     8,
> >                     GL_LUMINANCE8,
> >                     1024, 1024);
> >
> >     is perfectly valid.  Sayeth GL_ARB_texture_storage:
> >
> >         Accepted by the <internalformat> parameter of TexStorage* when
> >         implemented on OpenGL ES:
> >
> >             ALPHA8_EXT                     0x803C
> >             LUMINANCE8_EXT                 0x8040
> >             LUMINANCE8_ALPHA8_EXT          0x8045
> >
> >     I guess that means GL_LUMINANCE4, GL_LUMINANCE12, and GL_LUMINANCE16
> are
> >     out.  As are all GL_INTENSITY formats.  There are still these three
> >     legacy formats to handle.
> >
> >     So, if we support GL_ARB_texture_view in a compatibility profile,
> >
> >         glGenTextures(1, &view);
> >         glTextureView(view,
> >                     GL_TEXTURE_2D,
> >                     tex,
> >                     GL_LUMINANCE8,
> >                     1, 1, 1, 1);
> >
> >     is also valid.
> >
> >     Right?
> >
> >
> > The spec is pickier than that.  For 8bit texels the allowed internal
> > formats are: R8UI, R8I, R8, R8_SNORM
> > I use the table specified in the ARB_texture_view to translate the
> > target internalFormat passed to glTextureView into a VIEW_CLASS.
> > GL_LUMINANCE8 does not have a valid VIEW_CLASS and could not match the
> > internal format of the source texture.
>
> I don't think it matters that GL_LUMINANCE8 is missing from the table or
> that it doesn't have a VIEW_CLASS.  The GL_ARB_texture_view spec says
> (emphasis mine):
>
>    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.
>
> In my above code example, the internal formats are identical.  By my
> reading of the above quoted text, that code is legal.  We should modify
> one of the texture_view tests to use these legacy formats, and try that
> test on NVIDIA with a compatibility profile.
>

Good point. I'll talk with Jon about testing that if we don't already.

Courtney


>
> > That makes me wonder, should I be trying to map the target
> > internalformat into a driver internal format?
> >
> > Courtney
> >
> > --
> > Courtney Goeltzenleuchter
> > LunarG
>
>


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


More information about the mesa-dev mailing list