draw: clean up d3d style point clipping
authorRoland Scheidegger <sroland@vmware.com>
Fri, 17 Jan 2014 18:39:19 +0000 (19:39 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 20 Jan 2014 16:45:53 +0000 (17:45 +0100)
commit8c0368abb9474d092e33f79773bfbb457d4d9edd
tree4efb0151a29e6f6c7a5cad98f55e70397444e0ae
parent799abb271a248f646faa5cc859968f8c71e1ef16
draw: clean up d3d style point clipping

Instead of skipping x/y clipping completely if there's point_tri_clip points
use guard band clipping. This should be easier (previously we could not disable
generating the x/y bits in the clip mask for llvm path, hence requiring custom
clip path), and it also allows us to enable this for tris-as-points more easily
too (this would require custom tri clip filtering too otherwise). Moreover,
some unexpected things could have happen if there's a NaN or just a huge number
in some tri-turned-point, as the driver's rasterizer would need to deal with it
and that might well lead to undefined behavior in typical rasterizers (which
need to convert these numbers to fixed point). Using a guardband should hence
be more robust, while "usually" guaranteeing the same results. (Only "usually"
because unlike hw guardbands draw guardband is always just twice the vp size,
hence small vp but large points could still lead to different results.)
Unfortunately because the clipmask generated is completely unaffected by guard
band clipping, we still need a custom clip stage for points (but not for tris,
as the actual clipping there takes guard band into account).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_pipe_clip.c
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c