Module: Mesa
Branch: master
Commit: 47537a4557c8a264f1e0eb308aff07464c81e0ca
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=47537a4557c8a264f1e0eb308aff07464c81e0ca

Author: Luca Barbieri <[email protected]>
Date:   Sun Aug 22 15:48:41 2010 +0200

nvfx: move stuff around

---

 src/gallium/drivers/nvfx/nvfx_context.c  |    2 +
 src/gallium/drivers/nvfx/nvfx_context.h  |    5 +-
 src/gallium/drivers/nvfx/nvfx_fragprog.c |   42 +++++++++++++++
 src/gallium/drivers/nvfx/nvfx_state.c    |   82 ------------------------------
 src/gallium/drivers/nvfx/nvfx_vertprog.c |   48 +++++++++++++++++
 5 files changed, 95 insertions(+), 84 deletions(-)

diff --git a/src/gallium/drivers/nvfx/nvfx_context.c 
b/src/gallium/drivers/nvfx/nvfx_context.c
index e78fc14..99ad7bf 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.c
+++ b/src/gallium/drivers/nvfx/nvfx_context.c
@@ -77,6 +77,8 @@ nvfx_create(struct pipe_screen *pscreen, void *priv)
        nvfx_init_state_functions(nvfx);
        nvfx_init_sampling_functions(nvfx);
        nvfx_init_vbo_functions(nvfx);
+       nvfx_init_fragprog_functions(nvfx);
+       nvfx_init_vertprog_functions(nvfx);
        nvfx_init_resource_functions(&nvfx->pipe);
        nvfx_init_transfer_functions(&nvfx->pipe);
 
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h 
b/src/gallium/drivers/nvfx/nvfx_context.h
index fb4a9da..02e8ed0 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.h
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -244,8 +244,8 @@ nvfx_framebuffer_relocate(struct nvfx_context *nvfx);
 extern void nvfx_fragprog_destroy(struct nvfx_context *,
                                    struct nvfx_fragment_program *);
 extern void nvfx_fragprog_validate(struct nvfx_context *nvfx);
-extern void
-nvfx_fragprog_relocate(struct nvfx_context *nvfx);
+extern void nvfx_fragprog_relocate(struct nvfx_context *nvfx);
+extern void nvfx_init_fragprog_functions(struct nvfx_context *nvfx);
 
 /* nvfx_fragtex.c */
 extern void nvfx_init_sampling_functions(struct nvfx_context *nvfx);
@@ -308,6 +308,7 @@ extern unsigned nvfx_vertex_formats[];
 extern boolean nvfx_vertprog_validate(struct nvfx_context *nvfx);
 extern void nvfx_vertprog_destroy(struct nvfx_context *,
                                  struct nvfx_vertex_program *);
+extern void nvfx_init_vertprog_functions(struct nvfx_context *nvfx);
 
 /* nvfx_push.c */
 extern void nvfx_push_vbo(struct pipe_context *pipe, const struct 
pipe_draw_info *info);
diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c 
b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index e40a814..e0e31e4 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -1428,3 +1428,45 @@ nvfx_fragprog_destroy(struct nvfx_context *nvfx,
        if (fp->insn_len)
                FREE(fp->insn);
 }
+
+static void *
+nvfx_fp_state_create(struct pipe_context *pipe,
+                     const struct pipe_shader_state *cso)
+{
+        struct nvfx_fragment_program *fp;
+
+        fp = CALLOC(1, sizeof(struct nvfx_fragment_program));
+        fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+
+        tgsi_scan_shader(fp->pipe.tokens, &fp->info);
+
+        return (void *)fp;
+}
+
+static void
+nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+        struct nvfx_context *nvfx = nvfx_context(pipe);
+
+        nvfx->fragprog = hwcso;
+        nvfx->dirty |= NVFX_NEW_FRAGPROG;
+}
+
+static void
+nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+        struct nvfx_context *nvfx = nvfx_context(pipe);
+        struct nvfx_fragment_program *fp = hwcso;
+
+        nvfx_fragprog_destroy(nvfx, fp);
+        FREE((void*)fp->pipe.tokens);
+        FREE(fp);
+}
+
+void
+nvfx_init_fragprog_functions(struct nvfx_context *nvfx)
+{
+        nvfx->pipe.create_fs_state = nvfx_fp_state_create;
+        nvfx->pipe.bind_fs_state = nvfx_fp_state_bind;
+        nvfx->pipe.delete_fs_state = nvfx_fp_state_delete;
+}
diff --git a/src/gallium/drivers/nvfx/nvfx_state.c 
b/src/gallium/drivers/nvfx/nvfx_state.c
index e3c3fcb..cb32e50 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.c
+++ b/src/gallium/drivers/nvfx/nvfx_state.c
@@ -260,80 +260,6 @@ nvfx_depth_stencil_alpha_state_delete(struct pipe_context 
*pipe, void *hwcso)
        FREE(zsaso);
 }
 
-static void *
-nvfx_vp_state_create(struct pipe_context *pipe,
-                    const struct pipe_shader_state *cso)
-{
-       struct nvfx_context *nvfx = nvfx_context(pipe);
-       struct nvfx_vertex_program *vp;
-
-       // TODO: use a 64-bit atomic here!
-       static unsigned long long id = 0;
-
-       vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
-       vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
-       vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
-       vp->id = ++id;
-
-       return (void *)vp;
-}
-
-static void
-nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
-       struct nvfx_context *nvfx = nvfx_context(pipe);
-
-       nvfx->vertprog = hwcso;
-       nvfx->dirty |= NVFX_NEW_VERTPROG;
-       nvfx->draw_dirty |= NVFX_NEW_VERTPROG;
-}
-
-static void
-nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
-       struct nvfx_context *nvfx = nvfx_context(pipe);
-       struct nvfx_vertex_program *vp = hwcso;
-
-       draw_delete_vertex_shader(nvfx->draw, vp->draw);
-       nvfx_vertprog_destroy(nvfx, vp);
-       FREE((void*)vp->pipe.tokens);
-       FREE(vp);
-}
-
-static void *
-nvfx_fp_state_create(struct pipe_context *pipe,
-                    const struct pipe_shader_state *cso)
-{
-       struct nvfx_fragment_program *fp;
-
-       fp = CALLOC(1, sizeof(struct nvfx_fragment_program));
-       fp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
-
-       tgsi_scan_shader(fp->pipe.tokens, &fp->info);
-
-       return (void *)fp;
-}
-
-static void
-nvfx_fp_state_bind(struct pipe_context *pipe, void *hwcso)
-{
-       struct nvfx_context *nvfx = nvfx_context(pipe);
-
-       nvfx->fragprog = hwcso;
-       nvfx->dirty |= NVFX_NEW_FRAGPROG;
-}
-
-static void
-nvfx_fp_state_delete(struct pipe_context *pipe, void *hwcso)
-{
-       struct nvfx_context *nvfx = nvfx_context(pipe);
-       struct nvfx_fragment_program *fp = hwcso;
-
-       nvfx_fragprog_destroy(nvfx, fp);
-       FREE((void*)fp->pipe.tokens);
-       FREE(fp);
-}
-
 static void
 nvfx_set_blend_color(struct pipe_context *pipe,
                     const struct pipe_blend_color *bcol)
@@ -450,14 +376,6 @@ nvfx_init_state_functions(struct nvfx_context *nvfx)
        nvfx->pipe.delete_depth_stencil_alpha_state =
                nvfx_depth_stencil_alpha_state_delete;
 
-       nvfx->pipe.create_vs_state = nvfx_vp_state_create;
-       nvfx->pipe.bind_vs_state = nvfx_vp_state_bind;
-       nvfx->pipe.delete_vs_state = nvfx_vp_state_delete;
-
-       nvfx->pipe.create_fs_state = nvfx_fp_state_create;
-       nvfx->pipe.bind_fs_state = nvfx_fp_state_bind;
-       nvfx->pipe.delete_fs_state = nvfx_fp_state_delete;
-
        nvfx->pipe.set_blend_color = nvfx_set_blend_color;
         nvfx->pipe.set_stencil_ref = nvfx_set_stencil_ref;
        nvfx->pipe.set_clip_state = nvfx_set_clip_state;
diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c 
b/src/gallium/drivers/nvfx/nvfx_vertprog.c
index 806f263..f8f1af9 100644
--- a/src/gallium/drivers/nvfx/nvfx_vertprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c
@@ -1260,3 +1260,51 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct 
nvfx_vertex_program *vp)
        util_dynarray_fini(&vp->branch_relocs);
        util_dynarray_fini(&vp->const_relocs);
 }
+
+static void *
+nvfx_vp_state_create(struct pipe_context *pipe,
+                     const struct pipe_shader_state *cso)
+{
+        struct nvfx_context *nvfx = nvfx_context(pipe);
+        struct nvfx_vertex_program *vp;
+
+        // TODO: use a 64-bit atomic here!
+        static unsigned long long id = 0;
+
+        vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
+        vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+        vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
+        vp->id = ++id;
+
+        return (void *)vp;
+}
+
+static void
+nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
+{
+        struct nvfx_context *nvfx = nvfx_context(pipe);
+
+        nvfx->vertprog = hwcso;
+        nvfx->dirty |= NVFX_NEW_VERTPROG;
+        nvfx->draw_dirty |= NVFX_NEW_VERTPROG;
+}
+
+static void
+nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
+{
+        struct nvfx_context *nvfx = nvfx_context(pipe);
+        struct nvfx_vertex_program *vp = hwcso;
+
+        draw_delete_vertex_shader(nvfx->draw, vp->draw);
+        nvfx_vertprog_destroy(nvfx, vp);
+        FREE((void*)vp->pipe.tokens);
+        FREE(vp);
+}
+
+void
+nvfx_init_vertprog_functions(struct nvfx_context *nvfx)
+{
+        nvfx->pipe.create_vs_state = nvfx_vp_state_create;
+        nvfx->pipe.bind_vs_state = nvfx_vp_state_bind;
+        nvfx->pipe.delete_vs_state = nvfx_vp_state_delete;
+}

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to