[Cogl] [PATCH 2/2] Remove support for luminance textures

Robert Bragg robert at sixbynine.org
Thu Apr 11 10:17:29 PDT 2013


These two patches look good to land to me:

Reviewed-by: Robert Bragg <robert at linux.intel.com>

thanks,
- Robert


On Wed, Apr 10, 2013 at 4:38 PM, Neil Roberts <neil at linux.intel.com> wrote:
> Luminance textures have been removed in GL3 so it is difficult to
> support them on the GL3 driver unless we use the texture swizzle
> extension like we do for alpha textures. However, it doesn't seem like
> it would be worth the effort because we haven't yet hit a case in
> practice where alpha textures wouldn't suffice in place of luminance
> textures.
> ---
>  cogl/cogl-bitmap-conversion.c              |  1 -
>  cogl/cogl-bitmap-packing.h                 | 45 ------------------------------
>  cogl/cogl-gles2-context.c                  |  4 ---
>  cogl/cogl-types.h                          |  3 --
>  cogl/driver/gl/gl/cogl-driver-gl.c         | 11 --------
>  cogl/driver/gl/gles/cogl-driver-gles.c     |  5 ----
>  tests/conform/test-read-texture-formats.c  |  7 -----
>  tests/conform/test-write-texture-formats.c |  6 ----
>  8 files changed, 82 deletions(-)
>
> diff --git a/cogl/cogl-bitmap-conversion.c b/cogl/cogl-bitmap-conversion.c
> index 4a388d9..102bf23 100644
> --- a/cogl/cogl-bitmap-conversion.c
> +++ b/cogl/cogl-bitmap-conversion.c
> @@ -320,7 +320,6 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
>      case COGL_PIXEL_FORMAT_RGB_565:
>      case COGL_PIXEL_FORMAT_RGBA_4444:
>      case COGL_PIXEL_FORMAT_RGBA_5551:
> -    case COGL_PIXEL_FORMAT_G_8:
>      case COGL_PIXEL_FORMAT_RGB_888:
>      case COGL_PIXEL_FORMAT_BGR_888:
>      case COGL_PIXEL_FORMAT_RGBA_8888:
> diff --git a/cogl/cogl-bitmap-packing.h b/cogl/cogl-bitmap-packing.h
> index 2c714ce..47a36b9 100644
> --- a/cogl/cogl-bitmap-packing.h
> +++ b/cogl/cogl-bitmap-packing.h
> @@ -58,27 +58,6 @@ G_PASTE (_cogl_unpack_a_8_, component_size) (const uint8_t *src,
>  }
>
>  inline static void
> -G_PASTE (_cogl_unpack_g_8_, component_size) (const uint8_t *src,
> -                                             component_type *dst,
> -                                             int width)
> -{
> -  /* FIXME: I'm not sure if this is right. It looks like Nvidia and
> -     Mesa handle luminance textures differently. Maybe we should
> -     consider just removing luminance textures for Cogl 2.0 because
> -     they have been removed in GL 3.0 */
> -  while (width-- > 0)
> -    {
> -      component_type v = UNPACK_BYTE (src[0]);
> -      dst[0] = v;
> -      dst[1] = v;
> -      dst[2] = v;
> -      dst[3] = UNPACK_BYTE (255);
> -      dst += 4;
> -      src++;
> -    }
> -}
> -
> -inline static void
>  G_PASTE (_cogl_unpack_rgb_888_, component_size) (const uint8_t *src,
>                                                   component_type *dst,
>                                                   int width)
> @@ -318,9 +297,6 @@ G_PASTE (_cogl_unpack_, component_size) (CoglPixelFormat format,
>      case COGL_PIXEL_FORMAT_A_8:
>        G_PASTE (_cogl_unpack_a_8_, component_size) (src, dst, width);
>        break;
> -    case COGL_PIXEL_FORMAT_G_8:
> -      G_PASTE (_cogl_unpack_g_8_, component_size) (src, dst, width);
> -      break;
>      case COGL_PIXEL_FORMAT_RGB_888:
>        G_PASTE (_cogl_unpack_rgb_888_, component_size) (src, dst, width);
>        break;
> @@ -406,24 +382,6 @@ G_PASTE (_cogl_pack_a_8_, component_size) (const component_type *src,
>  }
>
>  inline static void
> -G_PASTE (_cogl_pack_g_8_, component_size) (const component_type *src,
> -                                           uint8_t *dst,
> -                                           int width)
> -{
> -  /* FIXME: I'm not sure if this is right. It looks like Nvidia and
> -     Mesa handle luminance textures differently. Maybe we should
> -     consider just removing luminance textures for Cogl 2.0 because
> -     they have been removed in GL 3.0 */
> -  while (width-- > 0)
> -    {
> -      component_type v = (src[0] + src[1] + src[2]) / 3;
> -      *dst = PACK_BYTE (v);
> -      src += 4;
> -      dst++;
> -    }
> -}
> -
> -inline static void
>  G_PASTE (_cogl_pack_rgb_888_, component_size) (const component_type *src,
>                                                 uint8_t *dst,
>                                                 int width)
> @@ -661,9 +619,6 @@ G_PASTE (_cogl_pack_, component_size) (CoglPixelFormat format,
>      case COGL_PIXEL_FORMAT_A_8:
>        G_PASTE (_cogl_pack_a_8_, component_size) (src, dst, width);
>        break;
> -    case COGL_PIXEL_FORMAT_G_8:
> -      G_PASTE (_cogl_pack_g_8_, component_size) (src, dst, width);
> -      break;
>      case COGL_PIXEL_FORMAT_RGB_888:
>        G_PASTE (_cogl_pack_rgb_888_, component_size) (src, dst, width);
>        break;
> diff --git a/cogl/cogl-gles2-context.c b/cogl/cogl-gles2-context.c
> index 5bc0cf4..2d0ab52 100644
> --- a/cogl/cogl-gles2-context.c
> +++ b/cogl/cogl-gles2-context.c
> @@ -291,10 +291,6 @@ copy_flipped_texture (CoglGLES2Context *gles2_ctx,
>        internal_format = COGL_PIXEL_FORMAT_A_8;
>        break;
>
> -    case GL_LUMINANCE:
> -      internal_format = COGL_PIXEL_FORMAT_G_8;
> -      break;
> -
>      default:
>        /* We can't handle this format so just give up */
>        return;
> diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h
> index 48e8488..943dbc8 100644
> --- a/cogl/cogl-types.h
> +++ b/cogl/cogl-types.h
> @@ -268,7 +268,6 @@ typedef struct _CoglColor               CoglColor;
>   * @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits
>   * @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits
>   * @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits
> - * @COGL_PIXEL_FORMAT_G_8: Single luminance component
>   * @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits
>   * @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
>   * @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
> @@ -320,8 +319,6 @@ typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
>    COGL_PIXEL_FORMAT_RGBA_5551 = (2 | COGL_BITWISE_BIT | COGL_A_BIT | COGL_FORMAT_ENUM(1)),
>    COGL_PIXEL_FORMAT_RGBA_5551_PRE = (2 | COGL_PIXEL_FORMAT_RGBA_5551 | COGL_PREMULT_BIT),
>
> -  COGL_PIXEL_FORMAT_G_8 = 1,
> -
>    COGL_PIXEL_FORMAT_RGB_888 = 3,
>    COGL_PIXEL_FORMAT_BGR_888 = (3 | COGL_BGR_BIT),
>
> diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
> index efe25c1..74cc572 100644
> --- a/cogl/driver/gl/gl/cogl-driver-gl.c
> +++ b/cogl/driver/gl/gl/cogl-driver-gl.c
> @@ -62,12 +62,6 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
>        *out_format = COGL_PIXEL_FORMAT_A_8;
>        return TRUE;
>
> -    case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8:
> -    case GL_LUMINANCE12: case GL_LUMINANCE16:
> -
> -      *out_format = COGL_PIXEL_FORMAT_G_8;
> -      return TRUE;
> -
>      case GL_RGB: case GL_RGB4: case GL_RGB5: case GL_RGB8:
>      case GL_RGB10: case GL_RGB12: case GL_RGB16: case GL_R3_G3_B2:
>
> @@ -118,11 +112,6 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
>          }
>        gltype = GL_UNSIGNED_BYTE;
>        break;
> -    case COGL_PIXEL_FORMAT_G_8:
> -      glintformat = GL_LUMINANCE;
> -      glformat = GL_LUMINANCE;
> -      gltype = GL_UNSIGNED_BYTE;
> -      break;
>
>      case COGL_PIXEL_FORMAT_RGB_888:
>        glintformat = GL_RGB;
> diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
> index cde0a68..c212232 100644
> --- a/cogl/driver/gl/gles/cogl-driver-gles.c
> +++ b/cogl/driver/gl/gles/cogl-driver-gles.c
> @@ -75,11 +75,6 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
>        glformat = GL_ALPHA;
>        gltype = GL_UNSIGNED_BYTE;
>        break;
> -    case COGL_PIXEL_FORMAT_G_8:
> -      glintformat = GL_LUMINANCE;
> -      glformat = GL_LUMINANCE;
> -      gltype = GL_UNSIGNED_BYTE;
> -      break;
>
>      case COGL_PIXEL_FORMAT_BGRA_8888:
>      case COGL_PIXEL_FORMAT_BGRA_8888_PRE:
> diff --git a/tests/conform/test-read-texture-formats.c b/tests/conform/test-read-texture-formats.c
> index b35e6f2..7a224d7 100644
> --- a/tests/conform/test-read-texture-formats.c
> +++ b/tests/conform/test-read-texture-formats.c
> @@ -156,13 +156,6 @@ test_read_texture_formats (void)
>
>    test_read_byte (tex_2d, COGL_PIXEL_FORMAT_A_8, 0x78);
>
> -#if 0
> -  /* I'm not sure what's the right value to put here because Nvidia
> -     and Mesa seem to behave differently so one of them must be
> -     wrong. */
> -  test_read_byte (tex_2d, COGL_PIXEL_FORMAT_G_8, 0x9c);
> -#endif
> -
>    test_read_short (tex_2d, COGL_PIXEL_FORMAT_RGB_565,
>                     5, 0x12, 6, 0x34, 5, 0x56,
>                     -1);
> diff --git a/tests/conform/test-write-texture-formats.c b/tests/conform/test-write-texture-formats.c
> index 9181a58..b1c2111 100644
> --- a/tests/conform/test-write-texture-formats.c
> +++ b/tests/conform/test-write-texture-formats.c
> @@ -130,12 +130,6 @@ void
>  test_write_texture_formats (void)
>  {
>    test_write_byte (COGL_PIXEL_FORMAT_A_8, 0x34, 0x00000034);
> -#if 0
> -  /* I'm not sure what's the right value to put here because Nvidia
> -     and Mesa seem to behave differently so one of them must be
> -     wrong. */
> -  test_write_byte (test_ctx, COGL_PIXEL_FORMAT_G_8, 0x34, 0x340000ff);
> -#endif
>
>    test_write_short (COGL_PIXEL_FORMAT_RGB_565, 0x0843, 0x080819ff);
>    test_write_short (COGL_PIXEL_FORMAT_RGBA_4444_PRE, 0x1234, 0x11223344);
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list