nir: rename nir_var_function to nir_var_function_temp
Signed-off-by: Karol Herbst <kherbst@redhat.com> Acked-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
@@ -1946,7 +1946,7 @@ static LLVMValueRef visit_load_var(struct ac_nir_context *ctx,
|
|||||||
values[chan] = ctx->abi->inputs[idx + chan + const_index * stride];
|
values[chan] = ctx->abi->inputs[idx + chan + const_index * stride];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nir_var_function:
|
case nir_var_function_temp:
|
||||||
for (unsigned chan = 0; chan < ve; chan++) {
|
for (unsigned chan = 0; chan < ve; chan++) {
|
||||||
if (indir_index) {
|
if (indir_index) {
|
||||||
unsigned count = glsl_count_attribute_slots(
|
unsigned count = glsl_count_attribute_slots(
|
||||||
@@ -2078,7 +2078,7 @@ visit_store_var(struct ac_nir_context *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nir_var_function:
|
case nir_var_function_temp:
|
||||||
for (unsigned chan = 0; chan < 8; chan++) {
|
for (unsigned chan = 0; chan < 8; chan++) {
|
||||||
if (!(writemask & (1 << chan)))
|
if (!(writemask & (1 << chan)))
|
||||||
continue;
|
continue;
|
||||||
@@ -4146,7 +4146,7 @@ ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class chip_class)
|
|||||||
* See the following thread for more details of the problem:
|
* See the following thread for more details of the problem:
|
||||||
* https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html
|
* https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html
|
||||||
*/
|
*/
|
||||||
indirect_mask |= nir_var_function;
|
indirect_mask |= nir_var_function_temp;
|
||||||
|
|
||||||
nir_lower_indirect_derefs(nir, indirect_mask);
|
nir_lower_indirect_derefs(nir, indirect_mask);
|
||||||
}
|
}
|
||||||
|
@@ -126,8 +126,8 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively,
|
|||||||
do {
|
do {
|
||||||
progress = false;
|
progress = false;
|
||||||
|
|
||||||
NIR_PASS(progress, shader, nir_split_array_vars, nir_var_function);
|
NIR_PASS(progress, shader, nir_split_array_vars, nir_var_function_temp);
|
||||||
NIR_PASS(progress, shader, nir_shrink_vec_array_vars, nir_var_function);
|
NIR_PASS(progress, shader, nir_shrink_vec_array_vars, nir_var_function_temp);
|
||||||
|
|
||||||
NIR_PASS_V(shader, nir_lower_vars_to_ssa);
|
NIR_PASS_V(shader, nir_lower_vars_to_ssa);
|
||||||
NIR_PASS_V(shader, nir_lower_pack);
|
NIR_PASS_V(shader, nir_lower_pack);
|
||||||
@@ -267,7 +267,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* of the function and not at the top of its caller.
|
||||||
*/
|
*/
|
||||||
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function);
|
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp);
|
||||||
NIR_PASS_V(nir, nir_lower_returns);
|
NIR_PASS_V(nir, nir_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
NIR_PASS_V(nir, nir_opt_deref);
|
||||||
@@ -329,7 +329,7 @@ radv_shader_compile_to_nir(struct radv_device *device,
|
|||||||
nir_split_var_copies(nir);
|
nir_split_var_copies(nir);
|
||||||
|
|
||||||
nir_lower_global_vars_to_local(nir);
|
nir_lower_global_vars_to_local(nir);
|
||||||
nir_remove_dead_variables(nir, nir_var_function);
|
nir_remove_dead_variables(nir, nir_var_function_temp);
|
||||||
nir_lower_subgroups(nir, &(struct nir_lower_subgroups_options) {
|
nir_lower_subgroups(nir, &(struct nir_lower_subgroups_options) {
|
||||||
.subgroup_size = 64,
|
.subgroup_size = 64,
|
||||||
.ballot_bit_size = 64,
|
.ballot_bit_size = 64,
|
||||||
|
@@ -326,12 +326,12 @@ nir_visitor::visit(ir_variable *ir)
|
|||||||
if (is_global)
|
if (is_global)
|
||||||
var->data.mode = nir_var_shader_temp;
|
var->data.mode = nir_var_shader_temp;
|
||||||
else
|
else
|
||||||
var->data.mode = nir_var_function;
|
var->data.mode = nir_var_function_temp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ir_var_function_in:
|
case ir_var_function_in:
|
||||||
case ir_var_const_in:
|
case ir_var_const_in:
|
||||||
var->data.mode = nir_var_function;
|
var->data.mode = nir_var_function_temp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ir_var_shader_in:
|
case ir_var_shader_in:
|
||||||
@@ -460,7 +460,7 @@ nir_visitor::visit(ir_variable *ir)
|
|||||||
|
|
||||||
var->interface_type = ir->get_interface_type();
|
var->interface_type = ir->get_interface_type();
|
||||||
|
|
||||||
if (var->data.mode == nir_var_function)
|
if (var->data.mode == nir_var_function_temp)
|
||||||
nir_function_impl_add_variable(impl, var);
|
nir_function_impl_add_variable(impl, var);
|
||||||
else
|
else
|
||||||
nir_shader_add_variable(shader, var);
|
nir_shader_add_variable(shader, var);
|
||||||
@@ -654,7 +654,7 @@ nir_visitor::visit(ir_return *ir)
|
|||||||
if (ir->value != NULL) {
|
if (ir->value != NULL) {
|
||||||
nir_deref_instr *ret_deref =
|
nir_deref_instr *ret_deref =
|
||||||
nir_build_deref_cast(&b, nir_load_param(&b, 0),
|
nir_build_deref_cast(&b, nir_load_param(&b, 0),
|
||||||
nir_var_function, ir->value->type, 0);
|
nir_var_function_temp, ir->value->type, 0);
|
||||||
|
|
||||||
nir_ssa_def *val = evaluate_rvalue(ir->value);
|
nir_ssa_def *val = evaluate_rvalue(ir->value);
|
||||||
nir_store_deref(&b, ret_deref, val, ~0);
|
nir_store_deref(&b, ret_deref, val, ~0);
|
||||||
@@ -2261,7 +2261,7 @@ nir_visitor::visit(ir_dereference_variable *ir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->deref = nir_build_deref_cast(&b, nir_load_param(&b, i),
|
this->deref = nir_build_deref_cast(&b, nir_load_param(&b, i),
|
||||||
nir_var_function, ir->type, 0);
|
nir_var_function_temp, ir->type, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -125,7 +125,7 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
|
|||||||
assert(!"invalid mode");
|
assert(!"invalid mode");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nir_var_function:
|
case nir_var_function_temp:
|
||||||
assert(!"nir_shader_add_variable cannot be used for local variables");
|
assert(!"nir_shader_add_variable cannot be used for local variables");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ nir_local_variable_create(nir_function_impl *impl,
|
|||||||
nir_variable *var = rzalloc(impl->function->shader, nir_variable);
|
nir_variable *var = rzalloc(impl->function->shader, nir_variable);
|
||||||
var->name = ralloc_strdup(var, name);
|
var->name = ralloc_strdup(var, name);
|
||||||
var->type = type;
|
var->type = type;
|
||||||
var->data.mode = nir_var_function;
|
var->data.mode = nir_var_function_temp;
|
||||||
|
|
||||||
nir_function_impl_add_variable(impl, var);
|
nir_function_impl_add_variable(impl, var);
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ typedef enum {
|
|||||||
nir_var_shader_in = (1 << 0),
|
nir_var_shader_in = (1 << 0),
|
||||||
nir_var_shader_out = (1 << 1),
|
nir_var_shader_out = (1 << 1),
|
||||||
nir_var_shader_temp = (1 << 2),
|
nir_var_shader_temp = (1 << 2),
|
||||||
nir_var_function = (1 << 3),
|
nir_var_function_temp = (1 << 3),
|
||||||
nir_var_uniform = (1 << 4),
|
nir_var_uniform = (1 << 4),
|
||||||
nir_var_ubo = (1 << 5),
|
nir_var_ubo = (1 << 5),
|
||||||
nir_var_system_value = (1 << 6),
|
nir_var_system_value = (1 << 6),
|
||||||
@@ -441,7 +441,7 @@ typedef struct nir_variable {
|
|||||||
static inline bool
|
static inline bool
|
||||||
nir_variable_is_global(const nir_variable *var)
|
nir_variable_is_global(const nir_variable *var)
|
||||||
{
|
{
|
||||||
return var->data.mode != nir_var_function;
|
return var->data.mode != nir_var_function_temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct nir_register {
|
typedef struct nir_register {
|
||||||
@@ -2324,7 +2324,7 @@ void nir_shader_add_variable(nir_shader *shader, nir_variable *var);
|
|||||||
static inline void
|
static inline void
|
||||||
nir_function_impl_add_variable(nir_function_impl *impl, nir_variable *var)
|
nir_function_impl_add_variable(nir_function_impl *impl, nir_variable *var)
|
||||||
{
|
{
|
||||||
assert(var->data.mode == nir_var_function);
|
assert(var->data.mode == nir_var_function_temp);
|
||||||
exec_list_push_tail(&impl->locals, &var->node);
|
exec_list_push_tail(&impl->locals, &var->node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -141,7 +141,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined)
|
|||||||
* For most use-cases, function inlining is a multi-step process. The general
|
* For most use-cases, function inlining is a multi-step process. The general
|
||||||
* pattern employed by SPIR-V consumers and others is as follows:
|
* pattern employed by SPIR-V consumers and others is as follows:
|
||||||
*
|
*
|
||||||
* 1. nir_lower_constant_initializers(shader, nir_var_function)
|
* 1. nir_lower_constant_initializers(shader, nir_var_function_temp)
|
||||||
*
|
*
|
||||||
* This is needed because local variables from the callee are simply added
|
* This is needed because local variables from the callee are simply added
|
||||||
* to the locals list for the caller and the information about where the
|
* to the locals list for the caller and the information about where the
|
||||||
@@ -196,7 +196,7 @@ inline_function_impl(nir_function_impl *impl, struct set *inlined)
|
|||||||
* spirv_to_nir returns the root function and so we can just use == whereas
|
* spirv_to_nir returns the root function and so we can just use == whereas
|
||||||
* with GL, you may have to look for a function named "main".
|
* with GL, you may have to look for a function named "main".
|
||||||
*
|
*
|
||||||
* 6. nir_lower_constant_initializers(shader, ~nir_var_function)
|
* 6. nir_lower_constant_initializers(shader, ~nir_var_function_temp)
|
||||||
*
|
*
|
||||||
* Lowering constant initializers on inputs, outputs, global variables,
|
* Lowering constant initializers on inputs, outputs, global variables,
|
||||||
* etc. requires that we know the main entrypoint so that we know where to
|
* etc. requires that we know the main entrypoint so that we know where to
|
||||||
|
@@ -109,7 +109,7 @@ nir_lower_constant_initializers(nir_shader *shader, nir_variable_mode modes)
|
|||||||
if ((modes & nir_var_system_value) && function->is_entrypoint)
|
if ((modes & nir_var_system_value) && function->is_entrypoint)
|
||||||
impl_progress |= lower_const_initializer(&builder, &shader->system_values);
|
impl_progress |= lower_const_initializer(&builder, &shader->system_values);
|
||||||
|
|
||||||
if (modes & nir_var_function)
|
if (modes & nir_var_function_temp)
|
||||||
impl_progress |= lower_const_initializer(&builder, &function->impl->locals);
|
impl_progress |= lower_const_initializer(&builder, &function->impl->locals);
|
||||||
|
|
||||||
if (impl_progress) {
|
if (impl_progress) {
|
||||||
|
@@ -91,7 +91,7 @@ nir_lower_global_vars_to_local(nir_shader *shader)
|
|||||||
|
|
||||||
if (impl != NULL) {
|
if (impl != NULL) {
|
||||||
exec_node_remove(&var->node);
|
exec_node_remove(&var->node);
|
||||||
var->data.mode = nir_var_function;
|
var->data.mode = nir_var_function_temp;
|
||||||
exec_list_push_tail(&impl->locals, &var->node);
|
exec_list_push_tail(&impl->locals, &var->node);
|
||||||
nir_metadata_preserve(impl, nir_metadata_block_index |
|
nir_metadata_preserve(impl, nir_metadata_block_index |
|
||||||
nir_metadata_dominance |
|
nir_metadata_dominance |
|
||||||
|
@@ -192,7 +192,7 @@ lower_locals_to_regs_block(nir_block *block,
|
|||||||
switch (intrin->intrinsic) {
|
switch (intrin->intrinsic) {
|
||||||
case nir_intrinsic_load_deref: {
|
case nir_intrinsic_load_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
b->cursor = nir_before_instr(&intrin->instr);
|
b->cursor = nir_before_instr(&intrin->instr);
|
||||||
@@ -218,7 +218,7 @@ lower_locals_to_regs_block(nir_block *block,
|
|||||||
|
|
||||||
case nir_intrinsic_store_deref: {
|
case nir_intrinsic_store_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
b->cursor = nir_before_instr(&intrin->instr);
|
b->cursor = nir_before_instr(&intrin->instr);
|
||||||
|
@@ -208,7 +208,7 @@ get_deref_node(nir_deref_instr *deref, struct lower_variables_state *state)
|
|||||||
/* This pass only works on local variables. Just ignore any derefs with
|
/* This pass only works on local variables. Just ignore any derefs with
|
||||||
* a non-local mode.
|
* a non-local mode.
|
||||||
*/
|
*/
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
struct deref_node *node = get_deref_node_recur(deref, state);
|
struct deref_node *node = get_deref_node_recur(deref, state);
|
||||||
@@ -504,7 +504,7 @@ rename_variables(struct lower_variables_state *state)
|
|||||||
switch (intrin->intrinsic) {
|
switch (intrin->intrinsic) {
|
||||||
case nir_intrinsic_load_deref: {
|
case nir_intrinsic_load_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
struct deref_node *node = get_deref_node(deref, state);
|
struct deref_node *node = get_deref_node(deref, state);
|
||||||
@@ -554,7 +554,7 @@ rename_variables(struct lower_variables_state *state)
|
|||||||
|
|
||||||
case nir_intrinsic_store_deref: {
|
case nir_intrinsic_store_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
struct deref_node *node = get_deref_node(deref, state);
|
struct deref_node *node = get_deref_node(deref, state);
|
||||||
@@ -680,7 +680,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)
|
|||||||
assert(path->path[0]->deref_type == nir_deref_type_var);
|
assert(path->path[0]->deref_type == nir_deref_type_var);
|
||||||
|
|
||||||
/* We don't build deref nodes for non-local variables */
|
/* We don't build deref nodes for non-local variables */
|
||||||
assert(path->path[0]->var->data.mode == nir_var_function);
|
assert(path->path[0]->var->data.mode == nir_var_function_temp);
|
||||||
|
|
||||||
if (path_may_be_aliased(path, &state)) {
|
if (path_may_be_aliased(path, &state)) {
|
||||||
exec_node_remove(&node->direct_derefs_link);
|
exec_node_remove(&node->direct_derefs_link);
|
||||||
|
@@ -134,7 +134,7 @@ gather_vars_written(struct copy_prop_var_state *state,
|
|||||||
if (instr->type == nir_instr_type_call) {
|
if (instr->type == nir_instr_type_call) {
|
||||||
written->modes |= nir_var_shader_out |
|
written->modes |= nir_var_shader_out |
|
||||||
nir_var_shader_temp |
|
nir_var_shader_temp |
|
||||||
nir_var_function |
|
nir_var_function_temp |
|
||||||
nir_var_ssbo |
|
nir_var_ssbo |
|
||||||
nir_var_shared;
|
nir_var_shared;
|
||||||
continue;
|
continue;
|
||||||
@@ -625,7 +625,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
|
|||||||
if (instr->type == nir_instr_type_call) {
|
if (instr->type == nir_instr_type_call) {
|
||||||
apply_barrier_for_modes(copies, nir_var_shader_out |
|
apply_barrier_for_modes(copies, nir_var_shader_out |
|
||||||
nir_var_shader_temp |
|
nir_var_shader_temp |
|
||||||
nir_var_function |
|
nir_var_function_temp |
|
||||||
nir_var_ssbo |
|
nir_var_ssbo |
|
||||||
nir_var_shared);
|
nir_var_shared);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -120,7 +120,7 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block)
|
|||||||
if (instr->type == nir_instr_type_call) {
|
if (instr->type == nir_instr_type_call) {
|
||||||
clear_unused_for_modes(&unused_writes, nir_var_shader_out |
|
clear_unused_for_modes(&unused_writes, nir_var_shader_out |
|
||||||
nir_var_shader_temp |
|
nir_var_shader_temp |
|
||||||
nir_var_function |
|
nir_var_function_temp |
|
||||||
nir_var_ssbo |
|
nir_var_ssbo |
|
||||||
nir_var_shared);
|
nir_var_shared);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -225,7 +225,7 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,
|
|||||||
* continue on because it won't affect local stores or read-only
|
* continue on because it won't affect local stores or read-only
|
||||||
* variables.
|
* variables.
|
||||||
*/
|
*/
|
||||||
if (dst_deref->mode != nir_var_function)
|
if (dst_deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* We keep track of the SSA indices where the two last-written
|
/* We keep track of the SSA indices where the two last-written
|
||||||
@@ -273,7 +273,7 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,
|
|||||||
*/
|
*/
|
||||||
const nir_variable_mode read_only_modes =
|
const nir_variable_mode read_only_modes =
|
||||||
nir_var_shader_in | nir_var_uniform | nir_var_system_value;
|
nir_var_shader_in | nir_var_uniform | nir_var_system_value;
|
||||||
if (!(src_deref->mode & (nir_var_function | read_only_modes)))
|
if (!(src_deref->mode & (nir_var_function_temp | read_only_modes)))
|
||||||
goto reset;
|
goto reset;
|
||||||
|
|
||||||
/* If we don't yet have an active copy, then make this instruction the
|
/* If we don't yet have an active copy, then make this instruction the
|
||||||
|
@@ -196,9 +196,9 @@ nir_opt_large_constants(nir_shader *shader,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dst_deref && dst_deref->mode == nir_var_function) {
|
if (dst_deref && dst_deref->mode == nir_var_function_temp) {
|
||||||
nir_variable *var = nir_deref_instr_get_variable(dst_deref);
|
nir_variable *var = nir_deref_instr_get_variable(dst_deref);
|
||||||
assert(var->data.mode == nir_var_function);
|
assert(var->data.mode == nir_var_function_temp);
|
||||||
|
|
||||||
/* We only consider variables constant if they only have constant
|
/* We only consider variables constant if they only have constant
|
||||||
* stores, all the stores come before any reads, and all stores
|
* stores, all the stores come before any reads, and all stores
|
||||||
@@ -210,9 +210,9 @@ nir_opt_large_constants(nir_shader *shader,
|
|||||||
info->is_constant = false;
|
info->is_constant = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src_deref && src_deref->mode == nir_var_function) {
|
if (src_deref && src_deref->mode == nir_var_function_temp) {
|
||||||
nir_variable *var = nir_deref_instr_get_variable(src_deref);
|
nir_variable *var = nir_deref_instr_get_variable(src_deref);
|
||||||
assert(var->data.mode == nir_var_function);
|
assert(var->data.mode == nir_var_function_temp);
|
||||||
|
|
||||||
var_infos[var->data.index].found_read = true;
|
var_infos[var->data.index].found_read = true;
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ nir_opt_large_constants(nir_shader *shader,
|
|||||||
switch (intrin->intrinsic) {
|
switch (intrin->intrinsic) {
|
||||||
case nir_intrinsic_load_deref: {
|
case nir_intrinsic_load_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||||
@@ -276,7 +276,7 @@ nir_opt_large_constants(nir_shader *shader,
|
|||||||
|
|
||||||
case nir_intrinsic_store_deref: {
|
case nir_intrinsic_store_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||||
@@ -292,7 +292,7 @@ nir_opt_large_constants(nir_shader *shader,
|
|||||||
|
|
||||||
case nir_intrinsic_copy_deref: {
|
case nir_intrinsic_copy_deref: {
|
||||||
nir_deref_instr *deref = nir_src_as_deref(intrin->src[1]);
|
nir_deref_instr *deref = nir_src_as_deref(intrin->src[1]);
|
||||||
if (deref->mode != nir_var_function)
|
if (deref->mode != nir_var_function_temp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nir_variable *var = nir_deref_instr_get_variable(deref);
|
nir_variable *var = nir_deref_instr_get_variable(deref);
|
||||||
|
@@ -423,8 +423,8 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)
|
|||||||
return "shared";
|
return "shared";
|
||||||
case nir_var_shader_temp:
|
case nir_var_shader_temp:
|
||||||
return want_local_global_mode ? "shader_temp" : "";
|
return want_local_global_mode ? "shader_temp" : "";
|
||||||
case nir_var_function:
|
case nir_var_function_temp:
|
||||||
return want_local_global_mode ? "function" : "";
|
return want_local_global_mode ? "function_temp" : "";
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@@ -71,7 +71,7 @@ add_var_use_deref(nir_deref_instr *deref, struct set *live)
|
|||||||
* all means we need to keep it alive.
|
* all means we need to keep it alive.
|
||||||
*/
|
*/
|
||||||
assert(deref->mode == deref->var->data.mode);
|
assert(deref->mode == deref->var->data.mode);
|
||||||
if (!(deref->mode & (nir_var_function | nir_var_shader_temp | nir_var_shared)) ||
|
if (!(deref->mode & (nir_var_function_temp | nir_var_shader_temp | nir_var_shared)) ||
|
||||||
deref_used_for_not_store(deref))
|
deref_used_for_not_store(deref))
|
||||||
_mesa_set_add(live, deref->var);
|
_mesa_set_add(live, deref->var);
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)
|
|||||||
if (modes & nir_var_shared)
|
if (modes & nir_var_shared)
|
||||||
progress = remove_dead_vars(&shader->shared, live) || progress;
|
progress = remove_dead_vars(&shader->shared, live) || progress;
|
||||||
|
|
||||||
if (modes & nir_var_function) {
|
if (modes & nir_var_function_temp) {
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function(function, shader) {
|
||||||
if (function->impl) {
|
if (function->impl) {
|
||||||
if (remove_dead_vars(&function->impl->locals, live))
|
if (remove_dead_vars(&function->impl->locals, live))
|
||||||
|
@@ -115,7 +115,7 @@ init_field_for_type(struct field *field, struct field *parent,
|
|||||||
var_type = wrap_type_in_array(var_type, f->type);
|
var_type = wrap_type_in_array(var_type, f->type);
|
||||||
|
|
||||||
nir_variable_mode mode = state->base_var->data.mode;
|
nir_variable_mode mode = state->base_var->data.mode;
|
||||||
if (mode == nir_var_function) {
|
if (mode == nir_var_function_temp) {
|
||||||
field->var = nir_local_variable_create(state->impl, var_type, name);
|
field->var = nir_local_variable_create(state->impl, var_type, name);
|
||||||
} else {
|
} else {
|
||||||
field->var = nir_variable_create(state->shader, mode, var_type, name);
|
field->var = nir_variable_create(state->shader, mode, var_type, name);
|
||||||
@@ -259,7 +259,7 @@ nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes)
|
|||||||
struct hash_table *var_field_map =
|
struct hash_table *var_field_map =
|
||||||
_mesa_pointer_hash_table_create(mem_ctx);
|
_mesa_pointer_hash_table_create(mem_ctx);
|
||||||
|
|
||||||
assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
|
assert((modes & (nir_var_shader_temp | nir_var_function_temp)) == modes);
|
||||||
|
|
||||||
bool has_global_splits = false;
|
bool has_global_splits = false;
|
||||||
if (modes & nir_var_shader_temp) {
|
if (modes & nir_var_shader_temp) {
|
||||||
@@ -274,7 +274,7 @@ nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool has_local_splits = false;
|
bool has_local_splits = false;
|
||||||
if (modes & nir_var_function) {
|
if (modes & nir_var_function_temp) {
|
||||||
has_local_splits = split_var_list_structs(shader, function->impl,
|
has_local_splits = split_var_list_structs(shader, function->impl,
|
||||||
&function->impl->locals,
|
&function->impl->locals,
|
||||||
var_field_map, mem_ctx);
|
var_field_map, mem_ctx);
|
||||||
@@ -454,7 +454,7 @@ create_split_array_vars(struct array_var_info *var_info,
|
|||||||
name = ralloc_asprintf(mem_ctx, "(%s)", name);
|
name = ralloc_asprintf(mem_ctx, "(%s)", name);
|
||||||
|
|
||||||
nir_variable_mode mode = var_info->base_var->data.mode;
|
nir_variable_mode mode = var_info->base_var->data.mode;
|
||||||
if (mode == nir_var_function) {
|
if (mode == nir_var_function_temp) {
|
||||||
split->var = nir_local_variable_create(impl,
|
split->var = nir_local_variable_create(impl,
|
||||||
var_info->split_var_type, name);
|
var_info->split_var_type, name);
|
||||||
} else {
|
} else {
|
||||||
@@ -794,7 +794,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)
|
|||||||
void *mem_ctx = ralloc_context(NULL);
|
void *mem_ctx = ralloc_context(NULL);
|
||||||
struct hash_table *var_info_map = _mesa_pointer_hash_table_create(mem_ctx);
|
struct hash_table *var_info_map = _mesa_pointer_hash_table_create(mem_ctx);
|
||||||
|
|
||||||
assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
|
assert((modes & (nir_var_shader_temp | nir_var_function_temp)) == modes);
|
||||||
|
|
||||||
bool has_global_array = false;
|
bool has_global_array = false;
|
||||||
if (modes & nir_var_shader_temp) {
|
if (modes & nir_var_shader_temp) {
|
||||||
@@ -808,7 +808,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool has_local_array = false;
|
bool has_local_array = false;
|
||||||
if (modes & nir_var_function) {
|
if (modes & nir_var_function_temp) {
|
||||||
has_local_array = init_var_list_array_infos(&function->impl->locals,
|
has_local_array = init_var_list_array_infos(&function->impl->locals,
|
||||||
var_info_map, mem_ctx);
|
var_info_map, mem_ctx);
|
||||||
}
|
}
|
||||||
@@ -838,7 +838,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool has_local_splits = false;
|
bool has_local_splits = false;
|
||||||
if (modes & nir_var_function) {
|
if (modes & nir_var_function_temp) {
|
||||||
has_local_splits = split_var_list_arrays(shader, function->impl,
|
has_local_splits = split_var_list_arrays(shader, function->impl,
|
||||||
&function->impl->locals,
|
&function->impl->locals,
|
||||||
var_info_map, mem_ctx);
|
var_info_map, mem_ctx);
|
||||||
@@ -1494,7 +1494,7 @@ function_impl_has_vars_with_modes(nir_function_impl *impl,
|
|||||||
if ((modes & nir_var_shader_temp) && !exec_list_is_empty(&shader->globals))
|
if ((modes & nir_var_shader_temp) && !exec_list_is_empty(&shader->globals))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((modes & nir_var_function) && !exec_list_is_empty(&impl->locals))
|
if ((modes & nir_var_function_temp) && !exec_list_is_empty(&impl->locals))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1512,7 +1512,7 @@ function_impl_has_vars_with_modes(nir_function_impl *impl,
|
|||||||
bool
|
bool
|
||||||
nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)
|
nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)
|
||||||
{
|
{
|
||||||
assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
|
assert((modes & (nir_var_shader_temp | nir_var_function_temp)) == modes);
|
||||||
|
|
||||||
void *mem_ctx = ralloc_context(NULL);
|
void *mem_ctx = ralloc_context(NULL);
|
||||||
|
|
||||||
@@ -1549,7 +1549,7 @@ nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool locals_shrunk = false;
|
bool locals_shrunk = false;
|
||||||
if (modes & nir_var_function) {
|
if (modes & nir_var_function_temp) {
|
||||||
locals_shrunk = shrink_vec_var_list(&function->impl->locals,
|
locals_shrunk = shrink_vec_var_list(&function->impl->locals,
|
||||||
var_usage_map);
|
var_usage_map);
|
||||||
}
|
}
|
||||||
|
@@ -395,7 +395,7 @@ validate_var_use(nir_variable *var, validate_state *state)
|
|||||||
{
|
{
|
||||||
struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);
|
struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);
|
||||||
validate_assert(state, entry);
|
validate_assert(state, entry);
|
||||||
if (var->data.mode == nir_var_function)
|
if (var->data.mode == nir_var_function_temp)
|
||||||
validate_assert(state, (nir_function_impl *) entry->data == state->impl);
|
validate_assert(state, (nir_function_impl *) entry->data == state->impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,14 +34,14 @@ protected:
|
|||||||
~nir_vars_test();
|
~nir_vars_test();
|
||||||
|
|
||||||
nir_variable *create_int(nir_variable_mode mode, const char *name) {
|
nir_variable *create_int(nir_variable_mode mode, const char *name) {
|
||||||
if (mode == nir_var_function)
|
if (mode == nir_var_function_temp)
|
||||||
return nir_local_variable_create(b->impl, glsl_int_type(), name);
|
return nir_local_variable_create(b->impl, glsl_int_type(), name);
|
||||||
return nir_variable_create(b->shader, mode, glsl_int_type(), name);
|
return nir_variable_create(b->shader, mode, glsl_int_type(), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
nir_variable *create_ivec2(nir_variable_mode mode, const char *name) {
|
nir_variable *create_ivec2(nir_variable_mode mode, const char *name) {
|
||||||
const glsl_type *var_type = glsl_vector_type(GLSL_TYPE_INT, 2);
|
const glsl_type *var_type = glsl_vector_type(GLSL_TYPE_INT, 2);
|
||||||
if (mode == nir_var_function)
|
if (mode == nir_var_function_temp)
|
||||||
return nir_local_variable_create(b->impl, var_type, name);
|
return nir_local_variable_create(b->impl, var_type, name);
|
||||||
return nir_variable_create(b->shader, mode, var_type, name);
|
return nir_variable_create(b->shader, mode, var_type, name);
|
||||||
}
|
}
|
||||||
@@ -258,9 +258,9 @@ TEST_F(nir_redundant_load_vars_test, invalidate_live_load_in_the_end_of_loop)
|
|||||||
|
|
||||||
TEST_F(nir_copy_prop_vars_test, simple_copies)
|
TEST_F(nir_copy_prop_vars_test, simple_copies)
|
||||||
{
|
{
|
||||||
nir_variable *in = create_int(nir_var_shader_in, "in");
|
nir_variable *in = create_int(nir_var_shader_in, "in");
|
||||||
nir_variable *temp = create_int(nir_var_function, "temp");
|
nir_variable *temp = create_int(nir_var_function_temp, "temp");
|
||||||
nir_variable *out = create_int(nir_var_shader_out, "out");
|
nir_variable *out = create_int(nir_var_shader_out, "out");
|
||||||
|
|
||||||
nir_copy_var(b, temp, in);
|
nir_copy_var(b, temp, in);
|
||||||
nir_copy_var(b, out, temp);
|
nir_copy_var(b, out, temp);
|
||||||
@@ -284,7 +284,7 @@ TEST_F(nir_copy_prop_vars_test, simple_copies)
|
|||||||
|
|
||||||
TEST_F(nir_copy_prop_vars_test, simple_store_load)
|
TEST_F(nir_copy_prop_vars_test, simple_store_load)
|
||||||
{
|
{
|
||||||
nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);
|
nir_variable **v = create_many_ivec2(nir_var_function_temp, "v", 2);
|
||||||
unsigned mask = 1 | 2;
|
unsigned mask = 1 | 2;
|
||||||
|
|
||||||
nir_ssa_def *stored_value = nir_imm_ivec2(b, 10, 20);
|
nir_ssa_def *stored_value = nir_imm_ivec2(b, 10, 20);
|
||||||
@@ -312,7 +312,7 @@ TEST_F(nir_copy_prop_vars_test, simple_store_load)
|
|||||||
|
|
||||||
TEST_F(nir_copy_prop_vars_test, store_store_load)
|
TEST_F(nir_copy_prop_vars_test, store_store_load)
|
||||||
{
|
{
|
||||||
nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);
|
nir_variable **v = create_many_ivec2(nir_var_function_temp, "v", 2);
|
||||||
unsigned mask = 1 | 2;
|
unsigned mask = 1 | 2;
|
||||||
|
|
||||||
nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);
|
nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);
|
||||||
@@ -345,7 +345,7 @@ TEST_F(nir_copy_prop_vars_test, store_store_load)
|
|||||||
|
|
||||||
TEST_F(nir_copy_prop_vars_test, store_store_load_different_components)
|
TEST_F(nir_copy_prop_vars_test, store_store_load_different_components)
|
||||||
{
|
{
|
||||||
nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);
|
nir_variable **v = create_many_ivec2(nir_var_function_temp, "v", 2);
|
||||||
|
|
||||||
nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);
|
nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);
|
||||||
nir_store_var(b, v[0], first_value, 1 << 1);
|
nir_store_var(b, v[0], first_value, 1 << 1);
|
||||||
@@ -384,7 +384,7 @@ TEST_F(nir_copy_prop_vars_test, store_store_load_different_components)
|
|||||||
|
|
||||||
TEST_F(nir_copy_prop_vars_test, store_store_load_different_components_in_many_blocks)
|
TEST_F(nir_copy_prop_vars_test, store_store_load_different_components_in_many_blocks)
|
||||||
{
|
{
|
||||||
nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);
|
nir_variable **v = create_many_ivec2(nir_var_function_temp, "v", 2);
|
||||||
|
|
||||||
nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);
|
nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);
|
||||||
nir_store_var(b, v[0], first_value, 1 << 1);
|
nir_store_var(b, v[0], first_value, 1 << 1);
|
||||||
@@ -459,7 +459,7 @@ TEST_F(nir_copy_prop_vars_test, memory_barrier_in_two_blocks)
|
|||||||
|
|
||||||
TEST_F(nir_copy_prop_vars_test, simple_store_load_in_two_blocks)
|
TEST_F(nir_copy_prop_vars_test, simple_store_load_in_two_blocks)
|
||||||
{
|
{
|
||||||
nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);
|
nir_variable **v = create_many_ivec2(nir_var_function_temp, "v", 2);
|
||||||
unsigned mask = 1 | 2;
|
unsigned mask = 1 | 2;
|
||||||
|
|
||||||
nir_ssa_def *stored_value = nir_imm_ivec2(b, 10, 20);
|
nir_ssa_def *stored_value = nir_imm_ivec2(b, 10, 20);
|
||||||
|
@@ -908,7 +908,7 @@ vtn_emit_cf_list(struct vtn_builder *b, struct list_head *cf_list,
|
|||||||
glsl_get_bare_type(b->func->type->return_type->type);
|
glsl_get_bare_type(b->func->type->return_type->type);
|
||||||
nir_deref_instr *ret_deref =
|
nir_deref_instr *ret_deref =
|
||||||
nir_build_deref_cast(&b->nb, nir_load_param(&b->nb, 0),
|
nir_build_deref_cast(&b->nb, nir_load_param(&b->nb, 0),
|
||||||
nir_var_function, ret_type, 0);
|
nir_var_function_temp, ret_type, 0);
|
||||||
vtn_local_store(b, src, ret_deref);
|
vtn_local_store(b, src, ret_deref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1698,7 +1698,7 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
|
|||||||
break;
|
break;
|
||||||
case SpvStorageClassFunction:
|
case SpvStorageClassFunction:
|
||||||
mode = vtn_variable_mode_function;
|
mode = vtn_variable_mode_function;
|
||||||
nir_mode = nir_var_function;
|
nir_mode = nir_var_function_temp;
|
||||||
break;
|
break;
|
||||||
case SpvStorageClassWorkgroup:
|
case SpvStorageClassWorkgroup:
|
||||||
mode = vtn_variable_mode_workgroup;
|
mode = vtn_variable_mode_workgroup;
|
||||||
|
@@ -194,7 +194,7 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
|
|||||||
if (OPT(s, nir_lower_idiv))
|
if (OPT(s, nir_lower_idiv))
|
||||||
ir3_optimize_loop(s);
|
ir3_optimize_loop(s);
|
||||||
|
|
||||||
OPT_V(s, nir_remove_dead_variables, nir_var_function);
|
OPT_V(s, nir_remove_dead_variables, nir_var_function_temp);
|
||||||
|
|
||||||
OPT_V(s, nir_move_load_const);
|
OPT_V(s, nir_move_load_const);
|
||||||
|
|
||||||
|
@@ -296,7 +296,7 @@ v3d_shader_state_create(struct pipe_context *pctx,
|
|||||||
|
|
||||||
v3d_optimize_nir(s);
|
v3d_optimize_nir(s);
|
||||||
|
|
||||||
NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function);
|
NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function_temp);
|
||||||
|
|
||||||
/* Garbage collect dead instructions */
|
/* Garbage collect dead instructions */
|
||||||
nir_sweep(s);
|
nir_sweep(s);
|
||||||
|
@@ -1598,7 +1598,7 @@ vc4_optimize_nir(struct nir_shader *s)
|
|||||||
NIR_PASS(progress, s, nir_opt_loop_unroll,
|
NIR_PASS(progress, s, nir_opt_loop_unroll,
|
||||||
nir_var_shader_in |
|
nir_var_shader_in |
|
||||||
nir_var_shader_out |
|
nir_var_shader_out |
|
||||||
nir_var_function);
|
nir_var_function_temp);
|
||||||
} while (progress);
|
} while (progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2517,7 +2517,7 @@ vc4_shader_state_create(struct pipe_context *pctx,
|
|||||||
|
|
||||||
vc4_optimize_nir(s);
|
vc4_optimize_nir(s);
|
||||||
|
|
||||||
NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function);
|
NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function_temp);
|
||||||
|
|
||||||
/* Garbage collect dead instructions */
|
/* Garbage collect dead instructions */
|
||||||
nir_sweep(s);
|
nir_sweep(s);
|
||||||
|
@@ -527,7 +527,7 @@ brw_nir_no_indirect_mask(const struct brw_compiler *compiler,
|
|||||||
if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput)
|
if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput)
|
||||||
indirect_mask |= nir_var_shader_out;
|
indirect_mask |= nir_var_shader_out;
|
||||||
if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)
|
if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)
|
||||||
indirect_mask |= nir_var_function;
|
indirect_mask |= nir_var_function_temp;
|
||||||
|
|
||||||
return indirect_mask;
|
return indirect_mask;
|
||||||
}
|
}
|
||||||
@@ -542,8 +542,8 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
|
|||||||
bool progress;
|
bool progress;
|
||||||
do {
|
do {
|
||||||
progress = false;
|
progress = false;
|
||||||
OPT(nir_split_array_vars, nir_var_function);
|
OPT(nir_split_array_vars, nir_var_function_temp);
|
||||||
OPT(nir_shrink_vec_array_vars, nir_var_function);
|
OPT(nir_shrink_vec_array_vars, nir_var_function_temp);
|
||||||
OPT(nir_opt_deref);
|
OPT(nir_opt_deref);
|
||||||
OPT(nir_lower_vars_to_ssa);
|
OPT(nir_lower_vars_to_ssa);
|
||||||
if (allow_copies) {
|
if (allow_copies) {
|
||||||
@@ -619,7 +619,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
|
|||||||
/* Workaround Gfxbench unused local sampler variable which will trigger an
|
/* Workaround Gfxbench unused local sampler variable which will trigger an
|
||||||
* assert in the opt_large_constants pass.
|
* assert in the opt_large_constants pass.
|
||||||
*/
|
*/
|
||||||
OPT(nir_remove_dead_variables, nir_var_function);
|
OPT(nir_remove_dead_variables, nir_var_function_temp);
|
||||||
|
|
||||||
return nir;
|
return nir;
|
||||||
}
|
}
|
||||||
@@ -714,7 +714,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)
|
|||||||
} while (progress);
|
} while (progress);
|
||||||
|
|
||||||
if (lowered_64bit_ops) {
|
if (lowered_64bit_ops) {
|
||||||
OPT(nir_lower_constant_initializers, nir_var_function);
|
OPT(nir_lower_constant_initializers, nir_var_function_temp);
|
||||||
OPT(nir_lower_returns);
|
OPT(nir_lower_returns);
|
||||||
OPT(nir_inline_functions);
|
OPT(nir_inline_functions);
|
||||||
OPT(nir_opt_deref);
|
OPT(nir_opt_deref);
|
||||||
@@ -728,7 +728,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)
|
|||||||
}
|
}
|
||||||
assert(exec_list_length(&nir->functions) == 1);
|
assert(exec_list_length(&nir->functions) == 1);
|
||||||
|
|
||||||
OPT(nir_lower_constant_initializers, ~nir_var_function);
|
OPT(nir_lower_constant_initializers, ~nir_var_function_temp);
|
||||||
|
|
||||||
if (nir->info.stage == MESA_SHADER_GEOMETRY)
|
if (nir->info.stage == MESA_SHADER_GEOMETRY)
|
||||||
OPT(nir_lower_gs_intrinsics);
|
OPT(nir_lower_gs_intrinsics);
|
||||||
@@ -754,7 +754,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)
|
|||||||
OPT(nir_lower_global_vars_to_local);
|
OPT(nir_lower_global_vars_to_local);
|
||||||
|
|
||||||
OPT(nir_split_var_copies);
|
OPT(nir_split_var_copies);
|
||||||
OPT(nir_split_struct_vars, nir_var_function);
|
OPT(nir_split_struct_vars, nir_var_function_temp);
|
||||||
|
|
||||||
nir = brw_nir_optimize(nir, compiler, is_scalar, true);
|
nir = brw_nir_optimize(nir, compiler, is_scalar, true);
|
||||||
|
|
||||||
|
@@ -183,7 +183,7 @@ anv_shader_compile_to_nir(struct anv_device *device,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* of the function and not at the top of its caller.
|
||||||
*/
|
*/
|
||||||
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function);
|
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp);
|
||||||
NIR_PASS_V(nir, nir_lower_returns);
|
NIR_PASS_V(nir, nir_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
NIR_PASS_V(nir, nir_opt_deref);
|
||||||
@@ -835,7 +835,7 @@ anv_pipeline_link_fs(const struct brw_compiler *compiler,
|
|||||||
!(stage->key.wm.color_outputs_valid & (1 << rt))) {
|
!(stage->key.wm.color_outputs_valid & (1 << rt))) {
|
||||||
/* Unused or out-of-bounds, throw it away */
|
/* Unused or out-of-bounds, throw it away */
|
||||||
deleted_output = true;
|
deleted_output = true;
|
||||||
var->data.mode = nir_var_function;
|
var->data.mode = nir_var_function_temp;
|
||||||
exec_node_remove(&var->node);
|
exec_node_remove(&var->node);
|
||||||
exec_list_push_tail(&impl->locals, &var->node);
|
exec_list_push_tail(&impl->locals, &var->node);
|
||||||
continue;
|
continue;
|
||||||
|
@@ -243,7 +243,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
|
|||||||
* inline functions. That way they get properly initialized at the top
|
* inline functions. That way they get properly initialized at the top
|
||||||
* of the function and not at the top of its caller.
|
* of the function and not at the top of its caller.
|
||||||
*/
|
*/
|
||||||
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function);
|
NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function_temp);
|
||||||
NIR_PASS_V(nir, nir_lower_returns);
|
NIR_PASS_V(nir, nir_lower_returns);
|
||||||
NIR_PASS_V(nir, nir_inline_functions);
|
NIR_PASS_V(nir, nir_inline_functions);
|
||||||
NIR_PASS_V(nir, nir_opt_deref);
|
NIR_PASS_V(nir, nir_opt_deref);
|
||||||
|
@@ -616,7 +616,7 @@ st_nir_link_shaders(nir_shader **producer, nir_shader **consumer, bool scalar)
|
|||||||
* See the following thread for more details of the problem:
|
* See the following thread for more details of the problem:
|
||||||
* https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html
|
* https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html
|
||||||
*/
|
*/
|
||||||
nir_variable_mode indirect_mask = nir_var_function;
|
nir_variable_mode indirect_mask = nir_var_function_temp;
|
||||||
|
|
||||||
NIR_PASS_V(*producer, nir_lower_indirect_derefs, indirect_mask);
|
NIR_PASS_V(*producer, nir_lower_indirect_derefs, indirect_mask);
|
||||||
NIR_PASS_V(*consumer, nir_lower_indirect_derefs, indirect_mask);
|
NIR_PASS_V(*consumer, nir_lower_indirect_derefs, indirect_mask);
|
||||||
|
Reference in New Issue
Block a user