54
54
struct draw_stage stage; /**< base class */
57
boolean have_clipdist;
60
60
/* List of the attributes to be constant interpolated. */
61
uint num_const_attribs;
61
unsigned num_const_attribs;
62
62
uint8_t const_attribs[PIPE_MAX_SHADER_OUTPUTS];
63
63
/* List of the attributes to be linear interpolated. */
64
uint num_linear_attribs;
64
unsigned num_linear_attribs;
65
65
uint8_t linear_attribs[PIPE_MAX_SHADER_OUTPUTS];
66
66
/* List of the attributes to be perspective interpolated. */
67
uint num_perspect_attribs;
67
unsigned num_perspect_attribs;
68
68
uint8_t perspect_attribs[PIPE_MAX_SHADER_OUTPUTS];
124
124
const struct clip_stage *clipper = clip_stage(stage);
125
125
for (unsigned i = 0; i < clipper->num_const_attribs; i++) {
126
const uint attr = clipper->const_attribs[i];
126
const unsigned attr = clipper->const_attribs[i];
127
127
COPY_4FV(dst->data[attr], src->data[attr]);
218
218
emit_poly(struct draw_stage *stage,
219
219
struct vertex_header **inlist,
220
const boolean *edgeflags,
220
const bool *edgeflags,
222
222
const struct prim_header *origPrim)
224
224
const struct clip_stage *clipper = clip_stage(stage);
225
ushort edge_first, edge_middle, edge_last;
225
uint16_t edge_first, edge_middle, edge_last;
227
227
if (stage->draw->rasterizer->flatshade_first) {
228
228
edge_first = DRAW_PIPE_EDGE_FLAG_0;
353
353
struct vertex_header *prov_vertex;
354
354
unsigned tmpnr = 0;
356
boolean aEdges[MAX_CLIPPED_VERTICES];
357
boolean bEdges[MAX_CLIPPED_VERTICES];
358
boolean *inEdges = aEdges;
359
boolean *outEdges = bEdges;
356
bool aEdges[MAX_CLIPPED_VERTICES];
357
bool bEdges[MAX_CLIPPED_VERTICES];
358
bool *inEdges = aEdges;
359
bool *outEdges = bEdges;
360
360
int viewport_index = 0;
362
362
inlist[0] = header->v[0];
411
411
while (clipmask && n >= 3) {
412
412
const unsigned plane_idx = ffs(clipmask)-1;
413
const boolean is_user_clip_plane = plane_idx >= 6;
413
const bool is_user_clip_plane = plane_idx >= 6;
414
414
struct vertex_header *vert_prev = inlist[0];
415
boolean *edge_prev = &inEdges[0];
415
bool *edge_prev = &inEdges[0];
417
417
unsigned outcount = 0;
431
431
for (unsigned i = 1; i <= n; i++) {
432
432
struct vertex_header *vert = inlist[i];
433
boolean *edge = &inEdges[i];
434
boolean different_sign;
433
bool *edge = &inEdges[i];
436
436
float dp = getclipdist(clipper, vert, plane_idx);
485
485
if (is_user_clip_plane) {
486
486
/* we want to see an edge along the clip plane */
488
new_vert->edgeflag = TRUE;
488
new_vert->edgeflag = true;
491
491
/* we don't want to see an edge along the frustum clip plane */
492
492
*new_edge = *edge_prev;
493
new_vert->edgeflag = FALSE;
493
new_vert->edgeflag = false;
689
689
clip_first_point(struct draw_stage *stage, struct prim_header *header)
691
stage->point = stage->draw->guard_band_points_xy ? clip_point_guard_xy : clip_point;
691
stage->point = stage->draw->guard_band_points_lines_xy ? clip_point_guard_xy : clip_point;
692
692
stage->point(stage, header);
710
710
/* else, totally clipped */
714
clip_line_guard_xy(struct draw_stage *stage, struct prim_header *header)
716
unsigned clipmask = (header->v[0]->clipmask |
717
header->v[1]->clipmask);
719
if ((clipmask & 0xffffffff) == 0) {
720
stage->next->line(stage->next, header);
722
else if ((clipmask & 0xfffffff0) == 0) {
724
const unsigned plane_idx = ffs(clipmask)-1;
725
clipmask &= ~(1 << plane_idx); /* turn off this plane's bit */
726
/* TODO: this should really do proper guardband clipping,
727
* currently just throw out infs/nans.
728
* Also note that vertices with negative w values MUST be tossed
729
* out (not sure if proper guardband clipping would do this
730
* automatically). These would usually be captured by depth clip
731
* too but this can be disabled.
733
if ((header->v[0]->clip_pos[3] <= 0.0f &&
734
header->v[1]->clip_pos[3] <= 0.0f) ||
735
util_is_nan(header->v[0]->clip_pos[0]) ||
736
util_is_nan(header->v[0]->clip_pos[1]) ||
737
util_is_nan(header->v[1]->clip_pos[0]) ||
738
util_is_nan(header->v[1]->clip_pos[1]))
741
stage->next->line(stage->next, header);
742
} else if ((header->v[0]->clipmask &
743
header->v[1]->clipmask) == 0) {
744
do_clip_line(stage, header, clipmask & 0xfffffff0);
715
749
clip_tri(struct draw_stage *stage, struct prim_header *header)
733
767
static enum tgsi_interpolate_mode
734
768
find_interp(const struct draw_fragment_shader *fs,
735
769
enum tgsi_interpolate_mode *indexed_interp,
736
uint semantic_name, uint semantic_index)
770
enum tgsi_semantic semantic_name, unsigned semantic_index)
738
772
enum tgsi_interpolate_mode interp;
753
787
* This probably only matters for layer, vpindex, culldist, maybe
757
791
if (semantic_name == TGSI_SEMANTIC_LAYER ||
758
792
semantic_name == TGSI_SEMANTIC_VIEWPORT_INDEX) {
759
793
interp = TGSI_INTERPOLATE_CONSTANT;