llvmpipe: implement scissor test in triangle setup

This commit is contained in:
Brian Paul
2010-01-15 12:06:00 -07:00
parent adb48d5350
commit fdfe06ad80
5 changed files with 15 additions and 3 deletions

View File

@@ -339,13 +339,15 @@ lp_setup_fence( struct setup_context *setup )
void
lp_setup_set_triangle_state( struct setup_context *setup,
unsigned cull_mode,
boolean ccw_is_frontface)
boolean ccw_is_frontface,
boolean scissor )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
setup->ccw_is_frontface = ccw_is_frontface;
setup->cullmode = cull_mode;
setup->triangle = first_triangle;
setup->scissor_test = scissor;
}

View File

@@ -88,7 +88,8 @@ lp_setup_bind_framebuffer( struct setup_context *setup,
void
lp_setup_set_triangle_state( struct setup_context *setup,
unsigned cullmode,
boolean front_is_ccw );
boolean front_is_ccw,
boolean scissor );
void
lp_setup_set_fs_inputs( struct setup_context *setup,

View File

@@ -87,6 +87,7 @@ struct setup_context
boolean flatshade_first;
boolean ccw_is_frontface;
boolean scissor_test;
unsigned cullmode;
struct pipe_framebuffer_state fb;

View File

@@ -293,6 +293,13 @@ do_triangle_ccw(struct setup_context *setup,
miny = (MIN3(y1, y2, y3) + (FIXED_ONE-1)) >> FIXED_ORDER;
maxy = (MAX3(y1, y2, y3) + (FIXED_ONE-1)) >> FIXED_ORDER;
if (setup->scissor_test) {
minx = MAX2(minx, setup->scissor.current.minx);
maxx = MIN2(maxx, setup->scissor.current.maxx);
miny = MAX2(miny, setup->scissor.current.miny);
maxy = MIN2(maxy, setup->scissor.current.maxy);
}
if (miny == maxy ||
minx == maxx) {
lp_scene_putback_data( scene, sizeof *tri );

View File

@@ -61,7 +61,8 @@ void llvmpipe_bind_rasterizer_state(struct pipe_context *pipe,
if (llvmpipe->rasterizer) {
lp_setup_set_triangle_state( llvmpipe->setup,
llvmpipe->rasterizer->cull_mode,
llvmpipe->rasterizer->front_winding == PIPE_WINDING_CCW );
llvmpipe->rasterizer->front_winding == PIPE_WINDING_CCW,
llvmpipe->rasterizer->scissor);
}
llvmpipe->dirty |= LP_NEW_RASTERIZER;