From 3e186af5e2a386173569de64b16c4fd859762ab4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 1 Jul 2019 16:34:23 -0700 Subject: [PATCH] mesa: Port format_pack/unpack off of _mesa_problem(). unreachable() should be plenty of debug for these. Reviewed-by: Thomas Helland Reviewed-by: Kristian H. Kristensen --- src/mesa/main/format_pack.py | 28 +++++++++----------------- src/mesa/main/format_unpack.py | 36 ++++++++-------------------------- 2 files changed, 17 insertions(+), 47 deletions(-) diff --git a/src/mesa/main/format_pack.py b/src/mesa/main/format_pack.py index 19cec2032b8..893a0647f27 100644 --- a/src/mesa/main/format_pack.py +++ b/src/mesa/main/format_pack.py @@ -44,7 +44,6 @@ string = """/* #include #include "config.h" -#include "errors.h" #include "format_pack.h" #include "format_utils.h" #include "macros.h" @@ -539,9 +538,7 @@ _mesa_get_pack_float_z_func(mesa_format format) case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return pack_float_Z_FLOAT32; default: - _mesa_problem(NULL, - "unexpected format in _mesa_get_pack_float_z_func()"); - return NULL; + unreachable("unexpected format in _mesa_get_pack_float_z_func()"); } } @@ -618,8 +615,7 @@ _mesa_get_pack_uint_z_func(mesa_format format) case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return pack_uint_Z_FLOAT32; default: - _mesa_problem(NULL, "unexpected format in _mesa_get_pack_uint_z_func()"); - return NULL; + unreachable("unexpected format in _mesa_get_pack_uint_z_func()"); } } @@ -676,9 +672,7 @@ _mesa_get_pack_ubyte_stencil_func(mesa_format format) case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return pack_ubyte_stencil_Z32_FLOAT_X24S8; default: - _mesa_problem(NULL, - "unexpected format in _mesa_pack_ubyte_stencil_func()"); - return NULL; + unreachable("unexpected format in _mesa_pack_ubyte_stencil_func()"); } } @@ -752,7 +746,7 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, } break; default: - _mesa_problem(NULL, "unexpected format in _mesa_pack_float_z_row()"); + unreachable("unexpected format in _mesa_pack_float_z_row()"); } } @@ -828,7 +822,7 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, } break; default: - _mesa_problem(NULL, "unexpected format in _mesa_pack_uint_z_row()"); + unreachable("unexpected format in _mesa_pack_uint_z_row()"); } } @@ -875,7 +869,7 @@ _mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, } break; default: - _mesa_problem(NULL, "unexpected format in _mesa_pack_ubyte_stencil_row()"); + unreachable("unexpected format in _mesa_pack_ubyte_stencil_row()"); } } @@ -915,9 +909,7 @@ _mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, } break; default: - _mesa_problem(NULL, "bad format %s in _mesa_pack_ubyte_s_row", - _mesa_get_format_name(format)); - return; + unreachable("bad format in _mesa_pack_ubyte_s_row"); } } @@ -985,14 +977,12 @@ _mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) } } else { - _mesa_problem(NULL, "unexpected size in _mesa_pack_colormask()"); - return; + unreachable("unexpected size in _mesa_pack_colormask()"); } } break; default: - _mesa_problem(NULL, "unexpected format data type in gen_color_mask()"); - return; + unreachable("unexpected format data type in gen_color_mask()"); } } """ diff --git a/src/mesa/main/format_unpack.py b/src/mesa/main/format_unpack.py index c254b74149c..d99cedb7907 100644 --- a/src/mesa/main/format_unpack.py +++ b/src/mesa/main/format_unpack.py @@ -43,7 +43,6 @@ string = """/* #include -#include "errors.h" #include "format_unpack.h" #include "format_utils.h" #include "macros.h" @@ -333,9 +332,7 @@ _mesa_unpack_rgba_row(mesa_format format, GLuint n, unpack_float_ycbcr_rev(src, dst, n); break; default: - _mesa_problem(NULL, "%s: bad format %s", __func__, - _mesa_get_format_name(format)); - return; + unreachable("bad format"); } } @@ -402,9 +399,7 @@ _mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, break; %endfor default: - _mesa_problem(NULL, "%s: bad format %s", __func__, - _mesa_get_format_name(format)); - return; + unreachable("bad format"); } } @@ -552,9 +547,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, unpack = unpack_float_z_Z32X24S8; break; default: - _mesa_problem(NULL, "bad format %s in _mesa_unpack_float_z_row", - _mesa_get_format_name(format)); - return; + unreachable("bad format in _mesa_unpack_float_z_row"); } unpack(n, src, dst); @@ -657,9 +650,7 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, unpack = unpack_uint_Z_FLOAT32_X24S8; break; default: - _mesa_problem(NULL, "bad format %s in _mesa_unpack_uint_z_row", - _mesa_get_format_name(format)); - return; + unreachable("bad format %s in _mesa_unpack_uint_z_row"); } unpack(srcPtr, dst, n); @@ -720,9 +711,7 @@ _mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, unpack_ubyte_s_Z32_FLOAT_S8X24_UINT(src, dst, n); break; default: - _mesa_problem(NULL, "bad format %s in _mesa_unpack_ubyte_s_row", - _mesa_get_format_name(format)); - return; + unreachable("bad format %s in _mesa_unpack_ubyte_s_row"); } } @@ -777,10 +766,7 @@ _mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, unpack_uint_24_8_depth_stencil_Z32_S8X24(src, dst, n); break; default: - _mesa_problem(NULL, - "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row", - _mesa_get_format_name(format)); - return; + unreachable("bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row"); } } @@ -854,10 +840,7 @@ _mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, unpack_float_32_uint_24_8_Z32_FLOAT_S8X24_UINT(src, dst, n); break; default: - _mesa_problem(NULL, - "bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row", - _mesa_get_format_name(format)); - return; + unreachable("bad format %s in _mesa_unpack_uint_24_8_depth_stencil_row"); } } @@ -882,10 +865,7 @@ _mesa_unpack_depth_stencil_row(mesa_format format, GLuint n, _mesa_unpack_float_32_uint_24_8_depth_stencil_row(format, n, src, dst); break; default: - _mesa_problem(NULL, - "bad type 0x%x in _mesa_unpack_depth_stencil_row", - type); - return; + unreachable("bad type 0x%x in _mesa_unpack_depth_stencil_row"); } } """ -- 2.30.2