i965/fs: Add a flat_inputs field to prog_data

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand 2016-04-05 18:19:34 -07:00
parent 5c5a9b7bf6
commit e61cc87c75
2 changed files with 37 additions and 0 deletions

View file

@ -402,6 +402,12 @@ struct brw_wm_prog_data {
*/ */
uint32_t barycentric_interp_modes; uint32_t barycentric_interp_modes;
/**
* Mask of which FS inputs are marked flat by the shader source. This is
* needed for setting up 3DSTATE_SF/SBE.
*/
uint32_t flat_inputs;
/** /**
* Map from gl_varying_slot to the position within the FS setup data * Map from gl_varying_slot to the position within the FS setup data
* payload where the varying's attribute vertex deltas should be delivered. * payload where the varying's attribute vertex deltas should be delivered.

View file

@ -5578,6 +5578,31 @@ brw_compute_barycentric_interp_modes(const struct brw_device_info *devinfo,
return barycentric_interp_modes; return barycentric_interp_modes;
} }
static void
brw_compute_flat_inputs(struct brw_wm_prog_data *prog_data,
bool shade_model_flat, const nir_shader *shader)
{
prog_data->flat_inputs = 0;
nir_foreach_variable(var, &shader->inputs) {
enum glsl_interp_qualifier interp_qualifier =
(enum glsl_interp_qualifier)var->data.interpolation;
bool is_gl_Color = (var->data.location == VARYING_SLOT_COL0) ||
(var->data.location == VARYING_SLOT_COL1);
int input_index = prog_data->urb_setup[var->data.location];
if (input_index < 0)
continue;
/* flat shading */
if (interp_qualifier == INTERP_QUALIFIER_FLAT ||
(shade_model_flat && is_gl_Color &&
interp_qualifier == INTERP_QUALIFIER_NONE))
prog_data->flat_inputs |= (1 << input_index);
}
}
static uint8_t static uint8_t
computed_depth_mode(const nir_shader *shader) computed_depth_mode(const nir_shader *shader)
{ {
@ -5662,6 +5687,12 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,
} }
} }
/* We have to compute the flat inputs after the visitor is finished running
* because it relies on prog_data->urb_setup which is computed in
* fs_visitor::calculate_urb_setup().
*/
brw_compute_flat_inputs(prog_data, key->flat_shade, shader);
cfg_t *simd8_cfg; cfg_t *simd8_cfg;
int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || use_rep_send; int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || use_rep_send;
if ((no_simd8 || compiler->devinfo->gen < 5) && simd16_cfg) { if ((no_simd8 || compiler->devinfo->gen < 5) && simd16_cfg) {