Bug 39991 - [regression]GL_PALETTE8_RGBA8_OES format of glCompressedTexImage2D will cause err GL_INVALID_ENUM with GLES1.x
Summary: [regression]GL_PALETTE8_RGBA8_OES format of glCompressedTexImage2D will cause...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i915 (show other bugs)
Version: git
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-10 22:18 UTC by Jin Yang
Modified: 2011-09-19 10:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jin Yang 2011-08-10 22:18:49 UTC
My program works fine with 7.9.2 and fails with 7.10.3.
In mesa 7.10.3, in teximage.c it will call _mesa_CompressedTexImage2DARB->
-> compressedteximage --> compressed_texture_error_check-->_mesa_is_compressed_format
, it will return error because format GL_PALETTE8_RGBA8_OES, then will not goto FEATURE_ES.

{
   error = compressed_texture_error_check(ctx, dims, target, level,
                                          internalFormat, width, height, depth,
                                          border, imageSize, &reason);

   if (error) {
      _mesa_error(ctx, error, "glCompressedTexImage%uD(%s)", dims, reason);
      return;
   }

#if FEATURE_ES
   /* XXX this is kind of a hack */
   if (dims == 2) {
      switch (internalFormat) {
      case GL_PALETTE4_RGB8_OES:
      case GL_PALETTE4_RGBA8_OES:
      case GL_PALETTE4_R5_G6_B5_OES:
      case GL_PALETTE4_RGBA4_OES:
      case GL_PALETTE4_RGB5_A1_OES:
      case GL_PALETTE8_RGB8_OES:
      case GL_PALETTE8_RGBA8_OES:
      case GL_PALETTE8_R5_G6_B5_OES:
      case GL_PALETTE8_RGBA4_OES:
      case GL_PALETTE8_RGB5_A1_OES:
         _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
                                          width, height, imageSize, data);
         return;
      }
   }
}

In mesa 7.9.2, it will call _mesa_CompressedTexImage2DARB, and just goto _mesa_cpal_compressed_teximage2d and do the right thing.

 _mesa_CompressedTexImage2DARB {
   GET_CURRENT_CONTEXT(ctx);
   ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);

   if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
      _mesa_debug(ctx, "glCompressedTexImage2DARB %s %d %s %d %d %d %d %p\n",
                  _mesa_lookup_enum_by_nr(target), level,
                  _mesa_lookup_enum_by_nr(internalFormat),
                  width, height, border, imageSize, data);

#if FEATURE_ES
   switch (internalFormat) {
   case GL_PALETTE4_RGB8_OES:
   case GL_PALETTE4_RGBA8_OES:
   case GL_PALETTE4_R5_G6_B5_OES:
   case GL_PALETTE4_RGBA4_OES:
   case GL_PALETTE4_RGB5_A1_OES:
   case GL_PALETTE8_RGB8_OES:
   case GL_PALETTE8_RGBA8_OES:
   case GL_PALETTE8_R5_G6_B5_OES:
   case GL_PALETTE8_RGBA4_OES:
   case GL_PALETTE8_RGB5_A1_OES:
      _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
				       width, height, imageSize, data);
      return;
   }
#endif
}
Comment 1 Ian Romanick 2011-08-16 14:42:37 UTC
We do not and never have supported that extension.  If an application uses that extension without first checking for it, that application is broken.
Comment 2 Jin Yang 2011-08-16 18:18:51 UTC
Why this function works in Mesa 7.9.2. And from the code we can see it support GL_PALETTE8_RGBA8_OES if FEATURE_ES.
From OpenGLES.1x spec, this function and texture format is not extension and should be at least supported:
http://www.khronos.org/opengles/documentation/opengles1_0/html/glCompressedTexImage2D.html

(In reply to comment #1)
> We do not and never have supported that extension.  If an application uses that
> extension without first checking for it, that application is broken.
Comment 3 Ian Romanick 2011-08-16 19:18:14 UTC
Wow.  I can't believe how broken OpenGL ES 1.x is.  I also have a hard time caring.
Comment 4 Ian Romanick 2011-08-16 19:27:49 UTC
(In reply to comment #0)
> My program works fine with 7.9.2 and fails with 7.10.3.
> In mesa 7.10.3, in teximage.c it will call _mesa_CompressedTexImage2DARB->
> -> compressedteximage -->
> compressed_texture_error_check-->_mesa_is_compressed_format
> , it will return error because format GL_PALETTE8_RGBA8_OES, then will not goto
> FEATURE_ES.
> 
> {
>    error = compressed_texture_error_check(ctx, dims, target, level,
>                                           internalFormat, width, height, depth,
>                                           border, imageSize, &reason);
> 
>    if (error) {
>       _mesa_error(ctx, error, "glCompressedTexImage%uD(%s)", dims, reason);
>       return;
>    }
> 
> #if FEATURE_ES
>    /* XXX this is kind of a hack */
>    if (dims == 2) {

Can you set a breakpoint here and give a full backtrace (i.e., 'bt full' in gdb)?  OpenGL ES 1.x only supports 2D textures, so dims should always be 2 here.

>       switch (internalFormat) {
>       case GL_PALETTE4_RGB8_OES:
>       case GL_PALETTE4_RGBA8_OES:
>       case GL_PALETTE4_R5_G6_B5_OES:
>       case GL_PALETTE4_RGBA4_OES:
>       case GL_PALETTE4_RGB5_A1_OES:
>       case GL_PALETTE8_RGB8_OES:
>       case GL_PALETTE8_RGBA8_OES:
>       case GL_PALETTE8_R5_G6_B5_OES:
>       case GL_PALETTE8_RGBA4_OES:
>       case GL_PALETTE8_RGB5_A1_OES:
>          _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
>                                           width, height, imageSize, data);
>          return;
>       }
>    }
> }
Comment 5 Jin Yang 2011-08-16 20:01:02 UTC
The full backtrace at that line is as follow, please note for project reason, frame below 2 is not attached:
[New Thread 0xa99a7b70 (LWP 32077)]
3203	   error = compressed_texture_error_check(ctx, dims, target, level,
(gdb) bt full
#0  compressedteximage (ctx=0xaeb3e8e0, dims=2, target=3553, level=0, internalFormat=35734, width=32, height=32, depth=1, border=0, imageSize=2048, 
    data=0xa9ddaf20) at main/teximage.c:3203
        error = 6606796
        __FUNCTION__ = "compressedteximage"
        __PRETTY_FUNCTION__ = "compressedteximage"
#1  0xaad769cb in _mesa_CompressedTexImage2DARB (target=3553, level=0, internalFormat=35734, width=32, height=32, border=0, imageSize=2048, data=0xa9ddaf20)
    at main/teximage.c:3364
        ctx = 0xaeb3e8e0
#2  0xaad8fee9 in _es_CompressedTexImage2D (target=3553, level=0, internalFormat=35734, width=32, height=32, border=0, imageSize=2048, data=0xa9ddaf20)
    at main/api_exec_es1.c:650

The dims is 2. Thanks!

(In reply to comment #4)
> (In reply to comment #0)
> > My program works fine with 7.9.2 and fails with 7.10.3.
> > In mesa 7.10.3, in teximage.c it will call _mesa_CompressedTexImage2DARB->
> > -> compressedteximage -->
> > compressed_texture_error_check-->_mesa_is_compressed_format
> > , it will return error because format GL_PALETTE8_RGBA8_OES, then will not goto
> > FEATURE_ES.
> > 
> > {
> >    error = compressed_texture_error_check(ctx, dims, target, level,
> >                                           internalFormat, width, height, depth,
> >                                           border, imageSize, &reason);
> > 
> >    if (error) {
> >       _mesa_error(ctx, error, "glCompressedTexImage%uD(%s)", dims, reason);
> >       return;
> >    }
> > 
> > #if FEATURE_ES
> >    /* XXX this is kind of a hack */
> >    if (dims == 2) {
> 
> Can you set a breakpoint here and give a full backtrace (i.e., 'bt full' in
> gdb)?  OpenGL ES 1.x only supports 2D textures, so dims should always be 2
> here.
> 
> >       switch (internalFormat) {
> >       case GL_PALETTE4_RGB8_OES:
> >       case GL_PALETTE4_RGBA8_OES:
> >       case GL_PALETTE4_R5_G6_B5_OES:
> >       case GL_PALETTE4_RGBA4_OES:
> >       case GL_PALETTE4_RGB5_A1_OES:
> >       case GL_PALETTE8_RGB8_OES:
> >       case GL_PALETTE8_RGBA8_OES:
> >       case GL_PALETTE8_R5_G6_B5_OES:
> >       case GL_PALETTE8_RGBA4_OES:
> >       case GL_PALETTE8_RGB5_A1_OES:
> >          _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
> >                                           width, height, imageSize, data);
> >          return;
> >       }
> >    }
> > }
Comment 6 Jin Yang 2011-09-11 23:06:36 UTC
The Key point is that in compression format check function:
compressed_texture_error_check
there is no support for ES and will return error.
Actually it does support in Mesa, see code block if #FEATURE_ES.

In verison 7.9.2, there is no format check funcion:compressed_texture_error_check
and it will goto code block if #FEATURE_ES.

Waiting for your reply,
Thanks
(In reply to comment #5)
> The full backtrace at that line is as follow, please note for project reason,
> frame below 2 is not attached:
> [New Thread 0xa99a7b70 (LWP 32077)]
> 3203       error = compressed_texture_error_check(ctx, dims, target, level,
> (gdb) bt full
> #0  compressedteximage (ctx=0xaeb3e8e0, dims=2, target=3553, level=0,
> internalFormat=35734, width=32, height=32, depth=1, border=0, imageSize=2048, 
>     data=0xa9ddaf20) at main/teximage.c:3203
>         error = 6606796
>         __FUNCTION__ = "compressedteximage"
>         __PRETTY_FUNCTION__ = "compressedteximage"
> #1  0xaad769cb in _mesa_CompressedTexImage2DARB (target=3553, level=0,
> internalFormat=35734, width=32, height=32, border=0, imageSize=2048,
> data=0xa9ddaf20)
>     at main/teximage.c:3364
>         ctx = 0xaeb3e8e0
> #2  0xaad8fee9 in _es_CompressedTexImage2D (target=3553, level=0,
> internalFormat=35734, width=32, height=32, border=0, imageSize=2048,
> data=0xa9ddaf20)
>     at main/api_exec_es1.c:650
> 
> The dims is 2. Thanks!
> 
> (In reply to comment #4)
> > (In reply to comment #0)
> > > My program works fine with 7.9.2 and fails with 7.10.3.
> > > In mesa 7.10.3, in teximage.c it will call _mesa_CompressedTexImage2DARB->
> > > -> compressedteximage -->
> > > compressed_texture_error_check-->_mesa_is_compressed_format
> > > , it will return error because format GL_PALETTE8_RGBA8_OES, then will not goto
> > > FEATURE_ES.
> > > 
> > > {
> > >    error = compressed_texture_error_check(ctx, dims, target, level,
> > >                                           internalFormat, width, height, depth,
> > >                                           border, imageSize, &reason);
> > > 
> > >    if (error) {
> > >       _mesa_error(ctx, error, "glCompressedTexImage%uD(%s)", dims, reason);
> > >       return;
> > >    }
> > > 
> > > #if FEATURE_ES
> > >    /* XXX this is kind of a hack */
> > >    if (dims == 2) {
> > 
> > Can you set a breakpoint here and give a full backtrace (i.e., 'bt full' in
> > gdb)?  OpenGL ES 1.x only supports 2D textures, so dims should always be 2
> > here.
> > 
> > >       switch (internalFormat) {
> > >       case GL_PALETTE4_RGB8_OES:
> > >       case GL_PALETTE4_RGBA8_OES:
> > >       case GL_PALETTE4_R5_G6_B5_OES:
> > >       case GL_PALETTE4_RGBA4_OES:
> > >       case GL_PALETTE4_RGB5_A1_OES:
> > >       case GL_PALETTE8_RGB8_OES:
> > >       case GL_PALETTE8_RGBA8_OES:
> > >       case GL_PALETTE8_R5_G6_B5_OES:
> > >       case GL_PALETTE8_RGBA4_OES:
> > >       case GL_PALETTE8_RGB5_A1_OES:
> > >          _mesa_cpal_compressed_teximage2d(target, level, internalFormat,
> > >                                           width, height, imageSize, data);
> > >          return;
> > >       }
> > >    }
> > > }
Comment 7 Ian Romanick 2011-09-13 15:45:08 UTC
I just posted a patch series to the mesa-dev mailing list that should fix this issue.  Could you verify it?  It is also available in a branch in my personal GIT repo.

   git://anongit.freedesktop.org/~idr/mesa.git compressed_paletted_texture
Comment 8 Jin Yang 2011-09-14 19:11:33 UTC
(In reply to comment #7)
> I just posted a patch series to the mesa-dev mailing list that should fix this
> issue.  Could you verify it?  It is also available in a branch in my personal
> GIT repo.
>    git://anongit.freedesktop.org/~idr/mesa.git compressed_paletted_texture

Verified, it works, thanks!
Comment 9 Ian Romanick 2011-09-19 10:05:52 UTC
This should be fixed as of commit 3ebbfc8372d410801c799b3eb7821075dae73b17 in Mesa master.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.