From c8554f849e4102a78a9f6ab371b7492d7b25af62 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Mon, 7 Oct 2019 20:11:46 -0700 Subject: [PATCH] lima/ppir: don't clone texture loads Cloning texture loads isn't a good idea since we may move it into a block that is not shared between all the invocations of the shader. We'd like to avoid that since it may result in undefined behavior. Reviewed-by: Andreas Baierl Signed-off-by: Vasily Khoruzhick --- src/gallium/drivers/lima/ir/pp/nir.c | 7 --- src/gallium/drivers/lima/ir/pp/node.c | 66 --------------------------- 2 files changed, 73 deletions(-) diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c index c254035b3fb..260db1e35af 100644 --- a/src/gallium/drivers/lima/ir/pp/nir.c +++ b/src/gallium/drivers/lima/ir/pp/nir.c @@ -106,13 +106,6 @@ static void ppir_node_add_src(ppir_compiler *comp, ppir_node *node, case ppir_op_const: child = ppir_node_clone(node->block, child); break; - case ppir_op_load_texture: - /* Clone texture loads for each block */ - if (child->block != node->block) { - child = ppir_node_clone(node->block, child); - comp->var_nodes[ns->ssa->index] = child; - } - break; case ppir_op_load_varying: if ((node->op != ppir_op_load_texture)) { /* Clone varying loads for each block */ diff --git a/src/gallium/drivers/lima/ir/pp/node.c b/src/gallium/drivers/lima/ir/pp/node.c index 29627c71ca0..92f09c8929a 100644 --- a/src/gallium/drivers/lima/ir/pp/node.c +++ b/src/gallium/drivers/lima/ir/pp/node.c @@ -622,70 +622,6 @@ static ppir_node *ppir_node_clone_const(ppir_block *block, ppir_node *node) return &new_cnode->node; } -static ppir_node * -ppir_node_clone_tex(ppir_block *block, ppir_node *node) -{ - ppir_load_texture_node *tex_node = ppir_node_to_load_texture(node); - ppir_node *tex_coords = tex_node->src_coords.node; - - ppir_node *new_tex_coords = NULL; - - ppir_load_texture_node *new_tnode = ppir_node_create(block, ppir_op_load_texture, -1, 0); - if (!new_tnode) - return NULL; - - list_addtail(&new_tnode->node.list, &block->node_list); - - if (tex_coords) { - switch (tex_coords->op) { - case ppir_op_load_varying: - case ppir_op_load_coords: - new_tex_coords = ppir_node_clone(block, tex_coords); - assert(new_tex_coords); - break; - default: - new_tex_coords = tex_coords; - break; - } - } - - ppir_dest *dest = ppir_node_get_dest(node); - new_tnode->dest = *dest; - - new_tnode->sampler_dim = tex_node->sampler_dim; - - for (int i = 0; i < 4; i++) - new_tnode->src_coords.swizzle[i] = tex_node->src_coords.swizzle[i]; - - for (int i = 0; i < ppir_node_get_src_num(node); i++) { - ppir_src *src = ppir_node_get_src(node, i); - ppir_src *new_src = ppir_node_get_src(&new_tnode->node, i); - switch (src->type) { - case ppir_target_ssa: { - ppir_node_target_assign(new_src, new_tex_coords); - ppir_node_add_dep(&new_tnode->node, new_tex_coords, ppir_dep_src); - break; - } - case ppir_target_register: { - new_src->type = src->type; - new_src->reg = src->reg; - new_src->node = NULL; - break; - } - case ppir_target_pipeline: { - new_src->type = src->type; - new_src->pipeline = src->pipeline; - break; - } - default: - /* pipeline is not expected here */ - assert(0); - } - } - - return &new_tnode->node; -} - static ppir_node * ppir_node_clone_load(ppir_block *block, ppir_node *node) { @@ -730,8 +666,6 @@ ppir_node *ppir_node_clone(ppir_block *block, ppir_node *node) switch (node->op) { case ppir_op_const: return ppir_node_clone_const(block, node); - case ppir_op_load_texture: - return ppir_node_clone_tex(block, node); case ppir_op_load_uniform: case ppir_op_load_varying: case ppir_op_load_temp: -- 2.30.2