Mesa (master): freedreno/a5xx: remove fd5_shader_stateobj

Rob Clark robclark at kemper.freedesktop.org
Tue May 15 13:08:35 UTC 2018


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

Author: Rob Clark <robdclark at gmail.com>
Date:   Fri May 11 08:19:22 2018 -0400

freedreno/a5xx: remove fd5_shader_stateobj

Extra level of indirection that serves no purpose.

Signed-off-by: Rob Clark <robdclark at gmail.com>

---

 src/gallium/drivers/freedreno/a5xx/fd5_emit.h    |  8 ++++----
 src/gallium/drivers/freedreno/a5xx/fd5_program.c | 21 ++++++---------------
 src/gallium/drivers/freedreno/a5xx/fd5_program.h |  4 ----
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_emit.h b/src/gallium/drivers/freedreno/a5xx/fd5_emit.h
index 2d8a0fd09c..809ae475ce 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_emit.h
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_emit.h
@@ -75,8 +75,8 @@ static inline const struct ir3_shader_variant *
 fd5_emit_get_vp(struct fd5_emit *emit)
 {
 	if (!emit->vp) {
-		struct fd5_shader_stateobj *so = emit->prog->vp;
-		emit->vp = ir3_shader_variant(so->shader, emit->key, emit->debug);
+		struct ir3_shader *shader = emit->prog->vp;
+		emit->vp = ir3_shader_variant(shader, emit->key, emit->debug);
 	}
 	return emit->vp;
 }
@@ -90,8 +90,8 @@ fd5_emit_get_fp(struct fd5_emit *emit)
 			static const struct ir3_shader_variant binning_fp = {};
 			emit->fp = &binning_fp;
 		} else {
-			struct fd5_shader_stateobj *so = emit->prog->fp;
-			emit->fp = ir3_shader_variant(so->shader, emit->key, emit->debug);
+			struct ir3_shader *shader = emit->prog->fp;
+			emit->fp = ir3_shader_variant(shader, emit->key, emit->debug);
 		}
 	}
 	return emit->fp;
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_program.c b/src/gallium/drivers/freedreno/a5xx/fd5_program.c
index 81fe7d4b58..c93f257edf 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_program.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_program.c
@@ -38,22 +38,13 @@
 #include "fd5_texture.h"
 #include "fd5_format.h"
 
-static void
-delete_shader_stateobj(struct fd5_shader_stateobj *so)
-{
-	ir3_shader_destroy(so->shader);
-	free(so);
-}
-
-static struct fd5_shader_stateobj *
+static struct ir3_shader *
 create_shader_stateobj(struct pipe_context *pctx, const struct pipe_shader_state *cso,
 		enum shader_t type)
 {
 	struct fd_context *ctx = fd_context(pctx);
 	struct ir3_compiler *compiler = ctx->screen->compiler;
-	struct fd5_shader_stateobj *so = CALLOC_STRUCT(fd5_shader_stateobj);
-	so->shader = ir3_shader_create(compiler, cso, type, &ctx->debug);
-	return so;
+	return ir3_shader_create(compiler, cso, type, &ctx->debug);
 }
 
 static void *
@@ -66,8 +57,8 @@ fd5_fp_state_create(struct pipe_context *pctx,
 static void
 fd5_fp_state_delete(struct pipe_context *pctx, void *hwcso)
 {
-	struct fd5_shader_stateobj *so = hwcso;
-	delete_shader_stateobj(so);
+	struct ir3_shader *so = hwcso;
+	ir3_shader_destroy(so);
 }
 
 static void *
@@ -80,8 +71,8 @@ fd5_vp_state_create(struct pipe_context *pctx,
 static void
 fd5_vp_state_delete(struct pipe_context *pctx, void *hwcso)
 {
-	struct fd5_shader_stateobj *so = hwcso;
-	delete_shader_stateobj(so);
+	struct ir3_shader *so = hwcso;
+	ir3_shader_destroy(so);
 }
 
 void
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_program.h b/src/gallium/drivers/freedreno/a5xx/fd5_program.h
index 585263e0a8..72cbf9a8b8 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_program.h
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_program.h
@@ -31,10 +31,6 @@
 #include "freedreno_context.h"
 #include "ir3_shader.h"
 
-struct fd5_shader_stateobj {
-	struct ir3_shader *shader;
-};
-
 struct fd5_emit;
 
 void fd5_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so);




More information about the mesa-commit mailing list