<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 6, 2016 at 12:47 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 06/04/16 08:03, Samuel Iglesias Gonsálvez wrote:<br>
><br>
><br>
> On 06/04/16 05:12, Jason Ekstrand wrote:<br>
>> ---<br>
>> src/mesa/drivers/dri/i965/brw_compiler.h | 6 ++++++<br>
>> src/mesa/drivers/dri/i965/brw_fs.cpp | 31 +++++++++++++++++++++++++++++++<br>
>> 2 files changed, 37 insertions(+)<br>
>><br>
>> diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h<br>
>> index 231e000..3c7e382 100644<br>
>> --- a/src/mesa/drivers/dri/i965/brw_compiler.h<br>
>> +++ b/src/mesa/drivers/dri/i965/brw_compiler.h<br>
>> @@ -403,6 +403,12 @@ struct brw_wm_prog_data {<br>
>> uint32_t barycentric_interp_modes;<br>
>><br>
>> /**<br>
>> + * Mask of which FS inputs are marked flat by the shader source. This is<br>
>> + * needed for setting up 3DSTATE_FS/SBE.<br>
>> + */<br>
>> + uint32_t flat_inputs;<br>
>> +<br>
><br>
> I think this should be uint64_t. If we are using all the available<br>
> locations (48 VARYING_SLOT_* that can appear in FS, according to<br>
> gl_varying_slot) then there would be input_index values higher than 32.<br>
><br>
> With that fixed,<br>
><br>
<br>
</span>Forget it. The definition of "Constant Interpolation Enable" in<br>
3D_STATE_SBE indicates that it should be a 32-bit size value.<br></blockquote><div><br></div><div>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?<br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
> Reviewed-by: Samuel Iglesias Gonsálvez <<a href="mailto:siglesias@igalia.com">siglesias@igalia.com</a>><br>
><br>
> Sam<br>
><br>
>> + /**<br>
>> * Map from gl_varying_slot to the position within the FS setup data<br>
>> * payload where the varying's attribute vertex deltas should be delivered.<br>
>> * For varying slots that are not used by the FS, the value is -1.<br>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
>> index 1a6a229..fede15f 100644<br>
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp<br>
>> @@ -5565,6 +5565,31 @@ brw_compute_barycentric_interp_modes(const struct brw_device_info *devinfo,<br>
>> return barycentric_interp_modes;<br>
>> }<br>
>><br>
>> +static void<br>
>> +brw_compute_flat_inputs(struct brw_wm_prog_data *prog_data,<br>
>> + bool shade_model_flat, const nir_shader *shader)<br>
>> +{<br>
>> + prog_data->flat_inputs = 0;<br>
>> +<br>
>> + nir_foreach_variable(var, &shader->inputs) {<br>
>> + enum glsl_interp_qualifier interp_qualifier =<br>
>> + (enum glsl_interp_qualifier)var->data.interpolation;<br>
>> + bool is_gl_Color = (var->data.location == VARYING_SLOT_COL0) ||<br>
>> + (var->data.location == VARYING_SLOT_COL1);<br>
>> +<br>
>> + int input_index = prog_data->urb_setup[var->data.location];<br>
>> +<br>
>> + if (input_index < 0)<br>
>> + continue;<br>
>> +<br>
>> + /* flat shading */<br>
>> + if (interp_qualifier == INTERP_QUALIFIER_FLAT ||<br>
>> + (shade_model_flat && is_gl_Color &&<br>
>> + interp_qualifier == INTERP_QUALIFIER_NONE))<br>
>> + prog_data->flat_inputs |= (1 << input_index);<br>
>> + }<br>
>> +}<br>
>> +<br>
>> static uint8_t<br>
>> computed_depth_mode(const nir_shader *shader)<br>
>> {<br>
>> @@ -5649,6 +5674,12 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,<br>
>> }<br>
>> }<br>
>><br>
>> + /* We have to compute the flat inputs after the visitor is finished running<br>
>> + * because it relies on prog_data->urb_setup which is computed in<br>
>> + * fs_visitor::calculate_urb_setup().<br>
>> + */<br>
>> + brw_compute_flat_inputs(prog_data, key->flat_shade, shader);<br>
>> +<br>
>> cfg_t *simd8_cfg;<br>
>> int no_simd8 = (INTEL_DEBUG & DEBUG_NO8) || use_rep_send;<br>
>> if ((no_simd8 || compiler->devinfo->gen < 5) && simd16_cfg) {<br>
>><br>
</div></div>> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
><br>
</blockquote></div><br></div></div>