From 6e3f6097c995a74d4ce52f542413b01ff819c203 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Fri, 4 Nov 2016 16:04:01 +1100 Subject: [PATCH] i965: stop passing gl_shader_program to the precompile and codegen functions We no longer need it. While we are at it we mark the vs, gs, and wm codegen functions as static. Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/brw_cs.c | 12 +++--------- src/mesa/drivers/dri/i965/brw_gs.c | 14 ++++---------- src/mesa/drivers/dri/i965/brw_gs.h | 6 ------ src/mesa/drivers/dri/i965/brw_link.cpp | 8 ++++---- src/mesa/drivers/dri/i965/brw_program.c | 4 ++-- src/mesa/drivers/dri/i965/brw_shader.h | 16 ++++------------ src/mesa/drivers/dri/i965/brw_tcs.c | 13 ++++--------- src/mesa/drivers/dri/i965/brw_tes.c | 7 ++----- src/mesa/drivers/dri/i965/brw_vs.c | 14 ++++---------- src/mesa/drivers/dri/i965/brw_vs.h | 6 ------ src/mesa/drivers/dri/i965/brw_wm.c | 13 ++++--------- src/mesa/drivers/dri/i965/brw_wm.h | 5 ----- 12 files changed, 31 insertions(+), 87 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index 824e6e527f3..0f8d4ebcb83 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -51,7 +51,6 @@ assign_cs_binding_table_offsets(const struct gen_device_info *devinfo, static bool brw_codegen_cs_prog(struct brw_context *brw, - struct gl_shader_program *prog, struct brw_program *cp, struct brw_cs_prog_key *key) { @@ -215,10 +214,7 @@ brw_upload_cs_prog(struct brw_context *brw) &key, sizeof(key), &brw->cs.base.prog_offset, &brw->cs.base.prog_data)) { - bool success = - brw_codegen_cs_prog(brw, - ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE], - cp, &key); + bool success = brw_codegen_cs_prog(brw, cp, &key); (void) success; assert(success); } @@ -226,9 +222,7 @@ brw_upload_cs_prog(struct brw_context *brw) bool -brw_cs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog) +brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_cs_prog_key key; @@ -243,7 +237,7 @@ brw_cs_precompile(struct gl_context *ctx, uint32_t old_prog_offset = brw->cs.base.prog_offset; struct brw_stage_prog_data *old_prog_data = brw->cs.base.prog_data; - bool success = brw_codegen_cs_prog(brw, shader_prog, bcp, &key); + bool success = brw_codegen_cs_prog(brw, bcp, &key); brw->cs.base.prog_offset = old_prog_offset; brw->cs.base.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 613dd62db13..b7fb9f9c1ea 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -86,9 +86,8 @@ assign_gs_binding_table_offsets(const struct gen_device_info *devinfo, &prog_data->base.base, reserved); } -bool +static bool brw_codegen_gs_prog(struct brw_context *brw, - struct gl_shader_program *prog, struct brw_program *gp, struct brw_gs_prog_key *key) { @@ -210,8 +209,6 @@ brw_gs_populate_key(struct brw_context *brw, void brw_upload_gs_prog(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; - struct gl_shader_program **current = ctx->_Shader->CurrentProgram; struct brw_stage_state *stage_state = &brw->gs.base; struct brw_gs_prog_key key; /* BRW_NEW_GEOMETRY_PROGRAM */ @@ -242,17 +239,14 @@ brw_upload_gs_prog(struct brw_context *brw) &key, sizeof(key), &stage_state->prog_offset, &brw->gs.base.prog_data)) { - bool success = brw_codegen_gs_prog(brw, current[MESA_SHADER_GEOMETRY], - gp, &key); + bool success = brw_codegen_gs_prog(brw, gp, &key); assert(success); (void)success; } } bool -brw_gs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog) +brw_gs_precompile(struct gl_context *ctx, struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_gs_prog_key key; @@ -267,7 +261,7 @@ brw_gs_precompile(struct gl_context *ctx, brw_setup_tex_for_precompile(brw, &key.tex, prog); key.program_string_id = bgp->id; - success = brw_codegen_gs_prog(brw, shader_prog, bgp, &key); + success = brw_codegen_gs_prog(brw, bgp, &key); brw->gs.base.prog_offset = old_prog_offset; brw->gs.base.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index e1f8c4db0d3..537a41679df 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -41,12 +41,6 @@ void brw_gs_populate_key(struct brw_context *brw, struct brw_gs_prog_key *key); -bool -brw_codegen_gs_prog(struct brw_context *brw, - struct gl_shader_program *prog, - struct brw_program *gp, - struct brw_gs_prog_key *key); - #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 380e454716e..efb2ac33ca7 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -50,10 +50,10 @@ brw_shader_precompile(struct gl_context *ctx, struct gl_linked_shader *fs = sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; struct gl_linked_shader *cs = sh_prog->_LinkedShaders[MESA_SHADER_COMPUTE]; - if (fs && !brw_fs_precompile(ctx, sh_prog, fs->Program)) + if (fs && !brw_fs_precompile(ctx, fs->Program)) return false; - if (gs && !brw_gs_precompile(ctx, sh_prog, gs->Program)) + if (gs && !brw_gs_precompile(ctx, gs->Program)) return false; if (tes && !brw_tes_precompile(ctx, sh_prog, tes->Program)) @@ -62,10 +62,10 @@ brw_shader_precompile(struct gl_context *ctx, if (tcs && !brw_tcs_precompile(ctx, sh_prog, tcs->Program)) return false; - if (vs && !brw_vs_precompile(ctx, sh_prog, vs->Program)) + if (vs && !brw_vs_precompile(ctx, vs->Program)) return false; - if (cs && !brw_cs_precompile(ctx, sh_prog, cs->Program)) + if (cs && !brw_cs_precompile(ctx, cs->Program)) return false; return true; diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 93b29749b28..c8fb3fa4c7f 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -212,7 +212,7 @@ brwProgramStringNotify(struct gl_context *ctx, prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_FRAGMENT, true); - brw_fs_precompile(ctx, NULL, prog); + brw_fs_precompile(ctx, prog); break; } case GL_VERTEX_PROGRAM_ARB: { @@ -236,7 +236,7 @@ brwProgramStringNotify(struct gl_context *ctx, prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_VERTEX, compiler->scalar_stage[MESA_SHADER_VERTEX]); - brw_vs_precompile(ctx, NULL, prog); + brw_vs_precompile(ctx, prog); break; } default: diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h index f6a9d1b58d9..9366d91c74a 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.h +++ b/src/mesa/drivers/dri/i965/brw_shader.h @@ -277,24 +277,16 @@ brw_assign_common_binding_table_offsets(const struct gen_device_info *devinfo, struct brw_stage_prog_data *stage_prog_data, uint32_t next_binding_table_offset); -bool brw_vs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog); +bool brw_vs_precompile(struct gl_context *ctx, struct gl_program *prog); bool brw_tcs_precompile(struct gl_context *ctx, struct gl_shader_program *shader_prog, struct gl_program *prog); bool brw_tes_precompile(struct gl_context *ctx, struct gl_shader_program *shader_prog, struct gl_program *prog); -bool brw_gs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog); -bool brw_fs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog); -bool brw_cs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog); +bool brw_gs_precompile(struct gl_context *ctx, struct gl_program *prog); +bool brw_fs_precompile(struct gl_context *ctx, struct gl_program *prog); +bool brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog); GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog); struct gl_linked_shader *brw_new_shader(gl_shader_stage stage); diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 0794f0f5948..70571774a1e 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -163,11 +163,8 @@ brw_tcs_debug_recompile(struct brw_context *brw, struct gl_program *prog, } static bool -brw_codegen_tcs_prog(struct brw_context *brw, - struct gl_shader_program *shader_prog, - struct brw_program *tcp, - struct brw_program *tep, - struct brw_tcs_prog_key *key) +brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp, + struct brw_program *tep, struct brw_tcs_prog_key *key) { struct gl_context *ctx = &brw->ctx; const struct brw_compiler *compiler = brw->screen->compiler; @@ -346,7 +343,6 @@ brw_tcs_populate_key(struct brw_context *brw, void brw_upload_tcs_prog(struct brw_context *brw) { - struct gl_shader_program **current = brw->ctx._Shader->CurrentProgram; struct brw_stage_state *stage_state = &brw->tcs.base; struct brw_tcs_prog_key key; /* BRW_NEW_TESS_PROGRAMS */ @@ -367,8 +363,7 @@ brw_upload_tcs_prog(struct brw_context *brw) &key, sizeof(key), &stage_state->prog_offset, &brw->tcs.base.prog_data)) { - bool success = brw_codegen_tcs_prog(brw, current[MESA_SHADER_TESS_CTRL], - tcp, tep, &key); + bool success = brw_codegen_tcs_prog(brw, tcp, tep, &key); assert(success); (void)success; } @@ -416,7 +411,7 @@ brw_tcs_precompile(struct gl_context *ctx, key.outputs_written = prog->nir->info->outputs_written; key.patch_outputs_written = prog->nir->info->patch_outputs_written; - success = brw_codegen_tcs_prog(brw, shader_prog, btcp, btep, &key); + success = brw_codegen_tcs_prog(brw, btcp, btep, &key); brw->tcs.base.prog_offset = old_prog_offset; brw->tcs.base.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 43a8c3f325e..124df66ef9b 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -77,7 +77,6 @@ brw_tes_debug_recompile(struct brw_context *brw, struct gl_program *prog, static bool brw_codegen_tes_prog(struct brw_context *brw, - struct gl_shader_program *shader_prog, struct brw_program *tep, struct brw_tes_prog_key *key) { @@ -255,7 +254,6 @@ brw_tes_populate_key(struct brw_context *brw, void brw_upload_tes_prog(struct brw_context *brw) { - struct gl_shader_program **current = brw->ctx._Shader->CurrentProgram; struct brw_stage_state *stage_state = &brw->tes.base; struct brw_tes_prog_key key; /* BRW_NEW_TESS_PROGRAMS */ @@ -272,8 +270,7 @@ brw_upload_tes_prog(struct brw_context *brw) &key, sizeof(key), &stage_state->prog_offset, &brw->tes.base.prog_data)) { - bool success = brw_codegen_tes_prog(brw, current[MESA_SHADER_TESS_EVAL], - tep, &key); + bool success = brw_codegen_tes_prog(brw, tep, &key); assert(success); (void)success; } @@ -312,7 +309,7 @@ brw_tes_precompile(struct gl_context *ctx, brw_setup_tex_for_precompile(brw, &key.tex, prog); - success = brw_codegen_tes_prog(brw, shader_prog, btep, &key); + success = brw_codegen_tes_prog(brw, btep, &key); brw->tes.base.prog_offset = old_prog_offset; brw->tes.base.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index cfba77842ca..afb1f203308 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -137,9 +137,8 @@ brw_vs_debug_recompile(struct brw_context *brw, struct gl_program *prog, } } -bool +static bool brw_codegen_vs_prog(struct brw_context *brw, - struct gl_shader_program *prog, struct brw_program *vp, struct brw_vs_prog_key *key) { @@ -343,8 +342,6 @@ brw_vs_populate_key(struct brw_context *brw, void brw_upload_vs_prog(struct brw_context *brw) { - struct gl_context *ctx = &brw->ctx; - struct gl_shader_program **current = ctx->_Shader->CurrentProgram; struct brw_vs_prog_key key; /* BRW_NEW_VERTEX_PROGRAM */ struct brw_program *vp = (struct brw_program *)brw->vertex_program; @@ -357,17 +354,14 @@ brw_upload_vs_prog(struct brw_context *brw) if (!brw_search_cache(&brw->cache, BRW_CACHE_VS_PROG, &key, sizeof(key), &brw->vs.base.prog_offset, &brw->vs.base.prog_data)) { - bool success = brw_codegen_vs_prog(brw, current[MESA_SHADER_VERTEX], - vp, &key); + bool success = brw_codegen_vs_prog(brw, vp, &key); (void) success; assert(success); } } bool -brw_vs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog) +brw_vs_precompile(struct gl_context *ctx, struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_vs_prog_key key; @@ -386,7 +380,7 @@ brw_vs_precompile(struct gl_context *ctx, (VARYING_BIT_COL0 | VARYING_BIT_COL1 | VARYING_BIT_BFC0 | VARYING_BIT_BFC1)); - success = brw_codegen_vs_prog(brw, shader_prog, bvp, &key); + success = brw_codegen_vs_prog(brw, bvp, &key); brw->vs.base.prog_offset = old_prog_offset; brw->vs.base.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 8a5024d877f..2b49afbf1ca 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -58,12 +58,6 @@ brw_vs_outputs_written(struct brw_context *brw, struct brw_vs_prog_key *key, void brw_upload_vs_prog(struct brw_context *brw); -bool -brw_codegen_vs_prog(struct brw_context *brw, - struct gl_shader_program *prog, - struct brw_program *vp, - struct brw_vs_prog_key *key); - void brw_vs_populate_key(struct brw_context *brw, struct brw_vs_prog_key *key); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 6ada9b4d48d..56b60b87ffb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -132,9 +132,8 @@ brw_wm_debug_recompile(struct brw_context *brw, struct gl_program *prog, * Depending on the instructions used (i.e. flow control instructions) * we'll use one of two code generators. */ -bool +static bool brw_codegen_wm_prog(struct brw_context *brw, - struct gl_shader_program *prog, struct brw_program *fp, struct brw_wm_prog_key *key, struct brw_vue_map *vue_map) @@ -563,8 +562,6 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key) void 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_program *fp = (struct brw_program *) brw->fragment_program; @@ -577,7 +574,7 @@ brw_upload_wm_prog(struct brw_context *brw) &key, sizeof(key), &brw->wm.base.prog_offset, &brw->wm.base.prog_data)) { - bool success = brw_codegen_wm_prog(brw, current, fp, &key, + bool success = brw_codegen_wm_prog(brw, fp, &key, &brw->vue_map_geom_out); (void) success; assert(success); @@ -585,9 +582,7 @@ brw_upload_wm_prog(struct brw_context *brw) } bool -brw_fs_precompile(struct gl_context *ctx, - struct gl_shader_program *shader_prog, - struct gl_program *prog) +brw_fs_precompile(struct gl_context *ctx, struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_wm_prog_key key; @@ -637,7 +632,7 @@ brw_fs_precompile(struct gl_context *ctx, false); } - bool success = brw_codegen_wm_prog(brw, shader_prog, bfp, &key, &vue_map); + bool success = brw_codegen_wm_prog(brw, bfp, &key, &vue_map); brw->wm.base.prog_offset = old_prog_offset; brw->wm.base.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 3a03c163be7..c037b3da14d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -60,11 +60,6 @@ extern "C" { #endif 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_program *fp, - struct brw_wm_prog_key *key, - struct brw_vue_map *vue_map); void brw_upload_wm_prog(struct brw_context *brw); -- 2.30.2