}
struct dxil_nir_split_clip_cull_distance_params {
- nir_variable *new_var;
+ nir_variable *new_var[2];
nir_shader *shader;
};
void *cb_data)
{
struct dxil_nir_split_clip_cull_distance_params *params = cb_data;
- nir_variable *new_var = params->new_var;
if (instr->type != nir_instr_type_deref)
return false;
!var->data.compact)
return false;
+ unsigned new_var_idx = var->data.mode == nir_var_shader_in ? 0 : 1;
+ nir_variable *new_var = params->new_var[new_var_idx];
+
/* The location should only be inside clip distance, because clip
* and cull should've been merged by nir_lower_clip_cull_distance_arrays()
*/
}
new_var->data.location++;
new_var->data.location_frac = 0;
- params->new_var = new_var;
+ params->new_var[new_var_idx] = new_var;
}
/* Update the type for derefs of the old var */
dxil_nir_split_clip_cull_distance(nir_shader *shader)
{
struct dxil_nir_split_clip_cull_distance_params params = {
- .new_var = NULL,
+ .new_var = { NULL, NULL },
.shader = shader,
};
nir_shader_instructions_pass(shader,
nir_metadata_dominance |
nir_metadata_loop_analysis,
¶ms);
- return params.new_var != NULL;
+ return params.new_var[0] != NULL || params.new_var[1] != NULL;
}
static bool