From 46a4e4257e42dadc425592719863048d9012f9a7 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 18 Oct 2016 16:03:32 +1100 Subject: [PATCH] i965: replace brw_tess_{eval,ctrl}_program with brw_program Reviewed-by: Jason Ekstrand --- src/mesa/drivers/dri/i965/brw_context.h | 26 ------------------- src/mesa/drivers/dri/i965/brw_program.c | 24 ++--------------- src/mesa/drivers/dri/i965/brw_tcs.c | 17 +++++------- .../drivers/dri/i965/brw_tcs_surface_state.c | 3 +-- src/mesa/drivers/dri/i965/brw_tes.c | 13 ++++------ .../drivers/dri/i965/brw_tes_surface_state.c | 3 +-- src/mesa/drivers/dri/i965/gen7_ds_state.c | 3 +-- src/mesa/drivers/dri/i965/gen7_hs_state.c | 3 +-- 8 files changed, 18 insertions(+), 74 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 0c887510acd..203c9fef533 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -334,20 +334,6 @@ struct brw_program { }; -/** Subclass of Mesa tessellation control program */ -struct brw_tess_ctrl_program { - struct gl_program program; - unsigned id; /**< serial no. to identify tess ctrl progs, never re-used */ -}; - - -/** Subclass of Mesa tessellation evaluation program */ -struct brw_tess_eval_program { - struct gl_program program; - unsigned id; /**< serial no. to identify tess eval progs, never re-used */ -}; - - /** Subclass of Mesa fragment program */ struct brw_fragment_program { struct gl_program program; @@ -1704,18 +1690,6 @@ brw_program_const(const struct gl_program *p) return (const struct brw_program *) p; } -static inline struct brw_tess_ctrl_program * -brw_tess_ctrl_program(struct gl_program *p) -{ - return (struct brw_tess_ctrl_program *) p; -} - -static inline struct brw_tess_eval_program * -brw_tess_eval_program(struct gl_program *p) -{ - return (struct brw_tess_eval_program *) p; -} - static inline struct brw_fragment_program * brw_fragment_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 cb73f424f33..b7ad962e4ea 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -131,6 +131,8 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx, switch (target) { case GL_VERTEX_PROGRAM_ARB: + case GL_TESS_CONTROL_PROGRAM_NV: + case GL_TESS_EVALUATION_PROGRAM_NV: case GL_GEOMETRY_PROGRAM_NV: { struct brw_program *prog = CALLOC_STRUCT(brw_program); if (prog) { @@ -161,28 +163,6 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx, return NULL; } - case GL_TESS_CONTROL_PROGRAM_NV: { - struct brw_tess_ctrl_program *prog = CALLOC_STRUCT(brw_tess_ctrl_program); - if (prog) { - prog->id = get_new_program_id(brw->screen); - - return _mesa_init_gl_program(&prog->program, target, id); - } else { - return NULL; - } - } - - case GL_TESS_EVALUATION_PROGRAM_NV: { - struct brw_tess_eval_program *prog = CALLOC_STRUCT(brw_tess_eval_program); - if (prog) { - prog->id = get_new_program_id(brw->screen); - - return _mesa_init_gl_program(&prog->program, target, id); - } else { - return NULL; - } - } - case GL_COMPUTE_PROGRAM_NV: { struct brw_compute_program *prog = CALLOC_STRUCT(brw_compute_program); if (prog) { diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 75115074c0c..58d080d2876 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -165,7 +165,7 @@ brw_tcs_debug_recompile(struct brw_context *brw, static bool brw_codegen_tcs_prog(struct brw_context *brw, struct gl_shader_program *shader_prog, - struct brw_tess_ctrl_program *tcp, + struct brw_program *tcp, struct brw_tcs_prog_key *key) { struct gl_context *ctx = &brw->ctx; @@ -316,10 +316,8 @@ void brw_tcs_populate_key(struct brw_context *brw, struct brw_tcs_prog_key *key) { - struct brw_tess_ctrl_program *tcp = - (struct brw_tess_ctrl_program *) brw->tess_ctrl_program; - struct brw_tess_eval_program *tep = - (struct brw_tess_eval_program *) brw->tess_eval_program; + struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program; + struct brw_program *tep = (struct brw_program *) brw->tess_eval_program; struct gl_program *tes_prog = &tep->program; uint64_t per_vertex_slots = tes_prog->info.inputs_read; @@ -363,10 +361,9 @@ brw_upload_tcs_prog(struct brw_context *brw) struct brw_stage_state *stage_state = &brw->tcs.base; struct brw_tcs_prog_key key; /* BRW_NEW_TESS_PROGRAMS */ - struct brw_tess_ctrl_program *tcp = - (struct brw_tess_ctrl_program *) brw->tess_ctrl_program; - MAYBE_UNUSED struct brw_tess_eval_program *tep = - (struct brw_tess_eval_program *) brw->tess_eval_program; + struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program; + MAYBE_UNUSED struct brw_program *tep = + (struct brw_program *) brw->tess_eval_program; assert(tep); if (!brw_state_dirty(brw, @@ -400,7 +397,7 @@ brw_tcs_precompile(struct gl_context *ctx, struct brw_stage_prog_data *old_prog_data = brw->tcs.base.prog_data; bool success; - struct brw_tess_ctrl_program *btcp = brw_tess_ctrl_program(prog); + struct brw_program *btcp = brw_program(prog); const struct gl_linked_shader *tes = shader_prog->_LinkedShaders[MESA_SHADER_TESS_EVAL]; diff --git a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c index e91488fb492..83b561190bb 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_tcs_surface_state.c @@ -41,8 +41,7 @@ brw_upload_tcs_pull_constants(struct brw_context *brw) struct brw_stage_state *stage_state = &brw->tcs.base; /* BRW_NEW_TESS_PROGRAMS */ - struct brw_tess_ctrl_program *tcp = - (struct brw_tess_ctrl_program *) brw->tess_ctrl_program; + struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program; if (!tcp) return; diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 3992bb312a8..6060c765a8f 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -79,7 +79,7 @@ brw_tes_debug_recompile(struct brw_context *brw, static bool brw_codegen_tes_prog(struct brw_context *brw, struct gl_shader_program *shader_prog, - struct brw_tess_eval_program *tep, + struct brw_program *tep, struct brw_tes_prog_key *key) { const struct brw_compiler *compiler = brw->screen->compiler; @@ -233,10 +233,8 @@ void brw_tes_populate_key(struct brw_context *brw, struct brw_tes_prog_key *key) { - struct brw_tess_ctrl_program *tcp = - (struct brw_tess_ctrl_program *) brw->tess_ctrl_program; - struct brw_tess_eval_program *tep = - (struct brw_tess_eval_program *) brw->tess_eval_program; + struct brw_program *tcp = (struct brw_program *) brw->tess_ctrl_program; + struct brw_program *tep = (struct brw_program *) brw->tess_eval_program; struct gl_program *prog = &tep->program; uint64_t per_vertex_slots = prog->info.inputs_read; @@ -275,8 +273,7 @@ brw_upload_tes_prog(struct brw_context *brw) struct brw_stage_state *stage_state = &brw->tes.base; struct brw_tes_prog_key key; /* BRW_NEW_TESS_PROGRAMS */ - struct brw_tess_eval_program *tep = - (struct brw_tess_eval_program *) brw->tess_eval_program; + struct brw_program *tep = (struct brw_program *) brw->tess_eval_program; if (!brw_state_dirty(brw, _NEW_TEXTURE, @@ -308,7 +305,7 @@ brw_tes_precompile(struct gl_context *ctx, struct brw_stage_prog_data *old_prog_data = brw->tes.base.prog_data; bool success; - struct brw_tess_eval_program *btep = brw_tess_eval_program(prog); + struct brw_program *btep = brw_program(prog); memset(&key, 0, sizeof(key)); diff --git a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c index 2a7d48a591d..53b39cd29e7 100644 --- a/src/mesa/drivers/dri/i965/brw_tes_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_tes_surface_state.c @@ -41,8 +41,7 @@ brw_upload_tes_pull_constants(struct brw_context *brw) struct brw_stage_state *stage_state = &brw->tes.base; /* BRW_NEW_TESS_PROGRAMS */ - struct brw_tess_eval_program *dp = - (struct brw_tess_eval_program *) brw->tess_eval_program; + struct brw_program *dp = (struct brw_program *) brw->tess_eval_program; if (!dp) return; diff --git a/src/mesa/drivers/dri/i965/gen7_ds_state.c b/src/mesa/drivers/dri/i965/gen7_ds_state.c index 23e03d7e2af..9d7f5315de4 100644 --- a/src/mesa/drivers/dri/i965/gen7_ds_state.c +++ b/src/mesa/drivers/dri/i965/gen7_ds_state.c @@ -32,8 +32,7 @@ gen7_upload_tes_push_constants(struct brw_context *brw) { struct brw_stage_state *stage_state = &brw->tes.base; /* BRW_NEW_TESS_PROGRAMS */ - const struct brw_tess_eval_program *tep = - (struct brw_tess_eval_program *) brw->tess_eval_program; + const struct brw_program *tep = brw_program_const(brw->tess_eval_program); if (tep) { /* BRW_NEW_TES_PROG_DATA */ diff --git a/src/mesa/drivers/dri/i965/gen7_hs_state.c b/src/mesa/drivers/dri/i965/gen7_hs_state.c index 290aea23924..fadea2351da 100644 --- a/src/mesa/drivers/dri/i965/gen7_hs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_hs_state.c @@ -32,8 +32,7 @@ gen7_upload_tcs_push_constants(struct brw_context *brw) { struct brw_stage_state *stage_state = &brw->tcs.base; /* BRW_NEW_TESS_PROGRAMS */ - const struct brw_tess_ctrl_program *tcp = - (struct brw_tess_ctrl_program *) brw->tess_ctrl_program; + const struct brw_program *tcp = brw_program_const(brw->tess_ctrl_program); bool active = brw->tess_eval_program; if (active) { -- 2.30.2