From: Vasily Khoruzhick Date: Sun, 1 Sep 2019 17:21:32 +0000 (-0700) Subject: lima/ppir: don't assume that load coords gets value from register X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e23fd2c3751500a64ef40bbc64cd2cb4bd7345f9;p=mesa.git lima/ppir: don't assume that load coords gets value from register It can load value from varying directly as well. Also load_regs is the only op that has a source, so add src_num field to load node and set it accordingly. Reviewed-by: Erico Nunes Signed-off-by: Vasily Khoruzhick --- diff --git a/src/gallium/drivers/lima/ir/pp/codegen.c b/src/gallium/drivers/lima/ir/pp/codegen.c index f08f83a9f43..8dac09bd471 100644 --- a/src/gallium/drivers/lima/ir/pp/codegen.c +++ b/src/gallium/drivers/lima/ir/pp/codegen.c @@ -94,14 +94,15 @@ static void ppir_codegen_encode_varying(ppir_node *node, void *code) f->reg.dest = index >> 2; f->reg.mask = dest->write_mask << (index & 0x3); - f->reg.source_type = 1; - - ppir_src *src = &load->src; - index = ppir_target_get_src_reg_index(src); - f->reg.source = index >> 2; - f->reg.negate = src->negate; - f->reg.absolute = src->absolute; - f->reg.swizzle = encode_swizzle(src->swizzle, index & 0x3, 0); + if (load->num_src) { + f->reg.source_type = 1; + ppir_src *src = &load->src; + index = ppir_target_get_src_reg_index(src); + f->reg.source = index >> 2; + f->reg.negate = src->negate; + f->reg.absolute = src->absolute; + f->reg.swizzle = encode_swizzle(src->swizzle, index & 0x3, 0); + } } } diff --git a/src/gallium/drivers/lima/ir/pp/lower.c b/src/gallium/drivers/lima/ir/pp/lower.c index e49b20e8c7e..ee63912a1b7 100644 --- a/src/gallium/drivers/lima/ir/pp/lower.c +++ b/src/gallium/drivers/lima/ir/pp/lower.c @@ -147,6 +147,7 @@ static bool ppir_lower_texture(ppir_block *block, ppir_node *node) load->dest.pipeline = ppir_pipeline_reg_discard; load->src = load_tex->src_coords; + load->num_src = 1; ppir_node_foreach_pred_safe(node, dep) { ppir_node *pred = dep->pred; diff --git a/src/gallium/drivers/lima/ir/pp/ppir.h b/src/gallium/drivers/lima/ir/pp/ppir.h index ec649e4afa9..cdacad01c1f 100644 --- a/src/gallium/drivers/lima/ir/pp/ppir.h +++ b/src/gallium/drivers/lima/ir/pp/ppir.h @@ -248,6 +248,7 @@ typedef struct { int num_components; ppir_dest dest; ppir_src src; + int num_src; } ppir_load_node; typedef struct { @@ -457,8 +458,9 @@ static inline int ppir_node_get_src_num(ppir_node *node) return ppir_node_to_alu(node)->num_src; case ppir_node_type_branch: return ppir_node_to_branch(node)->num_src; - case ppir_node_type_load_texture: case ppir_node_type_load: + return ppir_node_to_load(node)->num_src; + case ppir_node_type_load_texture: case ppir_node_type_store: return 1; default: