diff options
author | Kenneth Graunke <[email protected]> | 2012-11-26 23:59:32 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2012-11-28 18:15:55 -0800 |
commit | 8af8a26480e9e71fb1501b675f21a469c1699b9b (patch) | |
tree | cd2d6267a8a80b22c7c069a373ae4dca2004d517 /src | |
parent | 746fc346eae21d227b06799f3e82a1404c75bdc9 (diff) |
i965/vs: Move uses of brw_compile from do_vs_prog to brw_vs_emit.
The brw_compile structure is closely tied to the Gen4-7 hardware
encoding. However, do_vs_prog is very generic: it just calls out to
get a compiled program and then uploads it.
This isn't ultimately where we want it, but it's a step in the right
direction: it's now closer to the code generator.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4.cpp | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.h | 9 |
3 files changed, 19 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 7e6e79e5e7e..d5f1abe3270 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1127,16 +1127,24 @@ vec4_visitor::run() 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)); @@ -1174,10 +1182,10 @@ brw_vs_emit(struct brw_context *brw, 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" */ diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index b1b7a4f35a5..fc57f8a6727 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -227,7 +227,6 @@ do_vs_prog(struct brw_context *brw, 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 @@ -279,7 +278,8 @@ do_vs_prog(struct brw_context *brw, /* 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; } @@ -306,10 +306,6 @@ do_vs_prog(struct brw_context *brw, 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, diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index d0e260e4e81..7ac1775c83e 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -103,10 +103,11 @@ struct brw_vs_compile { 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, |