etnaviv: make more use of compile_error(..)

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5690>
This commit is contained in:
Christian Gmeiner 2020-06-29 14:09:39 +02:00 committed by Marge Bot
parent 96670c8150
commit 9ae96d32dd
3 changed files with 41 additions and 8 deletions

View file

@ -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);

View file

@ -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 <jonathan@marek.ca>
*/
#ifndef H_ETNAVIV_COMPILER_NIR
#define H_ETNAVIV_COMPILER_NIR
#define compile_error(ctx, args...) ({ \
printf(args); \
ctx->error = true; \
assert(0); \
})
#endif

View file

@ -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)
{