Mesa (main): agx: Handle loop { if { loop { .. } } }
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 22 21:44:31 UTC 2022
Module: Mesa
Branch: main
Commit: 76981e5615fae277dd2f2ed0b6f2a455bd7d5fc1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=76981e5615fae277dd2f2ed0b6f2a455bd7d5fc1
Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date: Sat Jun 11 19:57:38 2022 -0400
agx: Handle loop { if { loop { .. } } }
We need to push loop nesting to handle this correctly -- at the end of
the innermost loop, the correct nesting is 1 (from the if), not 0.
Fixes assertion failure in
dEQP-GLES2.functional.shaders.struct.local.dynamic_loop_nested_struct_array_fragment,UnexpectedPass
dEQP-GLES2.functional.shaders.struct.local.dynamic_loop_nested_struct_array_vertex,UnexpectedPass
dEQP-GLES2.functional.shaders.struct.uniform.dynamic_loop_nested_struct_array_fragment,UnexpectedPass
dEQP-GLES2.functional.shaders.struct.uniform.dynamic_loop_nested_struct_array_vertex,UnexpectedPass
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17128>
---
src/asahi/compiler/agx_compile.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index e787ddfc1a4..321c2d437ca 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -1206,7 +1206,8 @@ emit_if(agx_context *ctx, nir_if *nif)
static void
emit_loop(agx_context *ctx, nir_loop *nloop)
{
- /* We only track nesting within the innermost loop, so reset */
+ /* We only track nesting within the innermost loop, so push and reset */
+ unsigned pushed_nesting = ctx->loop_nesting;
ctx->loop_nesting = 0;
agx_block *popped_break = ctx->break_block;
@@ -1246,6 +1247,9 @@ emit_loop(agx_context *ctx, nir_loop *nloop)
/* All nested control flow must have finished */
assert(ctx->loop_nesting == 0);
+
+ /* Restore loop nesting (we might be inside an if inside an outer loop) */
+ ctx->loop_nesting = pushed_nesting;
}
/* Before the first control flow structure, the nesting counter (r0l) needs to
More information about the mesa-commit
mailing list