diff options
author | Jason Ekstrand <[email protected]> | 2016-09-14 10:42:42 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-09-15 13:31:43 -0700 |
commit | 111f6b250d01fa1937103f24b5cb54b15dd77fbf (patch) | |
tree | 9c6c1e03276f400497f14f2cc855cd8ed1a99a9e /src | |
parent | 246db0063eb6e01aad961b1c73d32fca911ae1df (diff) |
i965/nir: Roll set_default_interpolation into lower_fs_inputs
Signed-off-by: Jason Ekstrand <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 40 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_nir.c | 24 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_nir.h | 1 |
3 files changed, 26 insertions, 39 deletions
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 @@ -6373,42 +6373,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. * * Useful when rendering to a non-multisampled buffer. @@ -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); |