extern "C" {
-bool
+/**
+ * Compile a vertex shader.
+ *
+ * Returns the final assembly and the program's size.
+ */
+const unsigned *
brw_vs_emit(struct brw_context *brw,
struct gl_shader_program *prog,
struct brw_vs_compile *c,
- void *mem_ctx)
+ void *mem_ctx,
+ unsigned *final_assembly_size)
{
struct intel_context *intel = &brw->intel;
bool start_busy = false;
float start_time = 0;
+ brw_init_compile(brw, &c->func, mem_ctx);
+
if (unlikely(INTEL_DEBUG & DEBUG_PERF)) {
start_busy = (intel->batch.last_bo &&
drm_intel_bo_busy(intel->batch.last_bo));
if (!v.run()) {
prog->LinkStatus = false;
ralloc_strcat(&prog->InfoLog, v.fail_msg);
- return false;
+ return NULL;
}
- return true;
+ return brw_get_program(&c->func, final_assembly_size);
}
} /* extern "C" */
mem_ctx = ralloc_context(NULL);
- brw_init_compile(brw, &c.func, mem_ctx);
c.vp = vp;
/* Allocate the references to the uniforms that will end up in the
/* Emit GEN4 code.
*/
- if (!brw_vs_emit(brw, prog, &c, mem_ctx)) {
+ program = brw_vs_emit(brw, prog, &c, mem_ctx, &program_size);
+ if (program == NULL) {
ralloc_free(mem_ctx);
return false;
}
c.prog_data.total_scratch * brw->max_vs_threads);
}
- /* get the program
- */
- program = brw_get_program(&c.func, &program_size);
-
brw_upload_cache(&brw->cache, BRW_VS_PROG,
&c.key, sizeof(c.key),
program, program_size,
GLuint last_scratch; /**< measured in 32-byte (register size) units */
};
-bool brw_vs_emit(struct brw_context *brw,
- struct gl_shader_program *prog,
- struct brw_vs_compile *c,
- void *mem_ctx);
+const unsigned *brw_vs_emit(struct brw_context *brw,
+ struct gl_shader_program *prog,
+ struct brw_vs_compile *c,
+ void *mem_ctx,
+ unsigned *program_size);
bool brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog);
void brw_vs_debug_recompile(struct brw_context *brw,
struct gl_shader_program *prog,