On 06/04/16 19:20, Jason Ekstrand wrote: > On Wed, Apr 6, 2016 at 12:47 AM, Samuel Iglesias Gonsálvez < > [email protected]> wrote: > >> >> >> On 06/04/16 08:03, Samuel Iglesias Gonsálvez wrote: >>> >>> >>> On 06/04/16 05:12, Jason Ekstrand wrote: >>>> --- >>>> src/mesa/drivers/dri/i965/brw_compiler.h | 6 ++++++ >>>> src/mesa/drivers/dri/i965/brw_fs.cpp | 31 >> +++++++++++++++++++++++++++++++ >>>> 2 files changed, 37 insertions(+) >>>> >>>> diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h >> b/src/mesa/drivers/dri/i965/brw_compiler.h >>>> index 231e000..3c7e382 100644 >>>> --- a/src/mesa/drivers/dri/i965/brw_compiler.h >>>> +++ b/src/mesa/drivers/dri/i965/brw_compiler.h >>>> @@ -403,6 +403,12 @@ struct brw_wm_prog_data { >>>> uint32_t barycentric_interp_modes; >>>> >>>> /** >>>> + * Mask of which FS inputs are marked flat by the shader source. >> This is >>>> + * needed for setting up 3DSTATE_FS/SBE. >>>> + */ >>>> + uint32_t flat_inputs; >>>> + >>> >>> I think this should be uint64_t. If we are using all the available >>> locations (48 VARYING_SLOT_* that can appear in FS, according to >>> gl_varying_slot) then there would be input_index values higher than 32. >>> >>> With that fixed, >>> >> >> Forget it. The definition of "Constant Interpolation Enable" in >> 3D_STATE_SBE indicates that it should be a 32-bit size value. >> > > That's correct. We can only have at most 32 inputs pushed into the FS. > (Actually 33 if you include gl_FragCoord, but that's magic). The value in > flat_inputs is exactly the 32-bit value that you need to plug into > 3DSTATE_SF. Maybe I didn't make that clear?
OK right. Then you can add my R-b. Sam > --Jason > > >>> Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> >>> >>> Sam >>> >>>> + /** >>>> * Map from gl_varying_slot to the position within the FS setup data >>>> * payload where the varying's attribute vertex deltas should be >> delivered. >>>> * For varying slots that are not used by the FS, the value is -1. >>>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp >> b/src/mesa/drivers/dri/i965/brw_fs.cpp >>>> index 1a6a229..fede15f 100644 >>>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp >>>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp >>>> @@ -5565,6 +5565,31 @@ brw_compute_barycentric_interp_modes(const >> struct brw_device_info *devinfo, >>>> 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 >>>> computed_depth_mode(const nir_shader *shader) >>>> { >>>> @@ -5649,6 +5674,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; >>>> int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || use_rep_send; >>>> if ((no_simd8 || compiler->devinfo->gen < 5) && simd16_cfg) { >>>> >>> _______________________________________________ >>> mesa-dev mailing list >>> [email protected] >>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev >>> >> > _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
