llvmpipe: adapt to stencil ref changes
authorRoland Scheidegger <sroland@vmware.com>
Wed, 10 Feb 2010 20:20:24 +0000 (21:20 +0100)
committerRoland Scheidegger <sroland@vmware.com>
Wed, 10 Feb 2010 20:20:24 +0000 (21:20 +0100)
since the driver doesn't actually handle stencil yet the code won't do much.

src/gallium/drivers/llvmpipe/lp_context.c
src/gallium/drivers/llvmpipe/lp_context.h
src/gallium/drivers/llvmpipe/lp_state.h
src/gallium/drivers/llvmpipe/lp_state_blend.c

index 43d610631dafcce8831b57cfb159d71562e9a195..808f49036157039bea43fe163217c7b0bfd78d7f 100644 (file)
@@ -148,6 +148,7 @@ llvmpipe_create_context( struct pipe_screen *screen, void *priv )
    llvmpipe->pipe.delete_vs_state = llvmpipe_delete_vs_state;
 
    llvmpipe->pipe.set_blend_color = llvmpipe_set_blend_color;
+   llvmpipe->pipe.set_stencil_ref = llvmpipe_set_stencil_ref;
    llvmpipe->pipe.set_clip_state = llvmpipe_set_clip_state;
    llvmpipe->pipe.set_constant_buffer = llvmpipe_set_constant_buffer;
    llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state;
index 3bde485ac0c865975164e3ae7995fcc866f5ed79..955c7eb8e0e97c0ce4e0289a00e14296a8615a67 100644 (file)
@@ -61,6 +61,7 @@ struct llvmpipe_context {
 
    /** Other rendering state */
    struct pipe_blend_color blend_color;
+   struct pipe_stencil_ref stencil_ref;
    struct pipe_clip_state clip;
    struct pipe_buffer *constants[PIPE_SHADER_TYPES];
    struct pipe_framebuffer_state framebuffer;
index 8f68f12bed774f09e8d29d0fa1bf14bcad9b8072..9beba32271f5022f805d45fc3176b5b5c1d65260 100644 (file)
@@ -152,13 +152,16 @@ void llvmpipe_bind_rasterizer_state(struct pipe_context *, void *);
 void llvmpipe_delete_rasterizer_state(struct pipe_context *, void *);
 
 void llvmpipe_set_framebuffer_state( struct pipe_context *,
-                            const struct pipe_framebuffer_state * );
+                                     const struct pipe_framebuffer_state * );
 
 void llvmpipe_set_blend_color( struct pipe_context *pipe,
                                const struct pipe_blend_color *blend_color );
 
+void llvmpipe_set_stencil_ref( struct pipe_context *pipe,
+                               const struct pipe_stencil_ref *stencil_ref );
+
 void llvmpipe_set_clip_state( struct pipe_context *,
-                            const struct pipe_clip_state * );
+                              const struct pipe_clip_state * );
 
 void llvmpipe_set_constant_buffer(struct pipe_context *,
                                   uint shader, uint index,
index 9b950e82d897394976d4e71dc109c72cb5e370cd..8bb89f96c278379ff13e0bcd6bad05bfac6a2a36 100644 (file)
@@ -121,3 +121,24 @@ llvmpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth)
 {
    FREE( depth );
 }
+
+void llvmpipe_set_stencil_ref( struct pipe_context *pipe,
+                               const struct pipe_stencil_ref *stencil_ref )
+{
+   struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
+
+   if(!stencil_ref)
+      return;
+
+   if(memcmp(&llvmpipe->stencil_ref, stencil_ref, sizeof *stencil_ref) == 0)
+      return;
+
+   draw_flush(llvmpipe->draw);
+
+   memcpy(&llvmpipe->stencil_ref, stencil_ref, sizeof *stencil_ref);
+
+   /* not sure. want new flag? */
+   llvmpipe->dirty |= LP_NEW_DEPTH_STENCIL_ALPHA;
+}
+
+