<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 1:29 PM, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.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="">On Wed, Sep 14, 2016 at 10:45 AM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> From the ARB_gpu_shader5 spec:<br>
><br>
>    The built-in functions interpolateAtCentroid() and interpolateAtSample()<br>
>    will sample variables as though they were declared with the "centroid"<br>
>    or "sample" qualifiers, respectively.<br>
><br>
> When running with persample dispatch forced by the API, we interpolate<br>
> anything that isn't flat as if it's qualified by "sample".  In order to<br>
> keep interpolateAtCentroid() consistent with the "centroid" qualifier, we<br>
> need to make interpolateAtCentroid() do sample interpolation instead.<br>
> Nothing in the GLSL spec guarantees that the result of<br>
> interpolateAtCentroid is uniform across samples in any way, so this is a<br>
> perfectly fine thing to do.<br>
><br>
</span>This explanation sounds good to me. To be consistent with what<br>
we do in case of per sample interpolation, shouldn't we do sample<br>
interpolation in case of InterpolateAtOffset() too? This series<br>
doesn't seem to include it.<br></blockquote><div><br></div><div>No.  interpolateAtOffset ask that the input be interpolated at a particular offset relative to the pixel center.  I believe we have to respect that.<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">
> Fixes 8 of the new dEQP-VK.pipeline.multisample_<wbr>interpolation.* Vulkan CTS<br>
> tests that specifically validate consistency between the "sample" qualifier<br>
> and interpolateAtSample()<br>
><br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_<wbr>fs.cpp | 26 ++++++++++++++++++++++++++<br>
>  1 file changed, 26 insertions(+)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp<br>
> index 75642d3..9dbb699 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp<br>
> @@ -6497,6 +6497,32 @@ brw_nir_set_default_<wbr>interpolation(const struct gen_device_info *devinfo,<br>
>           var->data.sample = false;<br>
>        }<br>
>     }<br>
> +<br>
> +   if (per_sample_interpolation) {<br>
> +      nir_foreach_block(block, nir_shader_get_entrypoint(nir)<wbr>) {<br>
> +         nir_foreach_instr(instr, block) {<br>
> +            if (instr->type != nir_instr_type_intrinsic)<br>
> +               continue;<br>
> +<br>
> +            nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);<br>
> +            if (intrin->intrinsic != nir_intrinsic_interp_var_at_<wbr>centroid)<br>
> +               continue;<br>
> +<br>
> +            nir_variable *var = intrin->variables[0]->var;<br>
> +            if (var->data.interpolation == INTERP_MODE_FLAT)<br>
> +               continue;<br>
> +<br>
> +            /* The description of the interpolateAtCentroid intrinsic is that<br>
> +             * it interpolates the variable as if it had the "centroid"<br>
> +             * qualifier.  When executing with per_sample_interpolation, this<br>
> +             * is equivalent to having the "sample" qualifier.  Just convert<br>
> +             * it to a load_var instead.<br>
> +             */<br>
> +            assert(var->data.sample);<br>
> +            intrin->intrinsic = nir_intrinsic_load_var;<br>
> +         }<br>
> +      }<br>
> +   }<br>
>  }<br>
><br>
>  /**<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<wbr>_________________<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/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>