On 05/08/2012 04:07 PM, Eric Anholt wrote:
On Fri, 4 May 2012 17:06:38 -0700, Kenneth Graunke<kenn...@whitecape.org>
wrote:
- vp->xmin = -1.0;
- vp->xmax = 1.0;
- vp->ymin = -1.0;
- vp->ymax = 1.0;
+ /* According to the Sandybridge PRM, Volume 2, Part 1, Section 6.3.8
+ * "Vertex X,Y Clamping and Quantization", the screen-aligned 2D
+ * bounding-box of an object must not exceed 16K pixels in either X or Y.
+ */
+ const float maximum_post_clamp_delta = 16384;
+ float gbx = maximum_post_clamp_delta / (float) ctx->Viewport.Width;
+ float gby = maximum_post_clamp_delta / (float) ctx->Viewport.Height;
+
+ vp->xmin = -gbx;
+ vp->xmax = gbx;
+ vp->ymin = -gby;
+ vp->ymax = gby;
Aren't you letting primitives extend from -16384 to 16384 this way?
I don't think so. I originally had this halved, but Paul and I worked
through the math together and independenty decided this was right.
Here's my math:
NDC_VP_Width = 2 // since the viewport is -1.0 to 1.0
// Screen space viewport width is NDC VP width times some scale factor
Viewport.Width = NDC_VP_Width * scale
Viewport.Width = 2 * scale
scale = Viewport.Width / 2
// We can use the same scale factor to compute the GB NDC size:
16384 = NDC_GB_Width * scale
16384 = NDC_GB_Width * (Viewport.Width / 2)
16384 * (2 / Viewport.Width) = NDC_GB_Width
32768 / Viewport.Width = NDC_GB_Width
// The coordinates we want are [-width/2, width/2]:
GBX = NDC_GB_Width / 2
GBX = 16384 / Viewport.Width
--------------------------------
I also experimentally verified that my piglit test works at these
numbers, and going much beyond this causes noticable issues.
Convinced?
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev