Mesa (master): zink: handle ntv case of nested loop instructions more permissively
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jul 13 21:25:35 UTC 2020
Module: Mesa
Branch: master
Commit: 97ec109d8fa07c02531c9f54b7edf7085d6130bf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=97ec109d8fa07c02531c9f54b7edf7085d6130bf
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Wed Jun 10 11:09:47 2020 -0400
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 at glsl-vs-continue-in-switch-in-do-while
Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5852>
---
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 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);
More information about the mesa-commit
mailing list