From: Mike Blumenkrantz Date: Wed, 10 Jun 2020 15:09:47 +0000 (-0400) Subject: zink: handle ntv case of nested loop instructions more permissively X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97ec109d8fa07c02531c9f54b7edf7085d6130bf;p=mesa.git 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: --- 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 095b8e08fcf..b80f09ccccd 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);