-/* Encodes everything we need to know about a 2x2 pixel block. Uses
+/**
+ * Encodes everything we need to know about a 2x2 pixel block. Uses
* "Channel-Serial" or "SoA" layout.
- *
- * Will expand to include non-attribute things like AA coverage and
- * maybe prefetched depth from the depth buffer.
*/
struct quad_header {
GLint x0;
GLint y0;
- GLuint mask;
- GLuint facing; /**< Front (0) or back (1) facing? */
+ GLuint mask:4;
+ GLuint facing:1; /**< Front (0) or back (1) facing? */
+ GLuint prim:2; /**< PRIM_POINT, LINE, TRI */
struct {
GLfloat color[4][QUAD_SIZE]; /* rrrr, gggg, bbbb, aaaa */
setup_tri_coefficients( setup );
setup_tri_edges( setup );
+ setup->quad.prim = PRIM_TRI;
+
setup->span.y = 0;
setup->span.y_flags = 0;
setup->span.right[0] = 0;
setup->quad.x0 = setup->quad.y0 = -1;
setup->quad.mask = 0x0;
+ setup->quad.prim = PRIM_LINE;
if (dx > dy) {
/*** X-major line ***/
const_coeff(setup, slot, j);
}
+ setup->quad.prim = PRIM_POINT;
+
/* XXX need to clip against scissor bounds too */
if (halfSize <= 0.5 && !round) {
* Multiply quad's alpha values by the fragment coverage.
*/
static void
-apply_aa_coverage_quad(struct quad_stage *qs, struct quad_header *quad)
+coverage_quad(struct quad_stage *qs, struct quad_header *quad)
{
-#if 0
struct softpipe_context *softpipe = qs->softpipe;
- /* XXX need to know if this quad is from a point, line or polygon! */
- if ((softpipe->setup.poly_smooth && prim == POLYGON) ||
- (softpipe->setup.line_smooth && prim == LINE) ||
- (softpipe->setup.point_smooth && prim == POINT)) {
-#endif
+ if ((softpipe->setup.poly_smooth && quad->prim == PRIM_TRI) ||
+ (softpipe->setup.line_smooth && quad->prim == PRIM_LINE) ||
+ (softpipe->setup.point_smooth && quad->prim == PRIM_POINT)) {
GLuint j;
for (j = 0; j < QUAD_SIZE; j++) {
assert(quad->coverage[j] >= 0.0);
assert(quad->coverage[j] <= 1.0);
quad->outputs.color[3][j] *= quad->coverage[j];
}
-#if 0
}
-#endif
qs->next->run(qs->next, quad);
}
struct quad_stage *stage = CALLOC_STRUCT(quad_stage);
stage->softpipe = softpipe;
- stage->run = apply_aa_coverage_quad;
+ stage->run = coverage_quad;
return stage;
}
/**
* Apply polygon stipple to quads produced by triangle rasterization
- * XXX we need to skip this for lines and points!!!
*/
static void
stipple_quad(struct quad_stage *qs, struct quad_header *quad)
{
- struct softpipe_context *softpipe = qs->softpipe;
- const GLint col0 = quad->x0 % 32;
- const GLint row0 = quad->y0 % 32;
- const GLuint stipple0 = softpipe->poly_stipple.stipple[row0];
- const GLuint stipple1 = softpipe->poly_stipple.stipple[row0 + 1];
+ if (quad->prim == PRIM_TRI) {
+ struct softpipe_context *softpipe = qs->softpipe;
+ const GLint col0 = quad->x0 % 32;
+ const GLint row0 = quad->y0 % 32;
+ const GLuint stipple0 = softpipe->poly_stipple.stipple[row0];
+ const GLuint stipple1 = softpipe->poly_stipple.stipple[row0 + 1];
- /* XXX this should be acheivable without conditionals */
+ /* XXX this should be acheivable without conditionals */
#if 1
- GLbitfield mask = 0x0;
+ GLbitfield mask = 0x0;
- if ((1 << col0) & stipple0)
- mask |= MASK_BOTTOM_LEFT;
+ if ((1 << col0) & stipple0)
+ mask |= MASK_BOTTOM_LEFT;
- if ((2 << col0) & stipple0) /* note: col0 <= 30 */
- mask |= MASK_BOTTOM_RIGHT;
+ if ((2 << col0) & stipple0) /* note: col0 <= 30 */
+ mask |= MASK_BOTTOM_RIGHT;
- if ((1 << col0) & stipple1)
- mask |= MASK_TOP_LEFT;
+ if ((1 << col0) & stipple1)
+ mask |= MASK_TOP_LEFT;
- if ((2 << col0) & stipple1)
- mask |= MASK_TOP_RIGHT;
+ if ((2 << col0) & stipple1)
+ mask |= MASK_TOP_RIGHT;
- quad->mask &= mask;
+ quad->mask &= mask;
#else
- /* XXX there may be a better way to lay out the stored stipple
- * values to further simplify this computation.
- */
- quad->mask &= (((stipple0 >> col0) & 0x3) |
- (((stipple1 >> col0) & 0x3) << 2));
+ /* XXX there may be a better way to lay out the stored stipple
+ * values to further simplify this computation.
+ */
+ quad->mask &= (((stipple0 >> col0) & 0x3) |
+ (((stipple1 >> col0) & 0x3) << 2));
#endif
- if (quad->mask)
- qs->next->run(qs->next, quad);
+ if (quad->mask)
+ qs->next->run(qs->next, quad);
+ }
}