From: Christian Gmeiner Date: Mon, 29 Jun 2020 12:09:39 +0000 (+0200) Subject: etnaviv: make more use of compile_error(..) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ae96d32dd899cd560bfcdb613fbbbc0091591fa;p=mesa.git etnaviv: make more use of compile_error(..) Signed-off-by: Christian Gmeiner Acked-by: Jonathan Marek Part-of: --- diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c index 5fcd8763980..f6bfa1c1af7 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c @@ -27,6 +27,7 @@ */ #include "etnaviv_compiler.h" +#include "etnaviv_compiler_nir.h" #include "etnaviv_asm.h" #include "etnaviv_context.h" #include "etnaviv_debug.h" @@ -225,7 +226,8 @@ etna_emit_alu(struct etna_compile *c, nir_op op, struct etna_inst_dst dst, struct etna_op_info ei = etna_ops[op]; unsigned swiz_scalar = INST_SWIZ_BROADCAST(ffs(dst.write_mask) - 1); - assert(ei.opcode != 0xff); + if (ei.opcode == 0xff) + compile_error(c, "Unhandled ALU op: %s\n", nir_op_infos[op].name); struct etna_inst inst = { .opcode = ei.opcode, @@ -309,7 +311,7 @@ etna_emit_tex(struct etna_compile *c, nir_texop op, unsigned texid, unsigned dst case nir_texop_txb: inst.opcode = INST_OPCODE_TEXLDB; break; case nir_texop_txl: inst.opcode = INST_OPCODE_TEXLDL; break; default: - assert(0); + compile_error(c, "Unhandled NIR tex type: %d\n", op); } emit_inst(c, &inst); diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h new file mode 100644 index 00000000000..9b79af44969 --- /dev/null +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020 Etnaviv Project + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sub license, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Jonathan Marek + */ + +#ifndef H_ETNAVIV_COMPILER_NIR +#define H_ETNAVIV_COMPILER_NIR + +#define compile_error(ctx, args...) ({ \ + printf(args); \ + ctx->error = true; \ + assert(0); \ +}) + +#endif diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h index e93834584e6..fecbaafac0b 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h @@ -26,6 +26,7 @@ #include "etnaviv_asm.h" #include "etnaviv_context.h" +#include "etnaviv_compiler_nir.h" #include "compiler/nir/nir.h" #include "compiler/nir/nir_builder.h" @@ -62,12 +63,6 @@ struct state { unsigned num_nodes; }; -#define compile_error(ctx, args...) ({ \ - printf(args); \ - ctx->error = true; \ - assert(0); \ -}) - static inline hw_src src_swizzle(hw_src src, unsigned swizzle) {