[Mesa-dev] [PATCH 2/3] r600g: Added r600_pipe_shader_destroy().

Tilman Sauerbeck tilman at code-monkey.de
Sat Oct 23 04:33:18 PDT 2010


Not yet complete.

Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>
---
 src/gallium/drivers/r600/r600_pipe.h   |    1 +
 src/gallium/drivers/r600/r600_shader.c |   11 +++++++++++
 src/gallium/drivers/r600/r600_state.c  |    6 ++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index b27bbba..f486127 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -208,6 +208,7 @@ void r600_init_context_resource_functions(struct r600_pipe_context *r600);
 /* r600_shader.c */
 int r600_pipe_shader_update(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *shader, const struct tgsi_token *tokens);
+void r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader);
 int r600_find_vs_semantic_index(struct r600_shader *vs,
 				struct r600_shader *ps, int id);
 
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 0dd416c..a4e052c 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -338,6 +338,17 @@ int r600_pipe_shader_create(struct pipe_context *ctx, struct r600_pipe_shader *s
 	return 0;
 }
 
+void
+r600_pipe_shader_destroy(struct pipe_context *ctx, struct r600_pipe_shader *shader)
+{
+	struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
+	struct r600_bc_cf *cf, *next_cf;
+
+	r600_bo_reference(rctx->radeon, &shader->bo, NULL);
+
+	/* FIXME: is there more stuff to free? */
+}
+
 /*
  * tgsi -> r600 shader
  */
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 7100529..07e29bc 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -1184,7 +1184,8 @@ static void r600_delete_ps_shader(struct pipe_context *ctx, void *state)
 	if (rctx->ps_shader == shader) {
 		rctx->ps_shader = NULL;
 	}
-	/* TODO proper delete */
+
+	r600_pipe_shader_destroy(ctx, shader);
 	free(shader);
 }
 
@@ -1196,7 +1197,8 @@ static void r600_delete_vs_shader(struct pipe_context *ctx, void *state)
 	if (rctx->vs_shader == shader) {
 		rctx->vs_shader = NULL;
 	}
-	/* TODO proper delete */
+
+	r600_pipe_shader_destroy(ctx, shader);
 	free(shader);
 }
 
-- 
1.7.3.1



More information about the mesa-dev mailing list