X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fcompiler%2Fglsl%2Fopt_tree_grafting.cpp;h=6b5d93af66162380fef12003d3cdf560ecb9acc6;hb=5d2b2b59c451915c0b11184ae47c0673fdff3146;hp=28b6e1856e8bd605d30f33532be729987fe57933;hpb=fd249c803e3ae2acb83f5e3b7152728e73228b7b;p=mesa.git diff --git a/src/compiler/glsl/opt_tree_grafting.cpp b/src/compiler/glsl/opt_tree_grafting.cpp index 28b6e1856e8..6b5d93af661 100644 --- a/src/compiler/glsl/opt_tree_grafting.cpp +++ b/src/compiler/glsl/opt_tree_grafting.cpp @@ -232,7 +232,7 @@ ir_tree_grafting_visitor::visit_enter(ir_call *ir) ir_visitor_status ir_tree_grafting_visitor::visit_enter(ir_expression *ir) { - for (unsigned int i = 0; i < ir->get_num_operands(); i++) { + for (unsigned int i = 0; i < ir->num_operands; i++) { if (do_graft(&ir->operands[i])) return visit_stop; } @@ -371,6 +371,17 @@ tree_grafting_basic_block(ir_instruction *bb_first, if (lhs_var->data.precise) continue; + /* Do not graft sampler and image variables. This is a workaround to + * st/glsl_to_tgsi being unable to handle expression parameters to image + * intrinsics. + * + * Note that if this is ever fixed, we still need to skip grafting when + * any image layout qualifiers (including the image format) are set, + * since we must not lose those. + */ + if (lhs_var->type->is_sampler() || lhs_var->type->is_image()) + continue; + ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var); if (!entry->declaration ||