renaming, comments, clean-up

This commit is contained in:
Brian
2007-07-27 11:02:54 -06:00
parent 05ba76757b
commit 75b8a396e5

View File

@@ -47,12 +47,11 @@
* Triangle edge info * Triangle edge info
*/ */
struct edge { struct edge {
GLfloat dx; /* X(v1) - X(v0), used only during setup */ GLfloat dx; /**< X(v1) - X(v0), used only during setup */
GLfloat dy; /* Y(v1) - Y(v0), used only during setup */ GLfloat dy; /**< Y(v1) - Y(v0), used only during setup */
GLfloat dxdy; /* dx/dy */ GLfloat dxdy; /**< dx/dy */
GLfloat sx; /* first sample point x coord */ GLfloat sx, sy; /**< first sample point coord */
GLfloat sy; GLint lines; /**< number of lines on this edge */
GLint lines; /* number of lines on this edge */
}; };
@@ -63,7 +62,6 @@ struct edge {
struct setup_stage { struct setup_stage {
struct draw_stage stage; /**< This must be first (base class) */ struct draw_stage stage; /**< This must be first (base class) */
/*XXX NEW */
struct softpipe_context *softpipe; struct softpipe_context *softpipe;
/* Vertices are just an array of floats making up each attribute in /* Vertices are just an array of floats making up each attribute in
@@ -98,7 +96,7 @@ struct setup_stage {
/** /**
* Basically a cast wrapper. * Basically a cast wrapper.
*/ */
static inline struct setup_stage *setup_stage( struct draw_stage *stage ) static INLINE struct setup_stage *setup_stage( struct draw_stage *stage )
{ {
return (struct setup_stage *)stage; return (struct setup_stage *)stage;
} }
@@ -131,14 +129,10 @@ quad_clip(struct setup_stage *setup)
/** /**
* Emit/render a quad. * Emit a quad (pass to next stage) with clipping.
* Called during point/line rendering. For triangles, we call
* run_shader_block() which doesn't do clipping (since clipping is
* done at a higher level for tris).
* This passes the quad to the first stage of per-fragment operations.
*/ */
static INLINE void static INLINE void
quad_emit(struct setup_stage *setup) clip_emit_quad(struct setup_stage *setup)
{ {
quad_clip(setup); quad_clip(setup);
if (setup->quad.mask) { if (setup->quad.mask) {
@@ -149,21 +143,10 @@ quad_emit(struct setup_stage *setup)
/** /**
* Given an X or Y coordinate, return the block/quad coordinate that it * Emit a quad (pass to next stage). No clipping is done.
* belongs to.
*/ */
static inline GLint block( GLint x ) static INLINE void
{ emit_quad( struct setup_stage *setup, GLint x, GLint y, GLuint mask )
return x & ~1;
}
/**
* Run shader on a quad/block.
*/
static void run_shader_block( struct setup_stage *setup,
GLint x, GLint y, GLuint mask )
{ {
struct softpipe_context *sp = setup->softpipe; struct softpipe_context *sp = setup->softpipe;
setup->quad.x0 = x; setup->quad.x0 = x;
@@ -173,6 +156,16 @@ static void run_shader_block( struct setup_stage *setup,
} }
/**
* Given an X or Y coordinate, return the block/quad coordinate that it
* belongs to.
*/
static INLINE GLint block( GLint x )
{
return x & ~1;
}
/** /**
* Compute mask which indicates which pixels in the 2x2 quad are actually inside * Compute mask which indicates which pixels in the 2x2 quad are actually inside
* the triangle's bounds. * the triangle's bounds.
@@ -232,9 +225,8 @@ static void flush_spans( struct setup_stage *setup )
for (x = block(minleft); x <= block(maxright); ) for (x = block(minleft); x <= block(maxright); )
{ {
run_shader_block( setup, x, emit_quad( setup, x, setup->span.y,
setup->span.y, calculate_mask( setup, x ) );
calculate_mask( setup, x ) );
x += 2; x += 2;
} }
@@ -716,7 +708,7 @@ plot(struct setup_stage *setup, GLint x, GLint y)
/* flush prev quad, start new quad */ /* flush prev quad, start new quad */
if (setup->quad.x0 != -1) if (setup->quad.x0 != -1)
quad_emit(setup); clip_emit_quad(setup);
setup->quad.x0 = quadX; setup->quad.x0 = quadX;
setup->quad.y0 = quadY; setup->quad.y0 = quadY;
@@ -852,7 +844,7 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
/* draw final quad */ /* draw final quad */
if (setup->quad.mask) { if (setup->quad.mask) {
quad_emit(setup); clip_emit_quad(setup);
} }
} }
@@ -907,7 +899,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
setup->quad.x0 = x - ix; setup->quad.x0 = x - ix;
setup->quad.y0 = y - iy; setup->quad.y0 = y - iy;
setup->quad.mask = (1 << ix) << (2 * iy); setup->quad.mask = (1 << ix) << (2 * iy);
quad_emit(setup); clip_emit_quad(setup);
} }
else { else {
const GLint ixmin = block((GLint) (x - halfSize)); const GLint ixmin = block((GLint) (x - halfSize));
@@ -969,7 +961,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
if (setup->quad.mask) { if (setup->quad.mask) {
setup->quad.x0 = ix; setup->quad.x0 = ix;
setup->quad.y0 = iy; setup->quad.y0 = iy;
quad_emit(setup); clip_emit_quad(setup);
} }
} }
} }
@@ -1003,7 +995,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
if (setup->quad.mask) { if (setup->quad.mask) {
setup->quad.x0 = ix; setup->quad.x0 = ix;
setup->quad.y0 = iy; setup->quad.y0 = iy;
quad_emit(setup); clip_emit_quad(setup);
} }
} }
} }