From: Jason Ekstrand Date: Wed, 14 Sep 2016 17:42:42 +0000 (-0700) Subject: i965/nir: Roll set_default_interpolation into lower_fs_inputs X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=111f6b250d01fa1937103f24b5cb54b15dd77fbf;p=mesa.git i965/nir: Roll set_default_interpolation into lower_fs_inputs Signed-off-by: Jason Ekstrand Reviewed-by: Anuj Phogat Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 6deca2621e3..d026bbd517f 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -6372,42 +6372,6 @@ move_interpolation_to_top(nir_shader *nir) } } -/** - * Apply default interpolation settings to FS inputs which don't specify any. - */ -static void -brw_nir_set_default_interpolation(const struct gen_device_info *devinfo, - struct nir_shader *nir, - bool api_flat_shade) -{ - assert(nir->stage == MESA_SHADER_FRAGMENT); - - nir_foreach_variable(var, &nir->inputs) { - /* Apply default interpolation mode. - * - * Everything defaults to smooth except for the legacy GL color - * built-in variables, which might be flat depending on API state. - */ - if (var->data.interpolation == INTERP_MODE_NONE) { - const bool flat = api_flat_shade && - (var->data.location == VARYING_SLOT_COL0 || - var->data.location == VARYING_SLOT_COL1); - - var->data.interpolation = flat ? INTERP_MODE_FLAT - : INTERP_MODE_SMOOTH; - } - - /* On Ironlake and below, there is only one interpolation mode. - * Centroid interpolation doesn't mean anything on this hardware -- - * there is no multisampling. - */ - if (devinfo->gen < 6) { - var->data.centroid = false; - var->data.sample = false; - } - } -} - /** * Demote per-sample barycentric intrinsics to centroid. * @@ -6465,9 +6429,7 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data, nir_shader *shader = nir_shader_clone(mem_ctx, src_shader); shader = brw_nir_apply_sampler_key(shader, compiler->devinfo, &key->tex, true); - brw_nir_set_default_interpolation(compiler->devinfo, shader, - key->flat_shade); - brw_nir_lower_fs_inputs(shader, key); + brw_nir_lower_fs_inputs(shader, compiler->devinfo, key); brw_nir_lower_fs_outputs(shader); if (!key->multisample_fbo) NIR_PASS_V(shader, demote_sample_qualifiers); diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c index 9fdfa4d79cb..fbc84c474f5 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.c +++ b/src/mesa/drivers/dri/i965/brw_nir.c @@ -282,10 +282,34 @@ brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue_map) void brw_nir_lower_fs_inputs(nir_shader *nir, + const struct gen_device_info *devinfo, const struct brw_wm_prog_key *key) { foreach_list_typed(nir_variable, var, node, &nir->inputs) { var->data.driver_location = var->data.location; + + /* Apply default interpolation mode. + * + * Everything defaults to smooth except for the legacy GL color + * built-in variables, which might be flat depending on API state. + */ + if (var->data.interpolation == INTERP_MODE_NONE) { + const bool flat = key->flat_shade && + (var->data.location == VARYING_SLOT_COL0 || + var->data.location == VARYING_SLOT_COL1); + + var->data.interpolation = flat ? INTERP_MODE_FLAT + : INTERP_MODE_SMOOTH; + } + + /* On Ironlake and below, there is only one interpolation mode. + * Centroid interpolation doesn't mean anything on this hardware -- + * there is no multisampling. + */ + if (devinfo->gen < 6) { + var->data.centroid = false; + var->data.sample = false; + } } nir_lower_io_options lower_io_options = 0; diff --git a/src/mesa/drivers/dri/i965/brw_nir.h b/src/mesa/drivers/dri/i965/brw_nir.h index 51d2f630903..425d6ce8026 100644 --- a/src/mesa/drivers/dri/i965/brw_nir.h +++ b/src/mesa/drivers/dri/i965/brw_nir.h @@ -107,6 +107,7 @@ void brw_nir_lower_vue_inputs(nir_shader *nir, bool is_scalar, const struct brw_vue_map *vue_map); void brw_nir_lower_tes_inputs(nir_shader *nir, const struct brw_vue_map *vue); void brw_nir_lower_fs_inputs(nir_shader *nir, + const struct gen_device_info *devinfo, const struct brw_wm_prog_key *key); void brw_nir_lower_vue_outputs(nir_shader *nir, bool is_scalar); void brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map *vue);