llvmpipe: get lp_setup_tri building
This commit is contained in:
@@ -77,6 +77,11 @@ struct lp_rast_shader_inputs {
|
||||
* plus inputs to run the shader:
|
||||
*/
|
||||
struct lp_rast_triangle {
|
||||
int minx;
|
||||
int maxx;
|
||||
int miny;
|
||||
int maxy;
|
||||
|
||||
/* one-pixel sized trivial accept offsets for each plane */
|
||||
float ei1;
|
||||
float ei2;
|
||||
@@ -97,8 +102,13 @@ struct lp_rast_triangle {
|
||||
float dx23;
|
||||
float dx31;
|
||||
|
||||
/* XXX: these are only used inside lp_setup_tri.c, don't really
|
||||
* need to bin them:
|
||||
/* edge function values at minx,miny ?? */
|
||||
float c1;
|
||||
float c2;
|
||||
float c3;
|
||||
|
||||
/* XXX: this is only used inside lp_setup_tri.c, don't really
|
||||
* need it here:
|
||||
*/
|
||||
float oneoverarea;
|
||||
|
||||
|
||||
@@ -158,21 +158,6 @@ void lp_rast_triangle( struct lp_rasterizer *rast,
|
||||
const union lp_rast_cmd_arg arg )
|
||||
{
|
||||
const struct lp_rast_triangle *tri = arg.triangle;
|
||||
int minx, maxx, miny, maxy;
|
||||
|
||||
/* Clamp to tile dimensions:
|
||||
*/
|
||||
minx = MAX2(tri->maxx, rast->x);
|
||||
miny = MAX2(tri->miny, rast->y);
|
||||
maxx = MIN2(tri->maxx, rast->x + TILE_SIZE);
|
||||
maxy = MIN2(tri->maxy, rast->y + TILE_SIZE);
|
||||
|
||||
if (miny == maxy ||
|
||||
minx == maxx) {
|
||||
debug_printf("%s: non-intersecting triangle in bin\n", __FUNCTION__);
|
||||
//assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
const int step = BLOCKSIZE;
|
||||
|
||||
@@ -191,11 +176,33 @@ void lp_rast_triangle( struct lp_rasterizer *rast,
|
||||
float ystep1 = step * tri->dx12;
|
||||
float ystep2 = step * tri->dx23;
|
||||
float ystep3 = step * tri->dx31;
|
||||
|
||||
/* Clamp to tile dimensions:
|
||||
*/
|
||||
int minx = MAX2(tri->maxx, rast->x);
|
||||
int miny = MAX2(tri->miny, rast->y);
|
||||
int maxx = MIN2(tri->maxx, rast->x + TILE_SIZE);
|
||||
int maxy = MIN2(tri->maxy, rast->y + TILE_SIZE);
|
||||
|
||||
int x, y;
|
||||
float x0, y0;
|
||||
float c1, c2, c3;
|
||||
|
||||
if (miny == maxy || minx == maxx) {
|
||||
debug_printf("%s: non-intersecting triangle in bin\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
minx &= ~(step-1);
|
||||
miny &= ~(step-1);
|
||||
|
||||
x0 = (float)minx;
|
||||
y0 = (float)miny;
|
||||
|
||||
c1 = tri->c1 + tri->dx12 * y0 - tri->dy12 * x0;
|
||||
c2 = tri->c2 + tri->dx23 * y0 - tri->dy23 * x0;
|
||||
c3 = tri->c3 + tri->dx31 * y0 - tri->dy31 * x0;
|
||||
|
||||
for (y = miny; y < maxy; y += step)
|
||||
{
|
||||
float cx1 = c1;
|
||||
|
||||
@@ -373,9 +373,9 @@ lp_setup_clear( struct setup_context *setup,
|
||||
|
||||
|
||||
void
|
||||
lp_setup_set_tri_state( struct setup_context *setup,
|
||||
unsigned cull_mode,
|
||||
boolean ccw_is_frontface)
|
||||
lp_setup_set_triangle_state( struct setup_context *setup,
|
||||
unsigned cull_mode,
|
||||
boolean ccw_is_frontface)
|
||||
{
|
||||
setup->ccw_is_frontface = ccw_is_frontface;
|
||||
setup->cullmode = cull_mode;
|
||||
|
||||
@@ -315,9 +315,9 @@ do_triangle_ccw(struct setup_context *setup,
|
||||
/* half-edge constants, will be interated over the whole
|
||||
* rendertarget.
|
||||
*/
|
||||
c1 = tri->dy12 * x1 - tri->dx12 * y1;
|
||||
c2 = tri->dy23 * x2 - tri->dx23 * y2;
|
||||
c3 = tri->dy31 * x3 - tri->dx31 * y3;
|
||||
tri->c1 = tri->dy12 * x1 - tri->dx12 * y1;
|
||||
tri->c2 = tri->dy23 * x2 - tri->dx23 * y2;
|
||||
tri->c3 = tri->dy31 * x3 - tri->dx31 * y3;
|
||||
|
||||
/* correct for top-left fill convention:
|
||||
*/
|
||||
@@ -351,9 +351,9 @@ do_triangle_ccw(struct setup_context *setup,
|
||||
minx &= ~(TILESIZE-1); /* aligned blocks */
|
||||
miny &= ~(TILESIZE-1); /* aligned blocks */
|
||||
|
||||
c1 += tri->dx12 * miny - tri->dy12 * minx;
|
||||
c2 += tri->dx23 * miny - tri->dy23 * minx;
|
||||
c3 += tri->dx31 * miny - tri->dy31 * minx;
|
||||
c1 = tri->c1 + tri->dx12 * miny - tri->dy12 * minx;
|
||||
c2 = tri->c2 + tri->dx23 * miny - tri->dy23 * minx;
|
||||
c3 = tri->c3 + tri->dx31 * miny - tri->dy31 * minx;
|
||||
|
||||
/* Convert to tile coordinates:
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user