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));
+ draw->guard_band_points_xy = draw->guard_band_xy ||
+ (draw->driver.bypass_clip_points &&
+ (draw->rasterizer &&
+ draw->rasterizer->point_tri_clip));
}
/**
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.)
+ * (Because the generated clip mask is completely unaffacted by guard band,
+ * we still need to manually evaluate the x/y planes if they are outside
+ * the guard band and not just outside the vp.)
*/
static void
-clip_point_no_xy( struct draw_stage *stage,
- struct prim_header *header )
+clip_point_guard_xy( struct draw_stage *stage,
+ struct prim_header *header )
{
- if ((header->v[0]->clipmask & 0xfffffff0) == 0)
- stage->next->point( stage->next, header );
+ unsigned clipmask = header->v[0]->clipmask;
+ if ((clipmask & 0xffffffff) == 0)
+ stage->next->point(stage->next, header);
+ else if ((clipmask & 0xfffffff0) == 0) {
+ while (clipmask) {
+ const unsigned plane_idx = ffs(clipmask)-1;
+ clipmask &= ~(1 << plane_idx); /* turn off this plane's bit */
+ /* TODO: this should really do proper guardband clipping,
+ * currently just throw out infs/nans.
+ */
+ if (util_is_inf_or_nan(header->v[0]->clip[0]) ||
+ util_is_inf_or_nan(header->v[0]->clip[1]))
+ return;
+ }
+ stage->next->point(stage->next, header);
+ }
}
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->draw->guard_band_points_xy ? clip_point_guard_xy : clip_point;
stage->point(stage, header);
}
static void
clip_tri( struct draw_stage *stage,
- struct prim_header *header )
+ struct prim_header *header )
{
unsigned clipmask = (header->v[0]->clipmask |
header->v[1]->clipmask |
boolean clip_z;
boolean clip_user;
boolean guard_band_xy;
- boolean clip_points_xy;
+ boolean guard_band_points_xy;
boolean force_passthrough; /**< never clip or shade */
*/
static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
unsigned prim,
- unsigned opt,
+ unsigned opt,
unsigned *max_vertices )
{
struct fetch_pipeline_middle_end *fpme = (struct fetch_pipeline_middle_end *)middle;
const unsigned gs_out_prim = (gs ? gs->output_primitive :
u_assembled_prim(prim));
- unsigned nr = MAX2( vs->info.num_inputs,
- draw_total_vs_outputs(draw) );
+ unsigned nr = MAX2(vs->info.num_inputs,
+ draw_total_vs_outputs(draw));
+ unsigned point_clip = draw->rasterizer->fill_front == PIPE_POLYGON_MODE_POINT ||
+ gs_out_prim == PIPE_PRIM_POINTS;
if (gs) {
nr = MAX2(nr, gs->info.num_outputs + 1);
*/
fpme->vertex_size = sizeof(struct vertex_header) + nr * 4 * sizeof(float);
-
draw_pt_fetch_prepare( fpme->fetch,
vs->info.num_inputs,
fpme->vertex_size,
instance_id_index );
draw_pt_post_vs_prepare( fpme->post_vs,
- gs_out_prim == PIPE_PRIM_POINTS ?
- draw->clip_points_xy : draw->clip_xy,
+ draw->clip_xy,
draw->clip_z,
draw->clip_user,
- draw->guard_band_xy,
+ point_clip ? draw->guard_band_points_xy :
+ draw->guard_band_xy,
draw->identity_viewport,
draw->rasterizer->clip_halfz,
(draw->vs.edgeflag_output ? TRUE : FALSE) );
u_assembled_prim(in_prim);
const unsigned nr = MAX2(vs->info.num_inputs,
draw_total_vs_outputs(draw));
+ unsigned point_clip = draw->rasterizer->fill_front == PIPE_POLYGON_MODE_POINT ||
+ out_prim == PIPE_PRIM_POINTS;
fpme->input_prim = in_prim;
fpme->opt = opt;
draw_pt_post_vs_prepare( fpme->post_vs,
- out_prim == PIPE_PRIM_POINTS ?
- draw->clip_points_xy : draw->clip_xy,
+ draw->clip_xy,
draw->clip_z,
draw->clip_user,
- draw->guard_band_xy,
+ point_clip ? draw->guard_band_points_xy :
+ draw->guard_band_xy,
draw->identity_viewport,
draw->rasterizer->clip_halfz,
(draw->vs.edgeflag_output ? TRUE : FALSE) );