From e9e1a448727105cf4938cc7e5276f65ebb778beb Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 6 Jan 2022 17:52:15 +0000 Subject: [PATCH] nir/builder: set write mask if not provided MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zero isn't really a valid write mask. If it's provided, use a full write mask. Signed-off-by: Rhys Perry Reviewed-by: Timur Kristóf Reviewed-by: Emma Anholt Part-of: --- src/compiler/nir/nir_builder_opcodes_h.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py index 7fc6af9c776..f26c6aa3313 100644 --- a/src/compiler/nir/nir_builder_opcodes_h.py +++ b/src/compiler/nir/nir_builder_opcodes_h.py @@ -123,6 +123,10 @@ _nir_build_${name}(nir_builder *build${intrinsic_decl_list(opcode)}) % for i in range(opcode.num_srcs): intrin->src[${i}] = nir_src_for_ssa(src${i}); % endfor + % if WRITE_MASK in opcode.indices and 0 in opcode.src_components: + if (!indices.write_mask) + indices.write_mask = BITFIELD_MASK(intrin->num_components); + % endif % for index in opcode.indices: nir_intrinsic_set_${index.name}(intrin, indices.${index.name}); % endfor @@ -154,7 +158,7 @@ _nir_build_${name}(build${intrinsic_macro_list(opcode)}, (struct _nir_${name}_in #endif /* _NIR_BUILDER_OPCODES_ */""" from nir_opcodes import opcodes -from nir_intrinsics import INTR_OPCODES +from nir_intrinsics import INTR_OPCODES, WRITE_MASK from mako.template import Template -print(Template(template).render(opcodes=opcodes, INTR_OPCODES=INTR_OPCODES)) +print(Template(template).render(opcodes=opcodes, INTR_OPCODES=INTR_OPCODES, WRITE_MASK=WRITE_MASK))