aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2020-06-29 14:09:39 +0200
committerMarge Bot <[email protected]>2020-07-02 17:04:46 +0000
commit9ae96d32dd899cd560bfcdb613fbbbc0091591fa (patch)
treedfc0f67078d446cf706deee098cdea5a93daf896
parent96670c8150239b74dfc44c17b1a60e255a301275 (diff)
etnaviv: make more use of compile_error(..)
Signed-off-by: Christian Gmeiner <[email protected]> Acked-by: Jonathan Marek <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5690>
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c6
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler_nir.h36
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_compiler_nir_emit.h7
3 files changed, 41 insertions, 8 deletions
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 <[email protected]>
+ */
+
+#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)
{