Mesa (master): st/mesa: Prefer 5551 formats for GL_UNSIGNED_SHORT_5_5_5_1.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 16 20:37:16 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Sep 12 17:30:28 2019 -0700

st/mesa: Prefer 5551 formats for GL_UNSIGNED_SHORT_5_5_5_1.

Previously, internalformat GL_RGBA and type GL_UNSIGNED_SHORT_5_5_5_1
was promoted to RGBA8888 as the table entry with the 5551 formats
is listed below the 8888 entry, and it also doesn't have GL_RGBA as
a possible internalformat.

Using actual 5551 fixes the following dEQP-EGL test:
- dEQP-EGL.functional.image.modify.tex_rgb5_a1_tex_subimage_rgba8

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/state_tracker/st_format.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 5f7997c5c5a..38ea51b02cd 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -2266,6 +2266,13 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
          internalFormat = GL_RGB10_A2;
    }
 
+   if (type == GL_UNSIGNED_SHORT_5_5_5_1) {
+      if (internalFormat == GL_RGB)
+         internalFormat = GL_RGB5;
+      else if (internalFormat == GL_RGBA)
+         internalFormat = GL_RGB5_A1;
+   }
+
    /* search table for internalFormat */
    for (i = 0; i < ARRAY_SIZE(format_map); i++) {
       const struct format_mapping *mapping = &format_map[i];




More information about the mesa-commit mailing list