nir: add Continue Construct to nir_loop

The added continue_list corresponds to the SPIR-V
Continue Construct and serves as a converged control-flow
construct and is executed after each continue statement
and before the next iteration of the loop body.

Also adds validation rules for loops with Continue Construct

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13962>
This commit is contained in:
Daniel Schürmann
2021-12-01 17:34:48 +01:00
committed by Marge Bot
parent e0c6ad1ce5
commit d4b97bf3fa
7 changed files with 126 additions and 19 deletions
+12
View File
@@ -1892,7 +1892,13 @@ write_loop(write_ctx *ctx, nir_loop *loop)
{
blob_write_uint8(ctx->blob, loop->control);
blob_write_uint8(ctx->blob, loop->divergent);
bool has_continue_construct = nir_loop_has_continue_construct(loop);
blob_write_uint8(ctx->blob, has_continue_construct);
write_cf_list(ctx, &loop->body);
if (has_continue_construct) {
write_cf_list(ctx, &loop->continue_list);
}
}
static void
@@ -1904,7 +1910,13 @@ read_loop(read_ctx *ctx, struct exec_list *cf_list)
loop->control = blob_read_uint8(ctx->blob);
loop->divergent = blob_read_uint8(ctx->blob);
bool has_continue_construct = blob_read_uint8(ctx->blob);
read_cf_list(ctx, &loop->body);
if (has_continue_construct) {
nir_loop_add_continue_construct(loop);
read_cf_list(ctx, &loop->continue_list);
}
}
static void