nir/lower_io: Allow for a full bitmask of modes
Acked-by: Eric Anholt <eric@anholt.net> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
This commit is contained in:
@@ -2198,7 +2198,7 @@ void nir_assign_var_locations(struct exec_list *var_list,
|
|||||||
int (*type_size)(const struct glsl_type *));
|
int (*type_size)(const struct glsl_type *));
|
||||||
|
|
||||||
void nir_lower_io(nir_shader *shader,
|
void nir_lower_io(nir_shader *shader,
|
||||||
nir_variable_mode mode,
|
nir_variable_mode modes,
|
||||||
int (*type_size)(const struct glsl_type *));
|
int (*type_size)(const struct glsl_type *));
|
||||||
nir_src *nir_get_io_offset_src(nir_intrinsic_instr *instr);
|
nir_src *nir_get_io_offset_src(nir_intrinsic_instr *instr);
|
||||||
nir_src *nir_get_io_vertex_index_src(nir_intrinsic_instr *instr);
|
nir_src *nir_get_io_vertex_index_src(nir_intrinsic_instr *instr);
|
||||||
|
@@ -38,7 +38,7 @@ struct lower_io_state {
|
|||||||
nir_builder builder;
|
nir_builder builder;
|
||||||
void *mem_ctx;
|
void *mem_ctx;
|
||||||
int (*type_size)(const struct glsl_type *type);
|
int (*type_size)(const struct glsl_type *type);
|
||||||
nir_variable_mode mode;
|
nir_variable_mode modes;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -245,7 +245,7 @@ nir_lower_io_block(nir_block *block, void *void_state)
|
|||||||
|
|
||||||
nir_variable_mode mode = intrin->variables[0]->var->data.mode;
|
nir_variable_mode mode = intrin->variables[0]->var->data.mode;
|
||||||
|
|
||||||
if (state->mode != nir_var_all && state->mode != mode)
|
if ((state->modes & mode) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mode != nir_var_shader_in &&
|
if (mode != nir_var_shader_in &&
|
||||||
@@ -388,14 +388,14 @@ nir_lower_io_block(nir_block *block, void *void_state)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
nir_lower_io_impl(nir_function_impl *impl,
|
nir_lower_io_impl(nir_function_impl *impl,
|
||||||
nir_variable_mode mode,
|
nir_variable_mode modes,
|
||||||
int (*type_size)(const struct glsl_type *))
|
int (*type_size)(const struct glsl_type *))
|
||||||
{
|
{
|
||||||
struct lower_io_state state;
|
struct lower_io_state state;
|
||||||
|
|
||||||
nir_builder_init(&state.builder, impl);
|
nir_builder_init(&state.builder, impl);
|
||||||
state.mem_ctx = ralloc_parent(impl);
|
state.mem_ctx = ralloc_parent(impl);
|
||||||
state.mode = mode;
|
state.modes = modes;
|
||||||
state.type_size = type_size;
|
state.type_size = type_size;
|
||||||
|
|
||||||
nir_foreach_block(impl, nir_lower_io_block, &state);
|
nir_foreach_block(impl, nir_lower_io_block, &state);
|
||||||
@@ -405,12 +405,12 @@ nir_lower_io_impl(nir_function_impl *impl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nir_lower_io(nir_shader *shader, nir_variable_mode mode,
|
nir_lower_io(nir_shader *shader, nir_variable_mode modes,
|
||||||
int (*type_size)(const struct glsl_type *))
|
int (*type_size)(const struct glsl_type *))
|
||||||
{
|
{
|
||||||
nir_foreach_function(shader, function) {
|
nir_foreach_function(shader, function) {
|
||||||
if (function->impl)
|
if (function->impl)
|
||||||
nir_lower_io_impl(function->impl, mode, type_size);
|
nir_lower_io_impl(function->impl, modes, type_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user