<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 11, 2016 at 10:41 AM, 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">There are no standard sample positions defined in OpenGL and OpenGL<br>
ES specs. Implementations have the freedom to pick the positions<br>
which give plausible results. But the Vulkan 1.0 spec does define<br>
standard sample positions for different sample counts. Defined<br>
positions in Vulkan for all the sample counts except 8X match with<br>
the positions we set in i965. We have an upcoming plan to share the<br>
blorp code between OpenGL and Vulkan driver in near future. Keeping<br>
the 8X sample positions same on both the drivers will help us move<br>
in that direction.<br>
<br>
Here is an argument by Neil Roberts (from commit 20250e85) against<br>
any advantage of current 8X sample positions over the new ones:<br>
<br>
"The comment above for the 8x sample positions says that the hardware<br>
implements centroid interpolation by picking the centre-most sample<br>
that is inside the primitive. That implies that it might be worthwhile<br>
to pick a pattern that includes 0.5,0.5. However by experimentation<br>
this doesn't seem to actually be the case. With the sample positions<br>
in this patch, if I modify the piglit test below so that it instead<br>
reports the centroid position, it reports 0.492188,0.421875 which<br>
doesn't match any of the positions. If I modify the sample positions<br>
so that they include one at exactly 0.5,0.5 it doesn't help and it<br>
reports another position which is even further from the center for<br>
some reason.<br>
<br>
arb_gpu_shader5-<wbr>interpolateAtSample-different<br>
<br>
Kenneth Graunke experimented with some other patterns that have a<br>
higher standard deviation but I think after some discussion it was<br>
decided that it would be better to pick the same pattern as the other<br>
graphics API in case there are games that rely on this pattern."<br>
<br>
Observed no regressions in jenkins testing.<br></blockquote><div><br></div><div>Did you try the scaled blit tests?  I bet we have to rework 8x scaled blit for the new positions.<br><br></div><div>Thanks for working on this!  It's going to make the blorp transition way easier.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>multisample_state.h | 33 ++++++++---------------<br>
 1 file changed, 11 insertions(+), 22 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_multisample_state.h b/src/mesa/drivers/dri/i965/<wbr>brw_multisample_state.h<br>
index 42a7fd3..78fb03a 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_multisample_state.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_multisample_state.h<br>
@@ -46,20 +46,9 @@ static const uint32_t<br>
 brw_multisample_positions_4x = 0xae2ae662;<br>
<br>
 /**<br>
- * Sample positions are based on a solution to the "8 queens" puzzle.<br>
- * Rationale: in a solution to the 8 queens puzzle, no two queens share<br>
- * a row, column, or diagonal.  This is a desirable property for samples<br>
- * in a multisampling pattern, because it ensures that the samples are<br>
- * relatively uniformly distributed through the pixel.<br>
- *<br>
- * There are several solutions to the 8 queens puzzle (see<br>
- * <a href="http://en.wikipedia.org/wiki/Eight_queens_puzzle" rel="noreferrer" target="_blank">http://en.wikipedia.org/wiki/<wbr>Eight_queens_puzzle</a>).  This solution was<br>
- * chosen because it has a queen close to the center; this should<br>
- * improve the accuracy of centroid interpolation, since the hardware<br>
- * implements centroid interpolation by choosing the centermost sample<br>
- * that overlaps with the primitive being drawn.<br>
+ * Sample positions:<br></blockquote><div><br></div><div>Might be nice to reference the Vulkan spec here.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  *<br>
- * Note: from the Ivy Bridge PRM, Vol2 Part1 p304 (3DSTATE_MULTISAMPLE:<br>
+ * From the Ivy Bridge PRM, Vol2 Part1 p304 (3DSTATE_MULTISAMPLE:<br>
  * Programming Notes):<br>
  *<br>
  *     "When programming the sample offsets (for NUMSAMPLES_4 or _8 and<br>
@@ -70,17 +59,17 @@ brw_multisample_positions_4x = 0xae2ae662;<br>
  *<br>
  * Sample positions:<br>
  *   1 3 5 7 9 b d f<br>
- * 1     5<br>
- * 3           2<br>
- * 5               6<br>
- * 7 4<br>
- * 9       0<br>
- * b             3<br>
- * d         1<br>
- * f   7<br>
+ * 1               7<br>
+ * 3     3<br>
+ * 5         0<br>
+ * 7 5<br>
+ * 9             2<br>
+ * b       1<br>
+ * d   4<br>
+ * f           6<br>
  */<br>
 static const uint32_t<br>
-brw_multisample_positions_8x[<wbr>] = { 0xdbb39d79, 0x3ff55117 };<br>
+brw_multisample_positions_8x[<wbr>] = { 0x53d97b95, 0xf1bf173d };<br>
<br>
 /**<br>
  * Sample positions:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
</font></span></blockquote></div><br></div></div>