diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.h | 4 |
7 files changed, 33 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 054ff2c7944..f3f69c46c2c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3749,16 +3749,14 @@ brw_wm_fs_emit(struct brw_context *brw, } bool -brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) +brw_fs_precompile(struct gl_context *ctx, + struct gl_shader_program *shader_prog, + struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_wm_prog_key key; - if (!prog->_LinkedShaders[MESA_SHADER_FRAGMENT]) - return true; - - struct gl_fragment_program *fp = (struct gl_fragment_program *) - prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program; + struct gl_fragment_program *fp = (struct gl_fragment_program *) prog; struct brw_fragment_program *bfp = brw_fragment_program(fp); bool program_uses_dfdy = fp->UsesDFdy; @@ -3816,7 +3814,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) uint32_t old_prog_offset = brw->wm.base.prog_offset; struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data; - bool success = do_wm_prog(brw, prog, bfp, &key); + bool success = do_wm_prog(brw, shader_prog, bfp, &key); brw->wm.base.prog_offset = old_prog_offset; brw->wm.prog_data = old_prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index d4f663d2beb..f558662064b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -797,6 +797,8 @@ private: bool brw_do_channel_expressions(struct exec_list *instructions); bool brw_do_vector_splitting(struct exec_list *instructions); -bool brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog); +bool brw_fs_precompile(struct gl_context *ctx, + struct gl_shader_program *shader_prog, + struct gl_program *prog); struct brw_reg brw_reg_from_fs_reg(fs_reg *reg); diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index f44ac26d580..d51500effba 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -374,7 +374,9 @@ const struct brw_tracked_state brw_gs_prog = { bool -brw_gs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) +brw_gs_precompile(struct gl_context *ctx, + struct gl_shader_program *shader_prog, + struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_gs_prog_key key; @@ -382,11 +384,7 @@ brw_gs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) struct brw_gs_prog_data *old_prog_data = brw->gs.prog_data; bool success; - if (!prog->_LinkedShaders[MESA_SHADER_GEOMETRY]) - return true; - - struct gl_geometry_program *gp = (struct gl_geometry_program *) - prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->Program; + struct gl_geometry_program *gp = (struct gl_geometry_program *) prog; struct brw_geometry_program *bgp = brw_geometry_program(gp); memset(&key, 0, sizeof(key)); @@ -398,7 +396,7 @@ brw_gs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) */ key.input_varyings = gp->Base.InputsRead; - success = do_gs_prog(brw, prog, bgp, &key); + success = do_gs_prog(brw, shader_prog, bgp, &key); brw->gs.base.prog_offset = old_prog_offset; brw->gs.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 5d4244edf85..85228eb5e78 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -32,8 +32,11 @@ extern "C" { struct gl_context; struct gl_shader_program; +struct gl_program; -bool brw_gs_precompile(struct gl_context *ctx, struct gl_shader_program *prog); +bool brw_gs_precompile(struct gl_context *ctx, + struct gl_shader_program *shader_prog, + struct gl_program *prog); bool brw_gs_prog_data_compare(const void *a, const void *b); #ifdef __cplusplus diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index 78db48420b4..6a14932629a 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -55,17 +55,20 @@ brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type) * the eventual NOS used, and thus allows us to produce link failures. */ static bool -brw_shader_precompile(struct gl_context *ctx, struct gl_shader_program *prog) +brw_shader_precompile(struct gl_context *ctx, + struct gl_shader_program *sh_prog) { - struct brw_context *brw = brw_context(ctx); + struct gl_shader *vs = sh_prog->_LinkedShaders[MESA_SHADER_VERTEX]; + struct gl_shader *gs = sh_prog->_LinkedShaders[MESA_SHADER_GEOMETRY]; + struct gl_shader *fs = sh_prog->_LinkedShaders[MESA_SHADER_FRAGMENT]; - if (!brw_fs_precompile(ctx, prog)) + if (fs && !brw_fs_precompile(ctx, sh_prog, fs->Program)) return false; - if (!brw_gs_precompile(ctx, prog)) + if (gs && !brw_gs_precompile(ctx, sh_prog, gs->Program)) return false; - if (!brw_vs_precompile(ctx, prog)) + if (vs && !brw_vs_precompile(ctx, sh_prog, vs->Program)) return false; return true; diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index edaa82cb4c3..bab72cb8888 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -523,7 +523,9 @@ const struct brw_tracked_state brw_vs_prog = { }; bool -brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) +brw_vs_precompile(struct gl_context *ctx, + struct gl_shader_program *shader_prog, + struct gl_program *prog) { struct brw_context *brw = brw_context(ctx); struct brw_vs_prog_key key; @@ -531,18 +533,14 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) struct brw_vs_prog_data *old_prog_data = brw->vs.prog_data; bool success; - if (!prog->_LinkedShaders[MESA_SHADER_VERTEX]) - return true; - - struct gl_vertex_program *vp = (struct gl_vertex_program *) - prog->_LinkedShaders[MESA_SHADER_VERTEX]->Program; + struct gl_vertex_program *vp = (struct gl_vertex_program *) prog; struct brw_vertex_program *bvp = brw_vertex_program(vp); memset(&key, 0, sizeof(key)); brw_vec4_setup_prog_key_for_precompile(ctx, &key.base, bvp->id, &vp->Base); - success = do_vs_prog(brw, prog, bvp, &key); + success = do_vs_prog(brw, shader_prog, bvp, &key); brw->vs.base.prog_offset = old_prog_offset; brw->vs.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 97308a78a3c..77792d99b47 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -89,7 +89,9 @@ const unsigned *brw_vs_emit(struct brw_context *brw, struct brw_vs_prog_data *prog_data, void *mem_ctx, unsigned *program_size); -bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog); +bool brw_vs_precompile(struct gl_context *ctx, + struct gl_shader_program *shader_prog, + struct gl_program *prog); void brw_vs_debug_recompile(struct brw_context *brw, struct gl_shader_program *prog, const struct brw_vs_prog_key *key); |