mesa: Use a 565 format for GL_RGB and GL_UNSIGNED_SHORT_5_6_5 textures.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 4 Oct 2017 08:08:37 +0000 (01:08 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 5 Oct 2017 21:30:47 +0000 (14:30 -0700)
Found while trying to optimize an application.

Not observed to help performance on i965, but should at least reduce
the memory usage of such textures a bit.

Reviewed-by: Eric Anholt <eric@anholt.net>
Tested-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/mesa/main/texformat.c

index 3f8e7a49a2782df47e3d37aa8630206848d598e1..13e77b77ecdd1aed5209355e46890a9a224c5fa4 100644 (file)
@@ -117,6 +117,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       if (type == GL_UNSIGNED_INT_2_10_10_10_REV) {
          RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM);
       }
+      if (type == GL_UNSIGNED_SHORT_5_6_5) {
+         RETURN_IF_SUPPORTED(MESA_FORMAT_B5G6R5_UNORM);
+      }
       /* fallthrough */
    case GL_RGB8:
       RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UNORM8);