[Mesa-dev] [PATCH 21/40] i965/blorp: Reduce scope for generator and its inputs
Topi Pohjolainen
topi.pohjolainen at intel.com
Sat Apr 16 13:42:49 UTC 2016
Generator is only needed for getting the assembly.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
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(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 006075c..153e35c 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -540,9 +540,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;
@@ -646,17 +647,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 */
@@ -812,7 +809,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
@@ -2183,10 +2180,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 3a5297c..7ec0b2a 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 8ed6d6b..e2b99dd 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 */
--
2.5.5
More information about the mesa-dev
mailing list