glsl/lower_vector_derefs: Don't emit conditional assignments
Use if-statements instead. Any hardware that supports this sort of tessellation has flow control, so it will probably emit the conditional assignment using an if-statement anyway. This is definitely what st_glsl_to_nir does. v2: Fix copy-and-paste bug in the ir_type_swizzle handling. This bug caused segfaults in tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-vec4-swiz-index-wr.shader_test. Reviewed-by: Matt Turner <mattst88@gmail.com> [v1] Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14573>
This commit is contained in:
@@ -112,18 +112,17 @@ vector_deref_visitor::visit_enter(ir_assignment *ir)
|
||||
|
||||
if (new_lhs->ir_type != ir_type_swizzle) {
|
||||
assert(lhs_clone->as_dereference());
|
||||
ir_assignment *cond_assign =
|
||||
new(mem_ctx) ir_assignment(lhs_clone->as_dereference(),
|
||||
src_temp_deref,
|
||||
equal(arr_index, cmp_index),
|
||||
WRITEMASK_X << i);
|
||||
factory.emit(cond_assign);
|
||||
|
||||
factory.emit(if_tree(equal(arr_index, cmp_index),
|
||||
assign(lhs_clone->as_dereference(),
|
||||
src_temp_deref,
|
||||
WRITEMASK_X << i)));
|
||||
} else {
|
||||
ir_assignment *cond_assign =
|
||||
new(mem_ctx) ir_assignment(swizzle(lhs_clone, i, 1),
|
||||
src_temp_deref,
|
||||
equal(arr_index, cmp_index));
|
||||
factory.emit(cond_assign);
|
||||
src_temp_deref);
|
||||
|
||||
factory.emit(if_tree(equal(arr_index, cmp_index), cond_assign));
|
||||
}
|
||||
}
|
||||
ir->insert_after(factory.instructions);
|
||||
|
Reference in New Issue
Block a user