From 13d0cf57bf069644e4a1d8b2ddc3c5810e84cc67 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 18 Oct 2016 16:17:14 +1100 Subject: [PATCH] i965: replace brw_fragment_program with brw_program Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_context.h | 21 +------------------ src/mesa/drivers/dri/i965/brw_program.c | 10 ++++----- src/mesa/drivers/dri/i965/brw_wm.c | 10 ++++----- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- .../drivers/dri/i965/brw_wm_surface_state.c | 3 +-- src/mesa/drivers/dri/i965/gen6_wm_state.c | 3 +-- 6 files changed, 13 insertions(+), 36 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 203c9fef533..48c2066e8a3 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -334,15 +334,8 @@ struct brw_program { }; -/** Subclass of Mesa fragment program */ -struct brw_fragment_program { - struct gl_program program; - GLuint id; /**< serial no. to identify frag progs, never re-used */ -}; - - struct gen4_fragment_program { - struct brw_fragment_program base; + struct brw_program base; bool contains_flat_varying; bool contains_noperspective_varying; @@ -1690,18 +1683,6 @@ brw_program_const(const struct gl_program *p) return (const struct brw_program *) p; } -static inline struct brw_fragment_program * -brw_fragment_program(struct gl_program *p) -{ - return (struct brw_fragment_program *) p; -} - -static inline const struct brw_fragment_program * -brw_fragment_program_const(const struct gl_program *p) -{ - return (const struct brw_fragment_program *) p; -} - static inline struct brw_compute_program * brw_compute_program(struct gl_program *p) { diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index b7ad962e4ea..ad728696a38 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -145,13 +145,13 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx, } case GL_FRAGMENT_PROGRAM_ARB: { - struct brw_fragment_program *prog; + struct brw_program *prog; if (brw->gen < 6) { struct gen4_fragment_program *g4_prog = CALLOC_STRUCT(gen4_fragment_program); prog = &g4_prog->base; } else { - prog = CALLOC_STRUCT(brw_fragment_program); + prog = CALLOC_STRUCT(brw_program); } if (prog) { @@ -198,9 +198,9 @@ brwProgramStringNotify(struct gl_context *ctx, switch (target) { case GL_FRAGMENT_PROGRAM_ARB: { - struct brw_fragment_program *newFP = brw_fragment_program(prog); - const struct brw_fragment_program *curFP = - brw_fragment_program_const(brw->fragment_program); + struct brw_program *newFP = brw_program(prog); + const struct brw_program *curFP = + brw_program_const(brw->fragment_program); if (newFP == curFP) brw->ctx.NewDriverState |= BRW_NEW_FRAGMENT_PROGRAM; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 851ba102ad2..f433ed6f4da 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -76,7 +76,7 @@ assign_fs_binding_table_offsets(const struct gen_device_info *devinfo, bool brw_codegen_wm_prog(struct brw_context *brw, struct gl_shader_program *prog, - struct brw_fragment_program *fp, + struct brw_program *fp, struct brw_wm_prog_key *key, struct brw_vue_map *vue_map) { @@ -438,8 +438,7 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) { struct gl_context *ctx = &brw->ctx; /* BRW_NEW_FRAGMENT_PROGRAM */ - const struct brw_fragment_program *fp = - (struct brw_fragment_program *) brw->fragment_program; + const struct brw_program *fp = brw_program_const(brw->fragment_program); const struct gl_program *prog = (struct gl_program *) brw->fragment_program; GLuint lookup = 0; GLuint line_aa; @@ -574,8 +573,7 @@ brw_upload_wm_prog(struct brw_context *brw) struct gl_context *ctx = &brw->ctx; struct gl_shader_program *current = ctx->_Shader->_CurrentFragmentProgram; struct brw_wm_prog_key key; - struct brw_fragment_program *fp = (struct brw_fragment_program *) - brw->fragment_program; + struct brw_program *fp = (struct brw_program *) brw->fragment_program; if (!brw_wm_state_dirty(brw)) return; @@ -601,7 +599,7 @@ brw_fs_precompile(struct gl_context *ctx, struct brw_context *brw = brw_context(ctx); struct brw_wm_prog_key key; - struct brw_fragment_program *bfp = brw_fragment_program(prog); + struct brw_program *bfp = brw_program(prog); memset(&key, 0, sizeof(key)); diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index f4f513bef0a..135e98f32a0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -62,7 +62,7 @@ extern "C" { bool brw_color_buffer_write_enabled(struct brw_context *brw); bool brw_codegen_wm_prog(struct brw_context *brw, struct gl_shader_program *prog, - struct brw_fragment_program *fp, + struct brw_program *fp, struct brw_wm_prog_key *key, struct brw_vue_map *vue_map); void brw_wm_debug_recompile(struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 667d48c044a..fcd753c11a6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -832,8 +832,7 @@ brw_upload_wm_pull_constants(struct brw_context *brw) { struct brw_stage_state *stage_state = &brw->wm.base; /* BRW_NEW_FRAGMENT_PROGRAM */ - struct brw_fragment_program *fp = - (struct brw_fragment_program *) brw->fragment_program; + struct brw_program *fp = (struct brw_program *) brw->fragment_program; /* BRW_NEW_FS_PROG_DATA */ struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data; diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index bd279ecebf2..a618ea95ca7 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -42,8 +42,7 @@ gen6_upload_wm_push_constants(struct brw_context *brw) { struct brw_stage_state *stage_state = &brw->wm.base; /* BRW_NEW_FRAGMENT_PROGRAM */ - const struct brw_fragment_program *fp = - brw_fragment_program_const(brw->fragment_program); + const struct brw_program *fp = brw_program_const(brw->fragment_program); /* BRW_NEW_FS_PROG_DATA */ const struct brw_stage_prog_data *prog_data = brw->wm.base.prog_data; -- 2.30.2