[Mesa-dev] [PATCH 15/17] i965/fs: Rip struct brw_wm_compile out of the visitors and generators.
Kenneth Graunke
kenneth at whitecape.org
Thu May 15 23:19:46 PDT 2014
Instead, just pass the key and prog_data as separate parameters.
This moves it up a level - one step further toward getting rid of it.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp | 7 +++++--
src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h | 1 -
src/mesa/drivers/dri/i965/brw_fs.cpp | 13 +++++++------
src/mesa/drivers/dri/i965/brw_fs.h | 12 ++++++------
src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 7 ++++---
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 9 ++++-----
src/mesa/drivers/dri/i965/brw_wm.c | 3 ++-
src/mesa/drivers/dri/i965/brw_wm.h | 3 ++-
src/mesa/drivers/dri/i965/gen8_fs_generator.cpp | 6 +++---
9 files changed, 33 insertions(+), 28 deletions(-)
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 71e0ad3..3549173 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
@@ -26,8 +26,11 @@
#include "brw_blorp.h"
brw_blorp_eu_emitter::brw_blorp_eu_emitter(struct brw_context *brw)
- : mem_ctx(ralloc_context(NULL)), c(rzalloc(mem_ctx, struct brw_wm_compile)),
- generator(brw, mem_ctx, c, NULL, NULL, false)
+ : mem_ctx(ralloc_context(NULL)),
+ generator(brw, mem_ctx,
+ rzalloc(mem_ctx, struct brw_wm_prog_key),
+ rzalloc(mem_ctx, struct brw_wm_prog_data),
+ NULL, NULL, false)
{
}
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 c10695e..e68f925 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.h
@@ -182,7 +182,6 @@ private:
fs_inst *emit_cmp(int op, const struct brw_reg &x, const struct brw_reg &y);
void *mem_ctx;
- struct brw_wm_compile *c;
exec_list insts;
fs_generator generator;
};
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 579e492..606a160 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3105,7 +3105,8 @@ fs_visitor::run()
const unsigned *
brw_wm_fs_emit(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_fragment_program *fp,
struct gl_shader_program *prog,
unsigned *final_assembly_size)
@@ -3128,7 +3129,7 @@ brw_wm_fs_emit(struct brw_context *brw,
/* Now the main event: Visit the shader IR and generate our FS IR for it.
*/
- fs_visitor v(brw, mem_ctx, c, prog, fp, 8);
+ fs_visitor v(brw, mem_ctx, key, prog_data, prog, fp, 8);
if (!v.run()) {
if (prog) {
prog->LinkStatus = false;
@@ -3142,7 +3143,7 @@ brw_wm_fs_emit(struct brw_context *brw,
}
exec_list *simd16_instructions = NULL;
- fs_visitor v2(brw, mem_ctx, c, prog, fp, 16);
+ fs_visitor v2(brw, mem_ctx, key, prog_data, prog, fp, 16);
if (brw->gen >= 5 && likely(!(INTEL_DEBUG & DEBUG_NO16))) {
if (!v.simd16_unsupported) {
/* Try a SIMD16 compile */
@@ -3161,18 +3162,18 @@ brw_wm_fs_emit(struct brw_context *brw,
const unsigned *assembly = NULL;
if (brw->gen >= 8) {
- gen8_fs_generator g(brw, mem_ctx, c, prog, fp, v.do_dual_src);
+ gen8_fs_generator g(brw, mem_ctx, key, prog_data, prog, fp, v.do_dual_src);
assembly = g.generate_assembly(&v.instructions, simd16_instructions,
final_assembly_size);
} else {
- fs_generator g(brw, mem_ctx, c, prog, fp, v.do_dual_src);
+ fs_generator g(brw, mem_ctx, key, prog_data, prog, fp, v.do_dual_src);
assembly = g.generate_assembly(&v.instructions, simd16_instructions,
final_assembly_size);
}
if (unlikely(brw->perf_debug) && shader) {
if (shader->compiled_once)
- brw_wm_debug_recompile(brw, prog, &c->key);
+ brw_wm_debug_recompile(brw, prog, key);
shader->compiled_once = true;
if (start_busy && !drm_intel_bo_busy(brw->batch.last_bo)) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index d42b7b8..1c77a93 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -251,7 +251,8 @@ public:
fs_visitor(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
unsigned dispatch_width);
@@ -494,7 +495,6 @@ public:
void visit_atomic_counter_intrinsic(ir_call *ir);
struct gl_fragment_program *fp;
- struct brw_wm_compile *c;
const struct brw_wm_prog_key *const key;
struct brw_wm_prog_data *prog_data;
unsigned int sanity_param_count;
@@ -598,7 +598,8 @@ class fs_generator
public:
fs_generator(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_shader_program *prog,
struct gl_fragment_program *fp,
bool dual_source_output);
@@ -701,7 +702,6 @@ private:
struct gl_context *ctx;
struct brw_compile *p;
- struct brw_wm_compile *c;
const struct brw_wm_prog_key *const key;
struct brw_wm_prog_data *prog_data;
@@ -725,7 +725,8 @@ class gen8_fs_generator : public gen8_generator
public:
gen8_fs_generator(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_shader_program *prog,
struct gl_fragment_program *fp,
bool dual_source_output);
@@ -788,7 +789,6 @@ private:
void patch_discard_jumps_to_fb_writes();
- struct brw_wm_compile *c;
const struct brw_wm_prog_key *const key;
struct brw_wm_prog_data *prog_data;
const struct gl_fragment_program *fp;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index a337aef..c61cc5c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -38,15 +38,16 @@ extern "C" {
fs_generator::fs_generator(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_shader_program *prog,
struct gl_fragment_program *fp,
bool dual_source_output)
- : brw(brw), c(c), key(&c->key), prog(prog), fp(fp), dual_source_output(dual_source_output), mem_ctx(mem_ctx)
+ : brw(brw), key(key), prog_data(prog_data), prog(prog), fp(fp),
+ dual_source_output(dual_source_output), mem_ctx(mem_ctx)
{
ctx = &brw->ctx;
- prog_data = &c->prog_data;
p = rzalloc(mem_ctx, struct brw_compile);
brw_init_compile(brw, p, mem_ctx);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 4be5928..dcc8441 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2955,17 +2955,16 @@ fs_visitor::resolve_bool_comparison(ir_rvalue *rvalue, fs_reg *reg)
fs_visitor::fs_visitor(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
unsigned dispatch_width)
- : backend_visitor(brw, shader_prog, &fp->Base, &c->prog_data.base,
+ : backend_visitor(brw, shader_prog, &fp->Base, &prog_data->base,
MESA_SHADER_FRAGMENT),
- key(&c->key),
+ key(key), prog_data(prog_data),
dispatch_width(dispatch_width)
{
- this->c = c;
- this->prog_data = &c->prog_data;
this->fp = fp;
this->mem_ctx = mem_ctx;
this->failed = false;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 780c78f..1664b18 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -181,7 +181,8 @@ bool do_wm_prog(struct brw_context *brw,
c->key.persample_shading,
&fp->program);
- program = brw_wm_fs_emit(brw, mem_ctx, c, &fp->program, prog, &program_size);
+ program = brw_wm_fs_emit(brw, mem_ctx, &c->key, &c->prog_data,
+ &fp->program, prog, &program_size);
if (program == NULL) {
ralloc_free(mem_ctx);
return false;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index dd57a97..45c8f68 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -92,7 +92,8 @@ struct brw_wm_compile {
*/
const unsigned *brw_wm_fs_emit(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_fragment_program *fp,
struct gl_shader_program *prog,
unsigned *final_assembly_size);
diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
index 9a09888..294ce46 100644
--- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
@@ -37,15 +37,15 @@ extern "C" {
gen8_fs_generator::gen8_fs_generator(struct brw_context *brw,
void *mem_ctx,
- struct brw_wm_compile *c,
+ const struct brw_wm_prog_key *key,
+ struct brw_wm_prog_data *prog_data,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
bool dual_source_output)
: gen8_generator(brw, shader_prog, fp ? &fp->Base : NULL, mem_ctx),
- c(c), key(&c->key),
+ key(key), prog_data(prog_data),
fp(fp), dual_source_output(dual_source_output)
{
- prog_data = &c->prog_data;
}
gen8_fs_generator::~gen8_fs_generator()
--
1.9.2
More information about the mesa-dev
mailing list