summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_setup.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-14 19:15:00 -0700
committerBrian Paul <[email protected]>2010-01-14 19:15:00 -0700
commit4461442849bfdb817334b38567136f7f9dabdf59 (patch)
tree2539c1448256f7c617e6b902deba793ca63a4959 /src/gallium/drivers/llvmpipe/lp_setup.c
parentca12e30d97b83fb33e1f8f83da05b5ed2809b0af (diff)
llvmpipe: implement scissor testing
The scissor test is implemented as another per-quad operation in the JIT code. The four scissor box params are passed via the lp_jit_context. In the JIT code we compare the quad's x/y coords against the clip bounds and create a new in/out mask that's AND'd with the main quad mask. Note: we should also do scissor testing in the triangle setup code to improve efficiency. That's not done yet.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_setup.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 649e97992ba..284337e8252 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -413,6 +413,21 @@ lp_setup_set_blend_color( struct setup_context *setup,
}
+void
+lp_setup_set_scissor( struct setup_context *setup,
+ const struct pipe_scissor_state *scissor )
+{
+ LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
+
+ assert(scissor);
+
+ if (memcmp(&setup->scissor.current, scissor, sizeof(*scissor)) != 0) {
+ setup->scissor.current = *scissor; /* struct copy */
+ setup->dirty |= LP_SETUP_NEW_SCISSOR;
+ }
+}
+
+
void
lp_setup_set_flatshade_first( struct setup_context *setup,
boolean flatshade_first )
@@ -534,6 +549,25 @@ lp_setup_update_state( struct setup_context *setup )
setup->dirty |= LP_SETUP_NEW_FS;
}
+ if (setup->dirty & LP_SETUP_NEW_SCISSOR) {
+ float *stored;
+
+ stored = lp_scene_alloc_aligned(scene, 4 * sizeof(int32_t), 16);
+
+ stored[0] = (float) setup->scissor.current.minx;
+ stored[1] = (float) setup->scissor.current.miny;
+ stored[2] = (float) setup->scissor.current.maxx;
+ stored[3] = (float) setup->scissor.current.maxy;
+
+ setup->scissor.stored = stored;
+
+ setup->fs.current.jit_context.scissor_xmin = stored[0];
+ setup->fs.current.jit_context.scissor_ymin = stored[1];
+ setup->fs.current.jit_context.scissor_xmax = stored[2];
+ setup->fs.current.jit_context.scissor_ymax = stored[3];
+
+ setup->dirty |= LP_SETUP_NEW_FS;
+ }
if(setup->dirty & LP_SETUP_NEW_CONSTANTS) {
struct pipe_buffer *buffer = setup->constants.current;