load_tex->src[0].type = load->dest.type = ppir_target_pipeline;
load_tex->src[0].pipeline = load->dest.pipeline = ppir_pipeline_reg_discard;
- if (ppir_node_has_single_src_succ(node)) {
- ppir_node *succ = ppir_node_first_succ(node);
- switch (succ->type) {
- case ppir_node_type_alu:
- case ppir_node_type_branch: {
- for (int i = 0; i < ppir_node_get_src_num(succ); i++) {
- ppir_src *src = ppir_node_get_src(succ, i);
- if (src->node == node) {
- /* Can consume samplers directly */
- src->type = dest->type = ppir_target_pipeline;
- src->pipeline = dest->pipeline = ppir_pipeline_reg_sampler;
- }
- }
- return true;
- }
- default:
- /* Create mov for everyone else */
- break;
- }
- }
-
- /* Create move node */
- ppir_node *move = ppir_node_insert_mov(node);
+ /* Always create move node since there can be successors in other blocks */
+ ppir_node *move = ppir_node_insert_mov_all_blocks(node);
if (unlikely(!move))
return false;
return move;
}
+ppir_node *ppir_node_insert_mov_all_blocks(ppir_node *old)
+{
+ ppir_node *move = ppir_node_insert_mov(old);
+ ppir_compiler *comp = old->block->comp;
+
+ list_for_each_entry(ppir_block, block, &comp->block_list, list) {
+ if (old->block == block)
+ continue;
+ list_for_each_entry_safe(ppir_node, node, &block->node_list, list) {
+ for (int i = 0; i < ppir_node_get_src_num(node); i++){
+ ppir_src *src = ppir_node_get_src(node, i);
+ if (!src)
+ continue;
+ if (src->node == old)
+ ppir_node_target_assign(src, move);
+ }
+ }
+ }
+
+ return move;
+}
bool ppir_node_has_single_src_succ(ppir_node *node)
{
if (list_is_singular(&node->succ_list) &&
ppir_node *ppir_node_clone(ppir_block *block, ppir_node *node);
/* Assumes that node successors are in the same block */
ppir_node *ppir_node_insert_mov(ppir_node *node);
+ppir_node *ppir_node_insert_mov_all_blocks(ppir_node *node);
static inline bool ppir_node_is_root(ppir_node *node)
{