summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c12
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h3
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_clip.c31
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c3
6 files changed, 47 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 2b3bc0d0ece..9b5bcb5a3be 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -262,6 +262,10 @@ static void update_clip_flags( struct draw_context *draw )
draw->rasterizer && draw->rasterizer->depth_clip);
draw->clip_user = draw->rasterizer &&
draw->rasterizer->clip_plane_enable != 0;
+ draw->clip_points_xy = draw->clip_xy &&
+ (!draw->driver.bypass_clip_points ||
+ (draw->rasterizer &&
+ !draw->rasterizer->point_tri_clip));
}
/**
@@ -287,17 +291,23 @@ void draw_set_rasterizer_state( struct draw_context *draw,
* Some hardware can turn off clipping altogether - in particular any
* hardware with a TNL unit can do its own clipping, even if it is
* relying on the draw module for some other reason.
+ * Setting bypass_clip_points to achieve d3d-style point clipping (the driver
+ * will need to do the "vp scissoring") _requires_ the driver to implement
+ * wide points / point sprites itself (points will still be clipped if rasterizer
+ * point_tri_clip isn't set). Only relevant if bypass_clip_xy isn't set.
*/
void draw_set_driver_clipping( struct draw_context *draw,
boolean bypass_clip_xy,
boolean bypass_clip_z,
- boolean guard_band_xy)
+ boolean guard_band_xy,
+ boolean bypass_clip_points)
{
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;
+ draw->driver.bypass_clip_points = bypass_clip_points;
update_clip_flags(draw);
}
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index e2e0cb4dad6..65716c93ccc 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -263,7 +263,8 @@ void draw_set_render( struct draw_context *draw,
void draw_set_driver_clipping( struct draw_context *draw,
boolean bypass_clip_xy,
boolean bypass_clip_z,
- boolean guard_band_xy);
+ boolean guard_band_xy,
+ boolean bypass_clip_points);
void draw_set_force_passthrough( struct draw_context *draw,
boolean enable );
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c
index dbb67575843..adfa4b6e8b9 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
@@ -609,12 +609,37 @@ do_clip_line( struct draw_stage *stage,
static void
clip_point( struct draw_stage *stage,
- struct prim_header *header )
+ struct prim_header *header )
{
- if (header->v[0]->clipmask == 0)
+ if (header->v[0]->clipmask == 0)
stage->next->point( stage->next, header );
}
+/*
+ * Clip points but ignore the first 4 (xy) clip planes.
+ * (This is necessary because we don't generate a different shader variant
+ * just for points hence xy clip bits are still generated. This is not really
+ * optimal because of the extra calculations both in generating clip masks
+ * and executing the clip stage but it gets the job done.)
+ */
+static void
+clip_point_no_xy( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ if ((header->v[0]->clipmask & 0xfffffff0) == 0)
+ stage->next->point( stage->next, header );
+}
+
+
+
+static void
+clip_first_point( struct draw_stage *stage,
+ struct prim_header *header )
+{
+ stage->point = stage->draw->clip_points_xy ? clip_point : clip_point_no_xy;
+ stage->point(stage, header);
+}
+
static void
clip_line( struct draw_stage *stage,
@@ -822,7 +847,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw )
clipper->stage.draw = draw;
clipper->stage.name = "clipper";
- clipper->stage.point = clip_point;
+ clipper->stage.point = clip_first_point;
clipper->stage.line = clip_first_line;
clipper->stage.tri = clip_first_tri;
clipper->stage.flush = clip_flush;
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index fbe25a264c5..5bcb8a8add5 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -217,6 +217,7 @@ struct draw_context
boolean bypass_clip_xy;
boolean bypass_clip_z;
boolean guard_band_xy;
+ boolean bypass_clip_points;
} driver;
boolean quads_always_flatshade_last;
@@ -231,6 +232,7 @@ struct draw_context
boolean clip_z;
boolean clip_user;
boolean guard_band_xy;
+ boolean clip_points_xy;
boolean force_passthrough; /**< never clip or shade */
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index 8fcc17048d2..ab8a0c6ab39 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -104,7 +104,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
fpme->vertex_size,
instance_id_index );
draw_pt_post_vs_prepare( fpme->post_vs,
- draw->clip_xy,
+ gs_out_prim == PIPE_PRIM_POINTS ?
+ draw->clip_points_xy : draw->clip_xy,
draw->clip_z,
draw->clip_user,
draw->guard_band_xy,
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
index 846e1d58052..bca658f2c05 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
@@ -155,7 +155,8 @@ llvm_middle_end_prepare( struct draw_pt_middle_end *middle,
draw_pt_post_vs_prepare( fpme->post_vs,
- draw->clip_xy,
+ out_prim == PIPE_PRIM_POINTS ?
+ draw->clip_points_xy : draw->clip_xy,
draw->clip_z,
draw->clip_user,
draw->guard_band_xy,