diff options
author | Keith Whitwell <[email protected]> | 2007-06-14 15:18:27 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-06-14 15:18:27 +0100 |
commit | 7050a4a7bc779b2c30fbd8244d4e77e6bd3dc30f (patch) | |
tree | 199e813f8a043315f1932b403dc673288ec42c05 /src | |
parent | 790ec6ad3face4fb2e1c4b69d9d42bdf332841d6 (diff) |
Small optimization for line drawing.
And some comments on point sprites.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/softpipe/generic/g_prim_setup.c | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/mesa/softpipe/generic/g_prim_setup.c b/src/mesa/softpipe/generic/g_prim_setup.c index 0e1bc03b4fd..41e1381a603 100644 --- a/src/mesa/softpipe/generic/g_prim_setup.c +++ b/src/mesa/softpipe/generic/g_prim_setup.c @@ -640,30 +640,26 @@ setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim) static INLINE void plot(struct setup_stage *setup, GLint x, GLint y) { - const GLint quadX = block(x); - const GLint quadY = block(y); - - if ((quadX != setup->quad.x0 || quadY != setup->quad.y0) - && setup->quad.x0 != -1) { + const GLint iy = y & 1; + const GLint ix = x & 1; + const GLint quadX = x - ix; + const GLint quadY = y - iy; + const GLint mask = (1 << ix) << (2 * iy); + + if (quadX != setup->quad.x0 || + quadY != setup->quad.y0) + { /* flush prev quad, start new quad */ - quad_shade(setup->stage.generic, &setup->quad); + + if (setup->quad.x0 != -1) + quad_shade(setup->stage.generic, &setup->quad); + + setup->quad.x0 = quadX; + setup->quad.y0 = quadY; setup->quad.mask = 0x0; } - setup->quad.x0 = quadX; - setup->quad.y0 = quadY; - - if (x & 1) { - if (y & 1) - setup->quad.mask |= MASK_TOP_RIGHT; - else - setup->quad.mask |= MASK_BOTTOM_RIGHT; - } - else { - if (y & 1) - setup->quad.mask |= MASK_TOP_LEFT; - else - setup->quad.mask |= MASK_BOTTOM_LEFT; - } + + setup->quad.mask |= mask; } @@ -790,6 +786,17 @@ setup_point(struct prim_stage *stage, struct prim_header *prim) * However, for point sprites, we'll need to setup texcoords appropriately. * XXX: which coefficients are the texcoords??? * We may do point sprites as textured quads... + * + * KW: We don't know which coefficients are texcoords - ultimately + * the choice of what interpolation mode to use for each attribute + * should be determined by the fragment program, using + * per-attribute declaration statements that include interpolation + * mode as a parameter. So either the fragment program will have + * to be adjusted for pointsprite vs normal point behaviour, or + * otherwise a special interpolation mode will have to be defined + * which matches the required behaviour for point sprites. But - + * the latter is not a feature of normal hardware, and as such + * probably should be ruled out on that basis. */ setup->vprovoke = prim->v[0]; const_coeff(setup, 0, 2); |