#include "util/ralloc.h"
-static void compile_ff_gs_prog(struct brw_context *brw,
- struct brw_ff_gs_prog_key *key)
+void
+brw_compile_ff_gs_prog(struct brw_context *brw,
+ struct brw_ff_gs_prog_key *key)
{
struct brw_ff_gs_compile c;
const GLuint *program;
if (!brw_search_cache(&brw->cache, BRW_CACHE_FF_GS_PROG,
&key, sizeof(key),
&brw->ff_gs.prog_offset, &brw->ff_gs.prog_data)) {
- compile_ff_gs_prog( brw, &key );
+ brw_compile_ff_gs_prog(brw, &key);
}
}
}
void
brw_upload_ff_gs_prog(struct brw_context *brw);
+void
+brw_compile_ff_gs_prog(struct brw_context *brw,
+ struct brw_ff_gs_prog_key *key);
+
#endif
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, shader_prog, bfp, &key);
+ bool success = brw_compile_wm_prog(brw, shader_prog, bfp, &key);
brw->wm.base.prog_offset = old_prog_offset;
brw->wm.prog_data = old_prog_data;
#include "brw_ff_gs.h"
-static bool
-do_gs_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_geometry_program *gp,
- struct brw_gs_prog_key *key)
+bool
+brw_compile_gs_prog(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_geometry_program *gp,
+ struct brw_gs_prog_key *key)
{
struct brw_stage_state *stage_state = &brw->gs.base;
struct brw_gs_compile c;
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 */
if (!brw_search_cache(&brw->cache, BRW_CACHE_GS_PROG,
&key, sizeof(key),
&stage_state->prog_offset, &brw->gs.prog_data)) {
- bool success =
- do_gs_prog(brw, ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY], gp,
- &key);
+ bool success = brw_compile_gs_prog(brw, current[MESA_SHADER_GEOMETRY],
+ gp, &key);
assert(success);
(void)success;
}
*/
key.input_varyings = gp->Base.InputsRead;
- success = do_gs_prog(brw, shader_prog, bgp, &key);
+ success = brw_compile_gs_prog(brw, shader_prog, bgp, &key);
brw->gs.base.prog_offset = old_prog_offset;
brw->gs.prog_data = old_prog_data;
#include <stdbool.h>
#include "brw_context.h"
+#include "brw_program.h"
#ifdef __cplusplus
extern "C" {
void
brw_upload_gs_prog(struct brw_context *brw);
+bool
+brw_compile_gs_prog(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_geometry_program *gp,
+ struct brw_gs_prog_key *key);
+
#ifdef __cplusplus
} /* extern "C" */
#endif
return true;
}
-static bool
-do_vs_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_vertex_program *vp,
- struct brw_vs_prog_key *key)
+bool
+brw_compile_vs_prog(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_vertex_program *vp,
+ struct brw_vs_prog_key *key)
{
GLuint program_size;
const GLuint *program;
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_vertex_program *vp =
if (!brw_search_cache(&brw->cache, BRW_CACHE_VS_PROG,
&key, sizeof(key),
&brw->vs.base.prog_offset, &brw->vs.prog_data)) {
- bool success =
- do_vs_prog(brw, ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX], vp,
- &key);
+ bool success = brw_compile_vs_prog(brw, current[MESA_SHADER_VERTEX],
+ vp, &key);
(void) success;
assert(success);
}
(prog->OutputsWritten & (VARYING_BIT_COL0 | VARYING_BIT_COL1 |
VARYING_BIT_BFC0 | VARYING_BIT_BFC1));
- success = do_vs_prog(brw, shader_prog, bvp, &key);
+ success = brw_compile_vs_prog(brw, shader_prog, bvp, &key);
brw->vs.base.prog_offset = old_prog_offset;
brw->vs.prog_data = old_prog_data;
void
brw_upload_vs_prog(struct brw_context *brw);
+bool
+brw_compile_vs_prog(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_vertex_program *vp,
+ struct brw_vs_prog_key *key);
+
#ifdef __cplusplus
} /* extern "C" */
* Depending on the instructions used (i.e. flow control instructions)
* we'll use one of two code generators.
*/
-bool do_wm_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_fragment_program *fp,
- struct brw_wm_prog_key *key)
+bool
+brw_compile_wm_prog(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_fragment_program *fp,
+ struct brw_wm_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
void *mem_ctx = ralloc_context(NULL);
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_fragment_program *fp = (struct brw_fragment_program *)
brw->fragment_program;
if (!brw_search_cache(&brw->cache, BRW_CACHE_FS_PROG,
&key, sizeof(key),
&brw->wm.base.prog_offset, &brw->wm.prog_data)) {
- bool success = do_wm_prog(brw, ctx->_Shader->_CurrentFragmentProgram, fp,
- &key);
+ bool success = brw_compile_wm_prog(brw, current, fp, &key);
(void) success;
assert(success);
}
struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);
bool brw_color_buffer_write_enabled(struct brw_context *brw);
-bool do_wm_prog(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_fragment_program *fp,
- struct brw_wm_prog_key *key);
+bool brw_compile_wm_prog(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_fragment_program *fp,
+ struct brw_wm_prog_key *key);
void brw_wm_debug_recompile(struct brw_context *brw,
struct gl_shader_program *prog,
const struct brw_wm_prog_key *key);