mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
nir: add nir_block::divergent to indicate a divergent entry condition
to be used by nir_opt_varyings Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28049>
This commit is contained in:
parent
936690f733
commit
813f37a8ed
4 changed files with 17 additions and 1 deletions
|
|
@ -2904,6 +2904,11 @@ typedef struct nir_block {
|
|||
/** generic block index; generated by nir_index_blocks */
|
||||
unsigned index;
|
||||
|
||||
/* This indicates whether the block or any parent block is executed
|
||||
* conditionally and whether the condition uses a divergent value.
|
||||
*/
|
||||
bool divergent;
|
||||
|
||||
/*
|
||||
* Each block can only have up to 2 successors, so we put them in a simple
|
||||
* array - no need for anything more complicated.
|
||||
|
|
|
|||
|
|
@ -889,6 +889,14 @@ visit_block(nir_block *block, struct divergence_state *state)
|
|||
}
|
||||
}
|
||||
|
||||
bool divergent = state->divergent_loop_cf ||
|
||||
state->divergent_loop_continue ||
|
||||
state->divergent_loop_break;
|
||||
if (divergent != block->divergent) {
|
||||
block->divergent = divergent;
|
||||
has_changed = true;
|
||||
}
|
||||
|
||||
return has_changed;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2067,7 +2067,8 @@ print_block(nir_block *block, print_state *state, unsigned tabs)
|
|||
state->padding_for_no_dest = 0;
|
||||
|
||||
print_indentation(tabs, fp);
|
||||
fprintf(fp, "block b%u:", block->index);
|
||||
fprintf(fp, "%s block b%u:",
|
||||
block->divergent ? "div" : "con", block->index);
|
||||
|
||||
const bool empty_block = exec_list_is_empty(&block->instr_list);
|
||||
if (empty_block) {
|
||||
|
|
|
|||
|
|
@ -1696,6 +1696,7 @@ static void
|
|||
write_block(write_ctx *ctx, const nir_block *block)
|
||||
{
|
||||
write_add_object(ctx, block);
|
||||
blob_write_uint8(ctx->blob, block->divergent);
|
||||
blob_write_uint32(ctx->blob, exec_list_length(&block->instr_list));
|
||||
|
||||
ctx->last_instr_type = ~0;
|
||||
|
|
@ -1718,6 +1719,7 @@ read_block(read_ctx *ctx, struct exec_list *cf_list)
|
|||
exec_node_data(nir_block, exec_list_get_tail(cf_list), cf_node.node);
|
||||
|
||||
read_add_object(ctx, block);
|
||||
block->divergent = blob_read_uint8(ctx->blob);
|
||||
unsigned num_instrs = blob_read_uint32(ctx->blob);
|
||||
for (unsigned i = 0; i < num_instrs;) {
|
||||
i += read_instr(ctx, block);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue