softpipe: make shader-related functions static
authorBrian Paul <brianp@vmware.com>
Sat, 25 Sep 2010 19:54:24 +0000 (13:54 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 25 Sep 2010 20:25:40 +0000 (14:25 -0600)
src/gallium/drivers/softpipe/sp_context.c
src/gallium/drivers/softpipe/sp_state.h
src/gallium/drivers/softpipe/sp_state_shader.c

index a7c9959b3e13c1ca9c995c0037ce73cbab3b0933..a280879cc4db2b776eb7571e57f4e236a306d1fd 100644 (file)
@@ -246,17 +246,7 @@ softpipe_create_context( struct pipe_screen *screen,
    softpipe->pipe.bind_rasterizer_state   = softpipe_bind_rasterizer_state;
    softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state;
 
-   softpipe->pipe.create_fs_state = softpipe_create_fs_state;
-   softpipe->pipe.bind_fs_state   = softpipe_bind_fs_state;
-   softpipe->pipe.delete_fs_state = softpipe_delete_fs_state;
-
-   softpipe->pipe.create_vs_state = softpipe_create_vs_state;
-   softpipe->pipe.bind_vs_state   = softpipe_bind_vs_state;
-   softpipe->pipe.delete_vs_state = softpipe_delete_vs_state;
-
-   softpipe->pipe.create_gs_state = softpipe_create_gs_state;
-   softpipe->pipe.bind_gs_state   = softpipe_bind_gs_state;
-   softpipe->pipe.delete_gs_state = softpipe_delete_gs_state;
+   softpipe_init_shader_funcs(&softpipe->pipe);
 
    softpipe->pipe.create_vertex_elements_state = softpipe_create_vertex_elements_state;
    softpipe->pipe.bind_vertex_elements_state = softpipe_bind_vertex_elements_state;
@@ -270,7 +260,6 @@ softpipe_create_context( struct pipe_screen *screen,
    softpipe->pipe.set_stencil_ref = softpipe_set_stencil_ref;
    softpipe->pipe.set_clip_state = softpipe_set_clip_state;
    softpipe->pipe.set_sample_mask = softpipe_set_sample_mask;
-   softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer;
    softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
    softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
    softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;
index c5d61f840f20dc6e279960e3e75deb991dc1068b..69243573f7947bfe1c4f81d9119e10d3024ad212 100644 (file)
@@ -164,22 +164,8 @@ void softpipe_set_clip_state( struct pipe_context *,
 void softpipe_set_sample_mask( struct pipe_context *,
                                unsigned sample_mask );
 
-void softpipe_set_constant_buffer(struct pipe_context *,
-                                  uint shader, uint index,
-                                  struct pipe_resource *buf);
-
-void *softpipe_create_fs_state(struct pipe_context *,
-                               const struct pipe_shader_state *);
-void softpipe_bind_fs_state(struct pipe_context *, void *);
-void softpipe_delete_fs_state(struct pipe_context *, void *);
-void *softpipe_create_vs_state(struct pipe_context *,
-                               const struct pipe_shader_state *);
-void softpipe_bind_vs_state(struct pipe_context *, void *);
-void softpipe_delete_vs_state(struct pipe_context *, void *);
-void *softpipe_create_gs_state(struct pipe_context *,
-                               const struct pipe_shader_state *);
-void softpipe_bind_gs_state(struct pipe_context *, void *);
-void softpipe_delete_gs_state(struct pipe_context *, void *);
+void
+softpipe_init_shader_funcs(struct pipe_context *pipe);
 
 void *softpipe_create_vertex_elements_state(struct pipe_context *,
                                             unsigned count,
index 50bc2eea5ffc0a2f930fe76e14d0f8fabbd9615e..7fff338cceada61e92e0368df88ab27713f43214 100644 (file)
@@ -42,7 +42,7 @@
 #include "tgsi/tgsi_parse.h"
 
 
-void *
+static void *
 softpipe_create_fs_state(struct pipe_context *pipe,
                          const struct pipe_shader_state *templ)
 {
@@ -84,7 +84,7 @@ softpipe_create_fs_state(struct pipe_context *pipe,
 }
 
 
-void
+static void
 softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -105,7 +105,7 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
 }
 
 
-void
+static void
 softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -126,7 +126,7 @@ softpipe_delete_fs_state(struct pipe_context *pipe, void *fs)
 }
 
 
-void *
+static void *
 softpipe_create_vs_state(struct pipe_context *pipe,
                          const struct pipe_shader_state *templ)
 {
@@ -161,7 +161,7 @@ fail:
 }
 
 
-void
+static void
 softpipe_bind_vs_state(struct pipe_context *pipe, void *vs)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -175,7 +175,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs)
 }
 
 
-void
+static void
 softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -187,34 +187,8 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs)
    FREE( state );
 }
 
-void
-softpipe_set_constant_buffer(struct pipe_context *pipe,
-                             uint shader, uint index,
-                             struct pipe_resource *constants)
-{
-   struct softpipe_context *softpipe = softpipe_context(pipe);
-   unsigned size = constants ? constants->width0 : 0;
-   const void *data = constants ? softpipe_resource(constants)->data : NULL;
-
-   assert(shader < PIPE_SHADER_TYPES);
-
-   draw_flush(softpipe->draw);
 
-   /* note: reference counting */
-   pipe_resource_reference(&softpipe->constants[shader][index], constants);
-
-   if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
-      draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size);
-   }
-
-   softpipe->mapped_constants[shader][index] = data;
-   softpipe->const_buffer_size[shader][index] = size;
-
-   softpipe->dirty |= SP_NEW_CONSTANTS;
-}
-
-
-void *
+static void *
 softpipe_create_gs_state(struct pipe_context *pipe,
                          const struct pipe_shader_state *templ)
 {
@@ -253,7 +227,7 @@ fail:
 }
 
 
-void
+static void
 softpipe_bind_gs_state(struct pipe_context *pipe, void *gs)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -267,7 +241,7 @@ softpipe_bind_gs_state(struct pipe_context *pipe, void *gs)
 }
 
 
-void
+static void
 softpipe_delete_gs_state(struct pipe_context *pipe, void *gs)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -279,3 +253,49 @@ softpipe_delete_gs_state(struct pipe_context *pipe, void *gs)
                                (state) ? state->draw_data : 0);
    FREE(state);
 }
+
+
+static void
+softpipe_set_constant_buffer(struct pipe_context *pipe,
+                             uint shader, uint index,
+                             struct pipe_resource *constants)
+{
+   struct softpipe_context *softpipe = softpipe_context(pipe);
+   unsigned size = constants ? constants->width0 : 0;
+   const void *data = constants ? softpipe_resource(constants)->data : NULL;
+
+   assert(shader < PIPE_SHADER_TYPES);
+
+   draw_flush(softpipe->draw);
+
+   /* note: reference counting */
+   pipe_resource_reference(&softpipe->constants[shader][index], constants);
+
+   if (shader == PIPE_SHADER_VERTEX || shader == PIPE_SHADER_GEOMETRY) {
+      draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size);
+   }
+
+   softpipe->mapped_constants[shader][index] = data;
+   softpipe->const_buffer_size[shader][index] = size;
+
+   softpipe->dirty |= SP_NEW_CONSTANTS;
+}
+
+
+void
+softpipe_init_shader_funcs(struct pipe_context *pipe)
+{
+   pipe->create_fs_state = softpipe_create_fs_state;
+   pipe->bind_fs_state   = softpipe_bind_fs_state;
+   pipe->delete_fs_state = softpipe_delete_fs_state;
+
+   pipe->create_vs_state = softpipe_create_vs_state;
+   pipe->bind_vs_state   = softpipe_bind_vs_state;
+   pipe->delete_vs_state = softpipe_delete_vs_state;
+
+   pipe->create_gs_state = softpipe_create_gs_state;
+   pipe->bind_gs_state   = softpipe_bind_gs_state;
+   pipe->delete_gs_state = softpipe_delete_gs_state;
+
+   pipe->set_constant_buffer = softpipe_set_constant_buffer;
+}