From 0d062d79c39a6e9556411f58a7ea4126811f9ae4 Mon Sep 17 00:00:00 2001 From: Topi Pohjolainen Date: Tue, 5 Apr 2016 10:36:11 +0300 Subject: i965/blorp: Reduce scope for generator and its inputs Generator is only needed for getting the assembly. Signed-off-by: Topi Pohjolainen Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 23 ++++++++++------------- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp | 22 ++++++++++++---------- src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h | 6 +++--- 3 files changed, 25 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp index 91a0553f03f..722eb3d90df 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp @@ -545,9 +545,10 @@ class brw_blorp_blit_program : public brw_blorp_eu_emitter { public: brw_blorp_blit_program(struct brw_context *brw, - const brw_blorp_blit_prog_key *key, bool debug_flag); + const brw_blorp_blit_prog_key *key); - const GLuint *compile(struct brw_context *brw, GLuint *program_size); + const GLuint *compile(struct brw_context *brw, bool debug_flag, + GLuint *program_size); brw_blorp_prog_data prog_data; @@ -651,17 +652,13 @@ private: }; brw_blorp_blit_program::brw_blorp_blit_program( - struct brw_context *brw, - const brw_blorp_blit_prog_key *key, - bool debug_flag) - : brw_blorp_eu_emitter(brw, debug_flag), - brw(brw), - key(key) + struct brw_context *brw, const brw_blorp_blit_prog_key *key) + : brw_blorp_eu_emitter(), brw(brw), key(key) { } const GLuint * -brw_blorp_blit_program::compile(struct brw_context *brw, +brw_blorp_blit_program::compile(struct brw_context *brw, bool debug_flag, GLuint *program_size) { /* Sanity checks */ @@ -817,7 +814,7 @@ brw_blorp_blit_program::compile(struct brw_context *brw, */ render_target_write(); - return get_program(program_size); + return get_program(brw, debug_flag, program_size); } void @@ -2188,10 +2185,10 @@ brw_blorp_blit_params::get_wm_prog(struct brw_context *brw, if (!brw_search_cache(&brw->cache, BRW_CACHE_BLORP_BLIT_PROG, &this->wm_prog_key, sizeof(this->wm_prog_key), &prog_offset, prog_data)) { - brw_blorp_blit_program prog(brw, &this->wm_prog_key, - INTEL_DEBUG & DEBUG_BLORP); + brw_blorp_blit_program prog(brw, &this->wm_prog_key); GLuint program_size; - const GLuint *program = prog.compile(brw, &program_size); + const GLuint *program = prog.compile(brw, INTEL_DEBUG & DEBUG_BLORP, + &program_size); brw_upload_cache(&brw->cache, BRW_CACHE_BLORP_BLIT_PROG, &this->wm_prog_key, sizeof(this->wm_prog_key), program, program_size, diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp index 3a5297c187e..7ec0b2a2f53 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp @@ -26,16 +26,9 @@ #include "brw_blorp.h" #include "brw_cfg.h" -brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw, - bool debug_flag) - : mem_ctx(ralloc_context(NULL)), - generator(brw->intelScreen->compiler, brw, - mem_ctx, (void *) rzalloc(mem_ctx, struct brw_wm_prog_key), - (struct brw_stage_prog_data *) rzalloc(mem_ctx, struct brw_wm_prog_data), - 0, false, MESA_SHADER_FRAGMENT) +brw_blorp_eu_emitter::brw_blorp_eu_emitter() + : mem_ctx(ralloc_context(NULL)) { - if (debug_flag) - generator.enable_debug("blorp"); } brw_blorp_eu_emitter::~brw_blorp_eu_emitter() @@ -44,9 +37,18 @@ brw_blorp_eu_emitter::~brw_blorp_eu_emitter() } const unsigned * -brw_blorp_eu_emitter::get_program(unsigned *program_size) +brw_blorp_eu_emitter::get_program(struct brw_context *brw, bool debug_flag, + unsigned *program_size) { cfg_t cfg(&insts); + brw_stage_prog_data prog_data = { 0 }; + brw_wm_prog_key prog_key = { 0 }; + fs_generator generator(brw->intelScreen->compiler, brw, mem_ctx, &prog_key, + &prog_data, 0, false, MESA_SHADER_FRAGMENT); + + if (debug_flag) + generator.enable_debug("blorp"); + generator.generate_code(&cfg, 16); return generator.get_assembly(program_size); diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h index 8ed6d6b38a5..e2b99ddc821 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h +++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h @@ -29,10 +29,11 @@ class brw_blorp_eu_emitter { protected: - explicit brw_blorp_eu_emitter(struct brw_context *brw, bool debug_flag); + brw_blorp_eu_emitter(); ~brw_blorp_eu_emitter(); - const unsigned *get_program(unsigned *program_size); + const unsigned *get_program(struct brw_context *brw, bool debug_flag, + unsigned *program_size); void emit_kill_if_outside_rect(const struct brw_reg &x, const struct brw_reg &y, @@ -206,7 +207,6 @@ private: void *mem_ctx; exec_list insts; - fs_generator generator; }; #endif /* BRW_BLORP_BLIT_EU_H */ -- cgit v1.2.3