return !failed;
}
-bool
+const unsigned *
brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
struct gl_fragment_program *fp,
- struct gl_shader_program *prog)
+ struct gl_shader_program *prog,
+ unsigned *final_assembly_size)
{
struct intel_context *intel = &brw->intel;
bool start_busy = false;
float start_time = 0;
+ brw_init_compile(brw, &c->func, c);
+
if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
start_busy = (intel->batch.last_bo &&
drm_intel_bo_busy(intel->batch.last_bo));
_mesa_problem(NULL, "Failed to compile fragment shader: %s\n",
v.fail_msg);
- return false;
+ return NULL;
}
if (intel->gen >= 5 && c->prog_data.nr_pull_params == 0) {
}
}
- return true;
+ return brw_get_program(&c->func, final_assembly_size);
}
bool
memcpy(&c->key, key, sizeof(*key));
- brw_init_compile(brw, &c->func, c);
-
c->prog_data.barycentric_interp_modes =
brw_compute_barycentric_interp_modes(brw, c->key.flat_shade,
&fp->program);
- brw_wm_fs_emit(brw, c, &fp->program, prog);
+ program = brw_wm_fs_emit(brw, c, &fp->program, prog, &program_size);
+ if (program == NULL)
+ return false;
/* Scratch space is used for register spilling */
if (c->last_scratch) {
if (unlikely(INTEL_DEBUG & DEBUG_WM))
fprintf(stderr, "\n");
- /* get the program
- */
- program = brw_get_program(&c->func, &program_size);
-
brw_upload_cache(&brw->cache, BRW_WM_PROG,
&c->key, sizeof(c->key),
program, program_size,
GLuint last_scratch;
};
-bool brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
- struct gl_fragment_program *fp,
- struct gl_shader_program *prog);
+/**
+ * Compile a fragment shader.
+ *
+ * Returns the final assembly and the program's size.
+ */
+const unsigned *brw_wm_fs_emit(struct brw_context *brw,
+ struct brw_wm_compile *c,
+ struct gl_fragment_program *fp,
+ struct gl_shader_program *prog,
+ unsigned *final_assembly_size);
GLboolean brw_link_shader(struct gl_context *ctx, struct gl_shader_program *prog);
struct gl_shader *brw_new_shader(struct gl_context *ctx, GLuint name, GLuint type);