Mesa (master): mesa: Use a 565 format for GL_RGB and GL_UNSIGNED_SHORT_5_6_5 textures.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Oct 5 21:31:36 UTC 2017


Module: Mesa
Branch: master
Commit: 18bdf73556440ca2eaac2d22e1e3ebe1be7b6c1d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=18bdf73556440ca2eaac2d22e1e3ebe1be7b6c1d

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Oct  4 01:08:37 2017 -0700

mesa: Use a 565 format for GL_RGB and GL_UNSIGNED_SHORT_5_6_5 textures.

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 at anholt.net>
Tested-by: Eero Tamminen <eero.t.tamminen at intel.com>

---

 src/mesa/main/texformat.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 3f8e7a49a2..13e77b77ec 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -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);




More information about the mesa-commit mailing list