From: Kenneth Graunke Date: Wed, 13 Nov 2019 07:12:54 +0000 (-0800) Subject: mesa: Handle GL_COLOR_INDEX in _mesa_format_from_format_and_type(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69f109cc37fff6300ea9e1914779620b7a117bf9;p=mesa.git 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 --- 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: