Mesa (master): mesa: Handle GL_COLOR_INDEX in _mesa_format_from_format_and_type().

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 15 20:53:54 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Nov 12 23:12:54 2019 -0800

mesa: Handle GL_COLOR_INDEX in _mesa_format_from_format_and_type().

Just return MESA_FORMAT_NONE to avoid triggering unreachable; there's
really no sensible thing to return for this case anyway.

This prevents regressions in the next commit, which makes st/mesa
start using this function to find a reasonable format from GL format
and type enums.

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

---

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

diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index c450ffc8ed7..5709b983067 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -3566,6 +3566,9 @@ _mesa_format_from_format_and_type(GLenum format, GLenum type)
    bool normalized = false, is_float = false, is_signed = false;
    int num_channels = 0, type_size = 0;
 
+   if (format == GL_COLOR_INDEX)
+      return MESA_FORMAT_NONE;
+
    /* Extract array format type information from the OpenGL data type */
    switch (type) {
    case GL_UNSIGNED_BYTE:




More information about the mesa-commit mailing list