nir: add function in/outs to variable modes

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31137>
This commit is contained in:
Timothy Arceri
2024-08-15 11:06:08 +10:00
committed by Marge Bot
parent f3da074dc3
commit 6ff3e87e5f
2 changed files with 14 additions and 10 deletions
+10 -6
View File
@@ -195,13 +195,17 @@ typedef enum {
nir_var_mem_node_payload = (1 << 12),
nir_var_mem_node_payload_in = (1 << 13),
nir_var_function_in = (1 << 14),
nir_var_function_out = (1 << 15),
nir_var_function_inout = (1 << 16),
/* Generic modes intentionally come last. See encode_dref_modes() in
* nir_serialize.c for more details.
*/
nir_var_shader_temp = (1 << 14),
nir_var_function_temp = (1 << 15),
nir_var_mem_shared = (1 << 16),
nir_var_mem_global = (1 << 17),
nir_var_shader_temp = (1 << 17),
nir_var_function_temp = (1 << 18),
nir_var_mem_shared = (1 << 19),
nir_var_mem_global = (1 << 20),
nir_var_mem_generic = (nir_var_shader_temp |
nir_var_function_temp |
@@ -219,7 +223,7 @@ typedef enum {
nir_var_mem_shared | nir_var_mem_global |
nir_var_mem_push_const | nir_var_mem_task_payload |
nir_var_shader_out | nir_var_system_value,
nir_num_variable_modes = 18,
nir_num_variable_modes = 21,
nir_var_all = (1 << nir_num_variable_modes) - 1,
} nir_variable_mode;
MESA_DEFINE_CPP_ENUM_BITFIELD_OPERATORS(nir_variable_mode)
@@ -486,7 +490,7 @@ typedef struct nir_variable {
*
* :c:struct:`nir_variable_mode`
*/
unsigned mode : 18;
unsigned mode : 21;
/**
* Is the variable read-only?
+4 -4
View File
@@ -537,8 +537,8 @@ union packed_instr {
unsigned instr_type : 4;
unsigned deref_type : 3;
unsigned cast_type_same_as_last : 1;
unsigned modes : 5; /* See (de|en)code_deref_modes() */
unsigned _pad : 9;
unsigned modes : 6; /* See (de|en)code_deref_modes() */
unsigned _pad : 8;
unsigned in_bounds : 1;
unsigned packed_src_ssa_16bit : 1; /* deref_var redefines this */
unsigned def : 8;
@@ -832,7 +832,7 @@ read_alu(read_ctx *ctx, union packed_instr header)
}
#define NUM_GENERIC_MODES 4
#define MODE_ENC_GENERIC_BIT (1 << 4)
#define MODE_ENC_GENERIC_BIT (1 << 5)
static nir_variable_mode
decode_deref_modes(unsigned modes)
@@ -853,7 +853,7 @@ encode_deref_modes(nir_variable_mode modes)
* case, we need the full bitfield. Fortunately, there are only 4 of
* these. For all other modes, we can only have one mode at a time so we
* can compress them by only storing the bit position. This, plus one bit
* to select encoding, lets us pack the entire bitfield in 5 bits.
* to select encoding, lets us pack the entire bitfield in 6 bits.
*/
/* Assert that the modes we are compressing fit along with the generic bit