i965: stop passing gl_shader_program to the precompile and codegen functions
authorTimothy Arceri <timothy.arceri@collabora.com>
Fri, 4 Nov 2016 05:04:01 +0000 (16:04 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Fri, 6 Jan 2017 00:21:42 +0000 (11:21 +1100)
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 <eric@anholt.net>
12 files changed:
src/mesa/drivers/dri/i965/brw_cs.c
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_gs.h
src/mesa/drivers/dri/i965/brw_link.cpp
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_tcs.c
src/mesa/drivers/dri/i965/brw_tes.c
src/mesa/drivers/dri/i965/brw_vs.c
src/mesa/drivers/dri/i965/brw_vs.h
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm.h

index 824e6e527f3f8b27aea5fd60512daa2765595643..0f8d4ebcb83661e868f683908d00e625b2f95e43 100644 (file)
@@ -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;
index 613dd62db13741275999a15fe3dc202cdf7fd879..b7fb9f9c1eaab697523f716fd23f4b1342cabfef 100644 (file)
@@ -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;
index e1f8c4db0d34b6bcb874a78b28777181258865f2..537a41679dfb59b2a76b829fcc3b73fa10e6e8cf 100644 (file)
@@ -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
index 380e454716e92ccd3759ae377a9db4602f6deeeb..efb2ac33ca711fa0b3210d0c7a4e53445974057e 100644 (file)
@@ -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;
index 93b29749b286fd17c6f2e4ff92b225bd098d6479..c8fb3fa4c7fa989b44274f3d0c4163c3cf819b0e 100644 (file)
@@ -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:
index f6a9d1b58d9af7ecb0beda631e81df94a9952f07..9366d91c74aafb9116383535cbf4cb47e3678689 100644 (file)
@@ -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);
index 0794f0f5948627095abb7024d0961a6152b2187d..70571774a1e2cff6d7da6376619b2623c420dd8b 100644 (file)
@@ -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;
index 43a8c3f325e9e5cf87b4c9340dd0946327a577a6..124df66ef9b9a4f288e1d7aa82300e8986efe8d4 100644 (file)
@@ -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;
index cfba77842ca8e45f538bb9c430e5a80148d794e7..afb1f2033089c8eeeff1b56e5914f1ce1d626d09 100644 (file)
@@ -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;
index 8a5024d877fb95a0e8f7ac239b3fb48e05ae0dfa..2b49afbf1ca5cfda144a537cff5ac5339e5bf502 100644 (file)
@@ -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);
index 6ada9b4d48d3160b430563dadc272a788dfd6018..56b60b87ffb6c8f6b514071a439a6d5893d79817 100644 (file)
@@ -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;
index 3a03c163be7839e345f24314aa5e6d51e01ea539..c037b3da14d8efef8ef1f4d0283c19bbee0c9490 100644 (file)
@@ -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);