From d48a2404a227193b0e17b94ce10481f36d99430c Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 11 May 2018 08:16:37 -0400 Subject: [PATCH] freedreno/a4xx: remove fd4_shader_stateobj Extra level of indirection that serves no purpose. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/a4xx/fd4_emit.h | 8 +++---- .../drivers/freedreno/a4xx/fd4_program.c | 21 ++++++------------- .../drivers/freedreno/a4xx/fd4_program.h | 4 ---- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_emit.h b/src/gallium/drivers/freedreno/a4xx/fd4_emit.h index a724caedc29..73bf199300f 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_emit.h +++ b/src/gallium/drivers/freedreno/a4xx/fd4_emit.h @@ -71,8 +71,8 @@ static inline const struct ir3_shader_variant * fd4_emit_get_vp(struct fd4_emit *emit) { if (!emit->vp) { - struct fd4_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; } @@ -86,8 +86,8 @@ fd4_emit_get_fp(struct fd4_emit *emit) static const struct ir3_shader_variant binning_fp = {}; emit->fp = &binning_fp; } else { - struct fd4_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/a4xx/fd4_program.c b/src/gallium/drivers/freedreno/a4xx/fd4_program.c index 05b0c4f9ae0..7c399d99a1f 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_program.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_program.c @@ -39,22 +39,13 @@ #include "fd4_texture.h" #include "fd4_format.h" -static void -delete_shader_stateobj(struct fd4_shader_stateobj *so) -{ - ir3_shader_destroy(so->shader); - free(so); -} - -static struct fd4_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 fd4_shader_stateobj *so = CALLOC_STRUCT(fd4_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 * @@ -67,8 +58,8 @@ fd4_fp_state_create(struct pipe_context *pctx, static void fd4_fp_state_delete(struct pipe_context *pctx, void *hwcso) { - struct fd4_shader_stateobj *so = hwcso; - delete_shader_stateobj(so); + struct ir3_shader *so = hwcso; + ir3_shader_destroy(so); } static void * @@ -81,8 +72,8 @@ fd4_vp_state_create(struct pipe_context *pctx, static void fd4_vp_state_delete(struct pipe_context *pctx, void *hwcso) { - struct fd4_shader_stateobj *so = hwcso; - delete_shader_stateobj(so); + struct ir3_shader *so = hwcso; + ir3_shader_destroy(so); } static void diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_program.h b/src/gallium/drivers/freedreno/a4xx/fd4_program.h index 8dfccaf9d74..5d8eb552475 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_program.h +++ b/src/gallium/drivers/freedreno/a4xx/fd4_program.h @@ -33,10 +33,6 @@ #include "freedreno_context.h" #include "ir3_shader.h" -struct fd4_shader_stateobj { - struct ir3_shader *shader; -}; - struct fd4_emit; void fd4_program_emit(struct fd_ringbuffer *ring, struct fd4_emit *emit, -- 2.30.2