llvmpipe: implement scissor test in triangle setup
authorBrian Paul <brianp@vmware.com>
Fri, 15 Jan 2010 19:06:00 +0000 (12:06 -0700)
committerBrian Paul <brianp@vmware.com>
Fri, 15 Jan 2010 19:06:00 +0000 (12:06 -0700)
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_setup.h
src/gallium/drivers/llvmpipe/lp_setup_context.h
src/gallium/drivers/llvmpipe/lp_setup_tri.c
src/gallium/drivers/llvmpipe/lp_state_rasterizer.c

index 355c0518372d84c3d2ec35baf64123a6966ba827..f52dce65d74498fafd4aedcc4f6f1463cdf124d9 100644 (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;
 }
 
 
index 407f7527770878427becf327a78a7796dc7f0025..5081da29d117c03cd9832111e3a302e59f193ff2 100644 (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,
index fc0aef1376cc41813a5355f5f6346ed8cf3b502b..a5fc34e54a211bc5c69f2d08885b14254dc3ca23 100644 (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;
index ae354b3870ebc778022178e6be21b98f4fd77a2d..018d254c765f67eac3e9d6e3f544575688c6e97c 100644 (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 );
index 7d4c310aae844f7a6458ef38e4d66dbdcf8c5565..feb012816c96ab435f602f53d5226f409086cf6c 100644 (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;