{
const struct gen_device_info *devinfo = compiler->devinfo;
- brw_nir_apply_sampler_key(shader, compiler, &key->base.tex, true);
+ brw_nir_apply_key(shader, compiler, &key->base, true);
brw_nir_lower_fs_inputs(shader, devinfo, key);
brw_nir_lower_fs_outputs(shader);
unsigned dispatch_width)
{
nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
- brw_nir_apply_sampler_key(shader, compiler, &key->base.tex, true);
+ brw_nir_apply_key(shader, compiler, &key->base, true);
NIR_PASS_V(shader, brw_nir_lower_cs_intrinsics, dispatch_width);
}
}
-void
+static bool
brw_nir_apply_sampler_key(nir_shader *nir,
const struct brw_compiler *compiler,
- const struct brw_sampler_prog_key_data *key_tex,
- bool is_scalar)
+ const struct brw_sampler_prog_key_data *key_tex)
{
const struct gen_device_info *devinfo = compiler->devinfo;
nir_lower_tex_options tex_options = {
memcpy(&tex_options.scale_factors, &key_tex->scale_factors,
sizeof(tex_options.scale_factors));
- if (nir_lower_tex(nir, &tex_options)) {
- nir_validate_shader(nir, "after nir_lower_tex");
+ return nir_lower_tex(nir, &tex_options);
+}
+
+void
+brw_nir_apply_key(nir_shader *nir,
+ const struct brw_compiler *compiler,
+ const struct brw_base_prog_key *key,
+ bool is_scalar)
+{
+ bool progress = false;
+
+ OPT(brw_nir_apply_sampler_key, compiler, &key->tex);
+
+ if (progress)
brw_nir_optimize(nir, compiler, is_scalar, false);
- }
}
enum brw_reg_type
void brw_nir_apply_tcs_quads_workaround(nir_shader *nir);
-void brw_nir_apply_sampler_key(nir_shader *nir,
- const struct brw_compiler *compiler,
- const struct brw_sampler_prog_key_data *key,
- bool is_scalar);
+void brw_nir_apply_key(nir_shader *nir,
+ const struct brw_compiler *compiler,
+ const struct brw_base_prog_key *key,
+ bool is_scalar);
enum brw_reg_type brw_type_for_nir_type(const struct gen_device_info *devinfo,
nir_alu_type type);
nir->info.inputs_read = key->inputs_read;
nir->info.patch_inputs_read = key->patch_inputs_read;
- brw_nir_apply_sampler_key(nir, compiler, &key->base.tex, is_scalar);
+ brw_nir_apply_key(nir, compiler, &key->base, is_scalar);
brw_nir_lower_tes_inputs(nir, input_vue_map);
brw_nir_lower_vue_outputs(nir);
brw_postprocess_nir(nir, compiler, is_scalar);
char **error_str)
{
const bool is_scalar = compiler->scalar_stage[MESA_SHADER_VERTEX];
- brw_nir_apply_sampler_key(shader, compiler, &key->base.tex, is_scalar);
+ brw_nir_apply_key(shader, compiler, &key->base, is_scalar);
const unsigned *assembly = NULL;
&c.input_vue_map, inputs_read,
shader->info.separate_shader);
- brw_nir_apply_sampler_key(shader, compiler, &key->base.tex, is_scalar);
+ brw_nir_apply_key(shader, compiler, &key->base, is_scalar);
brw_nir_lower_vue_inputs(shader, &c.input_vue_map);
brw_nir_lower_vue_outputs(shader);
brw_postprocess_nir(shader, compiler, is_scalar);
nir->info.outputs_written,
nir->info.patch_outputs_written);
- brw_nir_apply_sampler_key(nir, compiler, &key->base.tex, is_scalar);
+ brw_nir_apply_key(nir, compiler, &key->base, is_scalar);
brw_nir_lower_vue_inputs(nir, &input_vue_map);
brw_nir_lower_tcs_outputs(nir, &vue_prog_data->vue_map,
key->tes_primitive_mode);