nir: add support for user defined select control

This will allow us to make use of the selection control support in
spirv and the GL support provided by EXT_control_flow_attributes.

Note this only supports if-statements as we dont support switches
in NIR.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108841
This commit is contained in:
Timothy Arceri
2019-03-20 15:42:56 +11:00
parent 24037ff228
commit e76ae39ae2
4 changed files with 21 additions and 1 deletions

View File

@@ -1902,9 +1902,16 @@ nir_block_ends_in_jump(nir_block *block)
#define nir_foreach_instr_reverse_safe(instr, block) \
foreach_list_typed_reverse_safe(nir_instr, instr, node, &(block)->instr_list)
typedef enum {
nir_selection_control_none = 0x0,
nir_selection_control_flatten = 0x1,
nir_selection_control_dont_flatten = 0x2,
} nir_selection_control;
typedef struct nir_if {
nir_cf_node cf_node;
nir_src condition;
nir_selection_control control;
struct exec_list then_list; /** < list of nir_cf_node */
struct exec_list else_list; /** < list of nir_cf_node */