<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 13, 2016 at 1:42 AM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fixes 5 dEQP-GLES31.functional.shaders.multisample_interpolation tests:<br>
- interpolate_at_offset.no_qualifiers.default_framebuffer<br>
- interpolate_at_offset.centroid_qualifier.default_framebuffer<br>
- interpolate_at_offset.sample_qualifier.default_framebuffer<br>
- interpolate_at_offset.at_sample_position.default_framebuffer<br>
- interpolate_at_offset.array_element.default_framebuffer<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 8 ++++++--<br>
 src/mesa/drivers/dri/i965/brw_wm.c       | 3 ++-<br>
 2 files changed, 8 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
index 4648c58..5890750 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
@@ -2871,9 +2871,12 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld,<br>
       case nir_intrinsic_interp_var_at_offset: {<br>
          nir_const_value *const_offset = nir_src_as_const_value(instr->src[0]);<br>
<br>
+         const bool flip = !wm_key->render_to_fbo;<br>
+<br>
          if (const_offset) {<br>
             unsigned off_x = MIN2((int)(const_offset->f32[0] * 16), 7) & 0xf;<br>
-            unsigned off_y = MIN2((int)(const_offset->f32[1] * 16), 7) & 0xf;<br>
+            unsigned off_y = MIN2((int)(const_offset->f32[1] * 16 *<br>
+                                        (flip ? -1 : 1)), 7) & 0xf;<br>
<br>
             emit_pixel_interpolater_send(bld,<br>
                                          FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET,<br>
@@ -2889,7 +2892,8 @@ fs_visitor::nir_emit_fs_intrinsic(const fs_builder &bld,<br>
                fs_reg temp = vgrf(glsl_type::float_type);<br>
                bld.MUL(temp, offset(offset_src, bld, i), brw_imm_f(16.0f));<br>
                fs_reg itemp = vgrf(glsl_type::int_type);<br>
-               bld.MOV(itemp, temp);  /* float to int */<br>
+               /* float to int */<br>
+               bld.MOV(itemp, (i == 1 && flip) ? negate(temp) : temp);<br>
<br>
                /* Clamp the upper end of the range to +7/16.<br>
                 * ARB_gpu_shader5 requires that we support a maximum offset<br>
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c<br>
index ced9708..192e8e2 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_wm.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_wm.c<br>
@@ -511,7 +511,8 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)<br>
       key->drawable_height = _mesa_geometric_height(ctx->DrawBuffer);<br>
    }<br>
<br>
-   if ((fp->program.Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {<br>
+   if ((fp->program.Base.InputsRead & VARYING_BIT_POS) ||<br>
+       program_uses_dfdy || prog->nir->info.uses_interp_var_at_offset) {<br></blockquote><div><br></div><div>It's kind of lame that we have to add something to nir_shader_info just for optimistically setting the key.  :-(  I guess not that many shaders use things that actually need render_to_fbo so it's best to not set it all the time.  Thanks for fixing the key bit!<br><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
       key->render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer);<br>
    }<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.8.2<br>
<br>
</font></span></blockquote></div><br></div></div>