summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-15 12:06:00 -0700
committerBrian Paul <[email protected]>2010-01-15 12:06:00 -0700
commitfdfe06ad804ea13e6e436d66c1bcafe0bde2f545 (patch)
tree4704a0b0373725250c5766daa9bf426eb1c6c9a0 /src/gallium
parentadb48d535082f5a311751e1866997e381b2d3038 (diff)
llvmpipe: implement scissor test in triangle setup
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_rasterizer.c3
5 files changed, 15 insertions, 3 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 355c0518372..f52dce65d74 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -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;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 407f7527770..5081da29d11 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -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,
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index fc0aef1376c..a5fc34e54a2 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -87,6 +87,7 @@ struct setup_context
boolean flatshade_first;
boolean ccw_is_frontface;
+ boolean scissor_test;
unsigned cullmode;
struct pipe_framebuffer_state fb;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index ae354b3870e..018d254c765 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -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 );
diff --git a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
index 7d4c310aae8..feb012816c9 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_rasterizer.c
@@ -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;