<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Sep 3, 2016 at 11:44 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"><div class="HOEnZb"><div class="h5">On Saturday, September 3, 2016 10:42:01 AM PDT Jason Ekstrand wrote:<br>
> The result of this calculation goes into an fma() in the shader and we<br>
> would like it to be as precise as possible. The division in particular,<br>
> was a source of inprecision whenever dst1 - dst0 was not a power of two.<br>
> This fixes a bunch of the new Vulkan CTS tests for blitting using a<br>
> filtering of NEAREST.<br>
><br>
> Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
> src/intel/blorp/blorp_blit.c | 6 +++---<br>
> 1 file changed, 3 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c<br>
> index f4d81e6..0cb8b1a 100644<br>
> --- a/src/intel/blorp/blorp_blit.c<br>
> +++ b/src/intel/blorp/blorp_blit.c<br>
> @@ -1256,7 +1256,7 @@ brw_blorp_setup_coord_<wbr>transform(struct brw_blorp_coord_transform *xform,<br>
> GLfloat dst0, GLfloat dst1,<br>
> bool mirror)<br>
> {<br>
> - float scale = (src1 - src0) / (dst1 - dst0);<br>
> + double scale = (double)(src1 - src0) / (double)(dst1 - dst0);<br>
> if (!mirror) {<br>
> /* When not mirroring a coordinate (say, X), we need:<br>
> * src_x - src_x0 = (dst_x - dst_x0 + 0.5) * scale<br>
> @@ -1269,7 +1269,7 @@ brw_blorp_setup_coord_<wbr>transform(struct brw_blorp_coord_transform *xform,<br>
> * so 0.5 provides the necessary correction.<br>
> */<br>
> xform->multiplier = scale;<br>
> - xform->offset = src0 + (-dst0 + 0.5f) * scale;<br>
> + xform->offset = src0 + (-(double)dst0 + 0.5) * scale;<br>
> } else {<br>
> /* When mirroring X we need:<br>
> * src_x - src_x0 = dst_x1 - dst_x - 0.5<br>
> @@ -1277,7 +1277,7 @@ brw_blorp_setup_coord_<wbr>transform(struct brw_blorp_coord_transform *xform,<br>
> * src_x = src_x0 + (dst_x1 -dst_x - 0.5) * scale<br>
> */<br>
> xform->multiplier = -scale;<br>
> - xform->offset = src0 + (dst1 - 0.5f) * scale;<br>
> + xform->offset = src0 + ((double)dst1 - 0.5) * scale;<br>
> }<br>
> }<br>
<br>
</div></div>Sounds reasonable.<br>
<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
<br>
(really more of an ack, but...)<br>
</blockquote></div><br></div><div class="gmail_extra">Thanks!<br></div></div>