}
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;
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;
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);
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;
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));
*/
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;
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
* 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;
};
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;
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;
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);