[Mesa-dev] [PATCH 5/5] i965: Stop XY clipping point and line primitives.

Roland Scheidegger sroland at vmware.com
Fri Mar 11 01:50:46 UTC 2016


Technically, this is still wrong for rendering traditional gl points,
which indeed require points either be drawn in full (even the parts
outside viewport, if the center is inside viewport) or not at all (if
the center is outside viewport). Albeit the gles language may be
different (and looks like gets cleared up even) the rules for gl are
still the same
However, just about everybody seems to hate the traditional point
clipping, and some vendors never implemented it that way anyway (or did
so on a case-by-case base even depending on whatever...). (d3d9 rules
required it the same as what you're doing in this change here fwiw, so
same as gles, whereas d3d10 "fixed" this problem by not actually
supporting large points at all...)

Roland


Am 11.03.2016 um 01:59 schrieb Kenneth Graunke:
> Wide points and lines are not supposed to be clipped by the viewport.
> Rather, they should be rendered, and any fragments outside of the
> viewport should be discarded.
> 
> The traditional use case for this behavior is rendering moving wide
> point particles.  When the center of the point approaches the viewport
> edge, clipping would make it pop out of view early.
> 
> Fixes:
> - dEQP-GLES2.functional.clipping.point.wide_point_clip
> - dEQP-GLES3.functional.clipping.point.wide_point_clip
> - dEQP-GLES3.functional.clipping.point.wide_point_clip_viewport_center
> - dEQP-GLES3.functional.clipping.point.wide_point_clip_viewport_corner
> - dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_center
> - dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_corner
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94453
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94454
> Bugzilla: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=10698
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/gen6_clip_state.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
> index 9a29366..004eceb 100644
> --- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
> @@ -174,12 +174,14 @@ upload_clip_state(struct brw_context *brw)
>     else
>        enable = GEN6_CLIP_ENABLE;
>  
> +   if (!is_drawing_points(brw) && !is_drawing_lines(brw))
> +      dw2 |= GEN6_CLIP_XY_TEST;
> +
>     BEGIN_BATCH(4);
>     OUT_BATCH(_3DSTATE_CLIP << 16 | (4 - 2));
>     OUT_BATCH(dw1);
>     OUT_BATCH(enable |
>  	     GEN6_CLIP_MODE_NORMAL |
> -	     GEN6_CLIP_XY_TEST |
>  	     dw2);
>     OUT_BATCH(U_FIXED(0.125, 3) << GEN6_CLIP_MIN_POINT_WIDTH_SHIFT |
>               U_FIXED(255.875, 3) << GEN6_CLIP_MAX_POINT_WIDTH_SHIFT |
> @@ -195,7 +197,9 @@ const struct brw_tracked_state gen6_clip_state = {
>                 _NEW_TRANSFORM,
>        .brw   = BRW_NEW_CONTEXT |
>                 BRW_NEW_FS_PROG_DATA |
> +               BRW_NEW_GEOMETRY_PROGRAM |
>                 BRW_NEW_META_IN_PROGRESS |
> +               BRW_NEW_PRIMITIVE |
>                 BRW_NEW_RASTERIZER_DISCARD,
>     },
>     .emit = upload_clip_state,
> @@ -209,7 +213,9 @@ const struct brw_tracked_state gen7_clip_state = {
>                 _NEW_TRANSFORM,
>        .brw   = BRW_NEW_CONTEXT |
>                 BRW_NEW_FS_PROG_DATA |
> +               BRW_NEW_GEOMETRY_PROGRAM |
>                 BRW_NEW_META_IN_PROGRESS |
> +               BRW_NEW_PRIMITIVE |
>                 BRW_NEW_RASTERIZER_DISCARD,
>     },
>     .emit = upload_clip_state,
> 



More information about the mesa-dev mailing list