mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 00:20:09 +01:00
spirv: Handle SpvOpTerminateInvocation
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7150>
This commit is contained in:
parent
4dfd292307
commit
886d2d1a9a
2 changed files with 12 additions and 0 deletions
|
|
@ -255,6 +255,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
case SpvOpBranchConditional:
|
||||
case SpvOpSwitch:
|
||||
case SpvOpKill:
|
||||
case SpvOpTerminateInvocation:
|
||||
case SpvOpReturn:
|
||||
case SpvOpReturnValue:
|
||||
case SpvOpUnreachable:
|
||||
|
|
@ -690,6 +691,10 @@ vtn_process_block(struct vtn_builder *b,
|
|||
block->branch_type = vtn_branch_type_discard;
|
||||
return NULL;
|
||||
|
||||
case SpvOpTerminateInvocation:
|
||||
block->branch_type = vtn_branch_type_terminate;
|
||||
return NULL;
|
||||
|
||||
case SpvOpBranchConditional: {
|
||||
struct vtn_value *cond_val = vtn_untyped_value(b, block->branch[1]);
|
||||
vtn_fail_if(!cond_val->type ||
|
||||
|
|
@ -951,6 +956,12 @@ vtn_emit_branch(struct vtn_builder *b, enum vtn_branch_type branch_type,
|
|||
nir_builder_instr_insert(&b->nb, &discard->instr);
|
||||
break;
|
||||
}
|
||||
case vtn_branch_type_terminate: {
|
||||
nir_intrinsic_instr *terminate =
|
||||
nir_intrinsic_instr_create(b->nb.shader, nir_intrinsic_terminate);
|
||||
nir_builder_instr_insert(&b->nb, &terminate->instr);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
vtn_fail("Invalid branch type");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ enum vtn_branch_type {
|
|||
vtn_branch_type_loop_continue,
|
||||
vtn_branch_type_loop_back_edge,
|
||||
vtn_branch_type_discard,
|
||||
vtn_branch_type_terminate,
|
||||
vtn_branch_type_return,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue