From 97ec109d8fa07c02531c9f54b7edf7085d6130bf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 10 Jun 2020 11:09:47 -0400 Subject: [PATCH] zink: handle ntv case of nested loop instructions more permissively if the last instruction in a loop's body terminates a block, e.g., from a nested loop with a jump as its final instruction, then no block will have been started when returning to the original loop, and there's no need to emit a branch fixes shaders@glsl-vs-continue-in-switch-in-do-while Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c index 095b8e0..b80f09c 100644 --- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c +++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c @@ -2119,7 +2119,9 @@ emit_loop(struct ntv_context *ctx, nir_loop *loop) ctx->loop_break = save_break; ctx->loop_cont = save_cont; - branch(ctx, cont_id); + /* loop->body may have already ended our block */ + if (ctx->block_started) + branch(ctx, cont_id); start_block(ctx, cont_id); branch(ctx, header_id); -- 2.7.4