initialize_vertex_header(out);
- if (flags & (DO_CLIP_XY | DO_CLIP_FULL_Z | DO_CLIP_HALF_Z | DO_CLIP_USER)) {
+ if (flags & (DO_CLIP_XY | DO_CLIP_XY_GUARD_BAND |
+ DO_CLIP_FULL_Z | DO_CLIP_HALF_Z | DO_CLIP_USER)) {
out->clip[0] = position[0];
out->clip[1] = position[1];
out->clip[2] = position[2];
/* Do the hardwired planes first:
*/
- if (flags & DO_CLIP_XY) {
+ if (flags & DO_CLIP_XY_GUARD_BAND) {
+ if (-0.50 * position[0] + position[3] < 0) mask |= (1<<0);
+ if ( 0.50 * position[0] + position[3] < 0) mask |= (1<<1);
+ if (-0.50 * position[1] + position[3] < 0) mask |= (1<<2);
+ if ( 0.50 * position[1] + position[3] < 0) mask |= (1<<3);
+ }
+ else if (flags & DO_CLIP_XY) {
if (-position[0] + position[3] < 0) mask |= (1<<0);
if ( position[0] + position[3] < 0) mask |= (1<<1);
if (-position[1] + position[3] < 0) mask |= (1<<2);
static void update_clip_flags( struct draw_context *draw )
{
draw->clip_xy = !draw->driver.bypass_clip_xy;
+ draw->guard_band_xy = (!draw->driver.bypass_clip_xy &&
+ draw->driver.guard_band_xy);
draw->clip_z = (!draw->driver.bypass_clip_z &&
!draw->depth_clamp);
draw->clip_user = (draw->nr_planes > 6);
*/
void draw_set_driver_clipping( struct draw_context *draw,
boolean bypass_clip_xy,
- boolean bypass_clip_z )
+ boolean bypass_clip_z,
+ boolean guard_band_xy)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
draw->driver.bypass_clip_xy = bypass_clip_xy;
draw->driver.bypass_clip_z = bypass_clip_z;
+ draw->driver.guard_band_xy = guard_band_xy;
update_clip_flags(draw);
}
#define DO_CLIP_USER 0x8
#define DO_VIEWPORT 0x10
#define DO_EDGEFLAG 0x20
+#define DO_CLIP_XY_GUARD_BAND 0x40
struct pt_post_vs {
#define TAG(x) x##_xy_halfz_viewport
#include "draw_cliptest_tmp.h"
+#define FLAGS (DO_CLIP_XY_GUARD_BAND | DO_CLIP_HALF_Z | DO_VIEWPORT)
+#define TAG(x) x##_xy_gb_halfz_viewport
+#include "draw_cliptest_tmp.h"
+
#define FLAGS (DO_CLIP_FULL_Z | DO_VIEWPORT)
#define TAG(x) x##_fullz_viewport
#include "draw_cliptest_tmp.h"
boolean clip_xy,
boolean clip_z,
boolean clip_user,
+ boolean guard_band,
boolean bypass_viewport,
boolean opengl,
boolean need_edgeflags )
{
pvs->flags = 0;
- if (clip_xy)
+ /* This combination not currently tested/in use:
+ */
+ if (opengl)
+ guard_band = FALSE;
+
+ if (clip_xy && !guard_band) {
pvs->flags |= DO_CLIP_XY;
-
+ ASSIGN_4V( pvs->draw->plane[0], -1, 0, 0, 1 );
+ ASSIGN_4V( pvs->draw->plane[1], 1, 0, 0, 1 );
+ ASSIGN_4V( pvs->draw->plane[2], 0, -1, 0, 1 );
+ ASSIGN_4V( pvs->draw->plane[3], 0, 1, 0, 1 );
+ }
+ else if (clip_xy && guard_band) {
+ pvs->flags |= DO_CLIP_XY_GUARD_BAND;
+ ASSIGN_4V( pvs->draw->plane[0], -0.5, 0, 0, 1 );
+ ASSIGN_4V( pvs->draw->plane[1], 0.5, 0, 0, 1 );
+ ASSIGN_4V( pvs->draw->plane[2], 0, -0.5, 0, 1 );
+ ASSIGN_4V( pvs->draw->plane[3], 0, 0.5, 0, 1 );
+ }
+
if (clip_z && opengl) {
pvs->flags |= DO_CLIP_FULL_Z;
ASSIGN_4V( pvs->draw->plane[4], 0, 0, 1, 1 );
pvs->run = do_cliptest_xy_halfz_viewport;
break;
+ case DO_CLIP_XY_GUARD_BAND | DO_CLIP_HALF_Z | DO_VIEWPORT:
+ pvs->run = do_cliptest_xy_gb_halfz_viewport;
+ break;
+
case DO_CLIP_FULL_Z | DO_VIEWPORT:
pvs->run = do_cliptest_fullz_viewport;
break;