Mesa (master): freedreno/a3xx: remove fd3_shader_stateobj

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


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

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

freedreno/a3xx: remove fd3_shader_stateobj

Extra level of indirection that serves no purpose.

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

---

 src/gallium/drivers/freedreno/a3xx/fd3_emit.h    |  8 ++++----
 src/gallium/drivers/freedreno/a3xx/fd3_program.c | 25 ++++++++----------------
 src/gallium/drivers/freedreno/a3xx/fd3_program.h |  6 +-----
 3 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.h b/src/gallium/drivers/freedreno/a3xx/fd3_emit.h
index 5e574da199..72e807ec24 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.h
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.h
@@ -62,8 +62,8 @@ static inline const struct ir3_shader_variant *
 fd3_emit_get_vp(struct fd3_emit *emit)
 {
 	if (!emit->vp) {
-		struct fd3_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;
 }
@@ -77,8 +77,8 @@ fd3_emit_get_fp(struct fd3_emit *emit)
 			static const struct ir3_shader_variant binning_fp = {};
 			emit->fp = &binning_fp;
 		} else {
-			struct fd3_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/a3xx/fd3_program.c b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
index f43d5c47ce..64eeb106e5 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.c
@@ -40,22 +40,13 @@
 #include "fd3_texture.h"
 #include "fd3_format.h"
 
-static void
-delete_shader_stateobj(struct fd3_shader_stateobj *so)
-{
-	ir3_shader_destroy(so->shader);
-	free(so);
-}
-
-static struct fd3_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 fd3_shader_stateobj *so = CALLOC_STRUCT(fd3_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 *
@@ -68,8 +59,8 @@ fd3_fp_state_create(struct pipe_context *pctx,
 static void
 fd3_fp_state_delete(struct pipe_context *pctx, void *hwcso)
 {
-	struct fd3_shader_stateobj *so = hwcso;
-	delete_shader_stateobj(so);
+	struct ir3_shader *so = hwcso;
+	ir3_shader_destroy(so);
 }
 
 static void *
@@ -82,15 +73,15 @@ fd3_vp_state_create(struct pipe_context *pctx,
 static void
 fd3_vp_state_delete(struct pipe_context *pctx, void *hwcso)
 {
-	struct fd3_shader_stateobj *so = hwcso;
-	delete_shader_stateobj(so);
+	struct ir3_shader *so = hwcso;
+	ir3_shader_destroy(so);
 }
 
 bool
-fd3_needs_manual_clipping(const struct fd3_shader_stateobj *so,
+fd3_needs_manual_clipping(const struct ir3_shader *shader,
 						  const struct pipe_rasterizer_state *rast)
 {
-	uint64_t outputs = ir3_shader_outputs(so->shader);
+	uint64_t outputs = ir3_shader_outputs(shader);
 
 	return (!rast->depth_clip ||
 			util_bitcount(rast->clip_plane_enable) > 6 ||
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_program.h b/src/gallium/drivers/freedreno/a3xx/fd3_program.h
index b95df4cc6b..04ebf12ed9 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_program.h
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_program.h
@@ -33,10 +33,6 @@
 #include "freedreno_context.h"
 #include "ir3_shader.h"
 
-struct fd3_shader_stateobj {
-	struct ir3_shader *shader;
-};
-
 struct fd3_emit;
 
 void fd3_program_emit(struct fd_ringbuffer *ring, struct fd3_emit *emit,
@@ -44,7 +40,7 @@ void fd3_program_emit(struct fd_ringbuffer *ring, struct fd3_emit *emit,
 
 void fd3_prog_init(struct pipe_context *pctx);
 
-bool fd3_needs_manual_clipping(const struct fd3_shader_stateobj *,
+bool fd3_needs_manual_clipping(const struct ir3_shader *,
 							   const struct pipe_rasterizer_state *);
 
 #endif /* FD3_PROGRAM_H_ */




More information about the mesa-commit mailing list