diff options
author | Eric Anholt <[email protected]> | 2013-01-23 14:30:05 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2013-01-25 09:04:52 -0500 |
commit | 416326e33780fda0580292f9c2ace0b7c2c520e3 (patch) | |
tree | c2db06b5ddda33ee2ffabdb1bfa073eeb8048fd3 | |
parent | 9db2098d18dd28cbb4f9f98ec9e8f9d579608c38 (diff) |
i965: Correct gen6+ guardband calculation.
Too much attention was paid to the first paragraphs, and not enough to
the last little note that "oh, by the way, the rendered things
themselves still have to be clipped to just 8192 wide/high".
Fixes GTF's clip.c test with 4096 or higher width on ivb, where one of
the triangles got the upper half of its pixels dropped.
Tested-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_viewport_state.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_viewport_state.c | 15 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_viewport_state.c b/src/mesa/drivers/dri/i965/gen6_viewport_state.c index 95243f08c50..cffb16c6058 100644 --- a/src/mesa/drivers/dri/i965/gen6_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen6_viewport_state.c @@ -43,11 +43,18 @@ gen6_upload_clip_vp(struct brw_context *brw) vp = brw_state_batch(brw, AUB_TRACE_CLIP_VP_STATE, sizeof(*vp), 32, &brw->clip.vp_offset); - /* 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. + /* According to the "Vertex X,Y Clamping and Quantization" section of the + * Strips and Fans documentation, objects must not have a screen-space + * extents of over 8192 pixels, or they may be mis-rasterized. The maximum + * screen space coordinates of a small object may larger, but we have no + * way to enforce the object size other than through clipping. + * + * If you're surprised that we set clip to -gbx to +gbx and it seems like + * we'll end up with 16384 wide, note that for a 8192-wide render target, + * we'll end up with a normal (-1, 1) clip volume that just covers the + * drawable. */ - const float maximum_post_clamp_delta = 16384; + const float maximum_post_clamp_delta = 8192; float gbx = maximum_post_clamp_delta / (float) ctx->Viewport.Width; float gby = maximum_post_clamp_delta / (float) ctx->Viewport.Height; diff --git a/src/mesa/drivers/dri/i965/gen7_viewport_state.c b/src/mesa/drivers/dri/i965/gen7_viewport_state.c index 7036ef6e161..150e89044ec 100644 --- a/src/mesa/drivers/dri/i965/gen7_viewport_state.c +++ b/src/mesa/drivers/dri/i965/gen7_viewport_state.c @@ -44,12 +44,17 @@ gen7_upload_sf_clip_viewport(struct brw_context *brw) brw->clip.vp_offset = brw->sf.vp_offset; /* According to the "Vertex X,Y Clamping and Quantization" section of the - * Strips and Fans documentation, Ivybridge and later don't have a maximum - * post-clamp delta. However, the guardband extent must fit in [-32K, 32K) - * which gives us a maximum size of 64K. Use 65000 rather than 65536 to be - * somewhat cautious---make the guardband slightly smaller than the maximum. + * Strips and Fans documentation, objects must not have a screen-space + * extents of over 8192 pixels, or they may be mis-rasterized. The maximum + * screen space coordinates of a small object may larger, but we have no + * way to enforce the object size other than through clipping. + * + * If you're surprised that we set clip to -gbx to +gbx and it seems like + * we'll end up with 16384 wide, note that for a 8192-wide render target, + * we'll end up with a normal (-1, 1) clip volume that just covers the + * drawable. */ - const float maximum_guardband_extent = 65000; + const float maximum_guardband_extent = 8192; float gbx = maximum_guardband_extent / (float) ctx->Viewport.Width; float gby = maximum_guardband_extent / (float) ctx->Viewport.Height; |