Make softpipe behave more like a real driver by always allocating something
authorZack Rusin <zack@tungstengraphics.com>
Wed, 3 Oct 2007 12:47:36 +0000 (08:47 -0400)
committerZack Rusin <zack@tungstengraphics.com>
Wed, 3 Oct 2007 12:47:36 +0000 (08:47 -0400)
in the state functions.

src/mesa/pipe/softpipe/sp_state_blend.c
src/mesa/pipe/softpipe/sp_state_fs.c
src/mesa/pipe/softpipe/sp_state_rasterizer.c
src/mesa/pipe/softpipe/sp_state_sampler.c

index cb0921f687b35dd3eb2b7dcd14714a71422ab768..6376c3c61cf965f8275f39429eb287d8d685b28b 100644 (file)
@@ -34,9 +34,9 @@ void *
 softpipe_create_blend_state(struct pipe_context *pipe,
                             const struct pipe_blend_state *blend)
 {
-   /* means that we just want pipe_blend_state and don't have
-    * anything specific */
-   return 0;
+   struct pipe_blend_state *state = malloc(sizeof(struct pipe_blend_state));
+   memcpy(state, blend, sizeof(struct pipe_blend_state));
+   return state;
 }
 
 void softpipe_bind_blend_state( struct pipe_context *pipe,
@@ -50,9 +50,9 @@ void softpipe_bind_blend_state( struct pipe_context *pipe,
 }
 
 void softpipe_delete_blend_state(struct pipe_context *pipe,
-                                 void *blend )
+                                 void *blend)
 {
-   /* do nothing */
+   free(blend);
 }
 
 
@@ -75,7 +75,9 @@ void *
 softpipe_create_alpha_test_state(struct pipe_context *pipe,
                                  const struct pipe_alpha_test_state *alpha)
 {
-   return 0;
+   struct pipe_alpha_test_state *state = malloc(sizeof(struct pipe_alpha_test_state));
+   memcpy(state, alpha, sizeof(struct pipe_alpha_test_state));
+   return state;
 }
 
 void
@@ -93,14 +95,17 @@ void
 softpipe_delete_alpha_test_state(struct pipe_context *pipe,
                                  void *alpha)
 {
-   /* do nothing */
+   free(alpha);
 }
 
 void *
 softpipe_create_depth_stencil_state(struct pipe_context *pipe,
                               const struct pipe_depth_stencil_state *depth_stencil)
 {
-   return 0;
+   struct pipe_depth_stencil_state *state =
+      malloc(sizeof(struct pipe_depth_stencil_state));
+   memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_state));
+   return state;
 }
 
 void
@@ -117,5 +122,5 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe,
 void
 softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth)
 {
-   /* do nothing */
+   free(depth);
 }
index f1bec2c73acdb05a1205d49ce54f7e21aac658ff..390340fa8dcfb9c986cbb0555ab90852603dd97f 100644 (file)
@@ -40,7 +40,9 @@ void * softpipe_create_fs_state(struct pipe_context *pipe,
     * that now.
     */
 
-   return 0;
+   struct pipe_shader_state *state = malloc(sizeof(struct pipe_shader_state));
+   memcpy(state, templ, sizeof(struct pipe_shader_state));
+   return state;
 }
 
 void softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
@@ -55,6 +57,7 @@ void softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
 void softpipe_delete_fs_state(struct pipe_context *pipe,
                               void *shader)
 {
+   free(shader);
 }
 
 
index d7845cef826b517b934e13517734cd0cbb53e902..076ea66d9e8d0b3d2464c055eae2e7e68715fe2d 100644 (file)
@@ -36,7 +36,10 @@ void *
 softpipe_create_rasterizer_state(struct pipe_context *pipe,
                                  const struct pipe_rasterizer_state *setup)
 {
-   return 0;
+   struct pipe_rasterizer_state *state =
+      malloc(sizeof(struct pipe_rasterizer_state));
+   memcpy(state, setup, sizeof(struct pipe_rasterizer_state));
+   return state;
 }
 
 void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
@@ -55,7 +58,7 @@ void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
 void softpipe_delete_rasterizer_state(struct pipe_context *pipe,
                                       void *rasterizer)
 {
-   /* do nothing */
+   free(rasterizer);
 }
 
 
index ad98375735b54c8bc686afa3375ddd36f51522ac..4084e9163f3a51df6ef6e146a56c69964bd5877c 100644 (file)
@@ -36,7 +36,9 @@ void *
 softpipe_create_sampler_state(struct pipe_context *pipe,
                               const struct pipe_sampler_state *sampler)
 {
-   return 0;
+   struct pipe_sampler_state *state = malloc(sizeof(struct pipe_sampler_state));
+   memcpy(state, sampler, sizeof(struct pipe_sampler_state));
+   return state;
 }
 
 void
@@ -56,7 +58,7 @@ void
 softpipe_delete_sampler_state(struct pipe_context *pipe,
                               void *sampler)
 {
-   /* do nothing */
+   free(sampler);
 }