diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-05-16 23:42:33 +0000 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-05-16 23:42:33 +0000 |
commit | c65271c9292441bb43b0959970b3342d4301780b (patch) | |
tree | ae8ad5b1aef837a7f627577bbea03affe72cb407 | |
parent | 629806b55bccd7f3e5b7b753820c4442fdb30bbe (diff) |
panfrost: assert(0) -> unreachable for some switch
Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 35 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_format.c | 14 |
2 files changed, 18 insertions, 31 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index c4bb57d782e..635d0cfa44a 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -438,8 +438,7 @@ translate_tex_wrap(enum pipe_tex_wrap w) return MALI_WRAP_MIRRORED_REPEAT; default: - assert(0); - return 0; + unreachable("Invalid wrap"); } } @@ -454,8 +453,7 @@ translate_tex_filter(enum pipe_tex_filter f) return MALI_LINEAR; default: - assert(0); - return 0; + unreachable("Invalid filter"); } } @@ -492,10 +490,10 @@ panfrost_translate_compare_func(enum pipe_compare_func in) case PIPE_FUNC_ALWAYS: return MALI_FUNC_ALWAYS; - } - assert (0); - return 0; /* Unreachable */ + default: + unreachable("Invalid func"); + } } static unsigned @@ -525,10 +523,10 @@ panfrost_translate_alt_compare_func(enum pipe_compare_func in) case PIPE_FUNC_ALWAYS: return MALI_ALT_FUNC_ALWAYS; - } - assert (0); - return 0; /* Unreachable */ + default: + unreachable("Invalid alt func"); + } } static unsigned @@ -558,10 +556,10 @@ panfrost_translate_stencil_op(enum pipe_stencil_op in) case PIPE_STENCIL_OP_INVERT: return MALI_STENCIL_INVERT; - } - assert (0); - return 0; /* Unreachable */ + default: + unreachable("Invalid stencil op"); + } } static void @@ -1200,8 +1198,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) break; default: - DBG("Unknown shader stage %d in uniform upload\n", i); - assert(0); + unreachable("Invalid shader stage\n"); } /* Also attach the same buffer as a UBO for extended access */ @@ -1432,9 +1429,7 @@ g2m_draw_mode(enum pipe_prim_type mode) DEFINE_CASE(POLYGON); default: - DBG("Illegal draw mode %d\n", mode); - assert(0); - return MALI_LINE_LOOP; + unreachable("Invalid draw mode"); } } @@ -1454,9 +1449,7 @@ panfrost_translate_index_size(unsigned size) return MALI_DRAW_INDEXED_UINT32; default: - DBG("Unknown index size %d\n", size); - assert(0); - return 0; + unreachable("Invalid index size"); } } diff --git a/src/gallium/drivers/panfrost/pan_format.c b/src/gallium/drivers/panfrost/pan_format.c index a61d7b19a55..5f75a065861 100644 --- a/src/gallium/drivers/panfrost/pan_format.c +++ b/src/gallium/drivers/panfrost/pan_format.c @@ -53,8 +53,7 @@ panfrost_translate_swizzle(enum pipe_swizzle s) return MALI_CHANNEL_ONE; default: - assert(0); - return 0; + unreachable("INvalid swizzle"); } } @@ -100,9 +99,7 @@ panfrost_translate_channel_width(unsigned size) case 32: return MALI_CHANNEL_32; default: - fprintf(stderr, "Unknown width %d\n", size); - assert(0); - return 0; + unreachable("Invalid width"); } } @@ -128,8 +125,7 @@ panfrost_translate_channel_type(unsigned type, unsigned size, bool norm) { } default: - assert(0); - return 0; + unreachable("Invalid type"); } } @@ -232,9 +228,7 @@ panfrost_find_format(const struct util_format_description *desc) break; default: - fprintf(stderr, "Unknown format type in %s\n", desc->name); - assert(0); - break; + unreachable("Invalid format type"); } return (enum mali_format) format; |