summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-05-14 01:21:02 -0700
committerKenneth Graunke <[email protected]>2014-05-18 23:35:20 -0700
commit2d4ac9b5b825b745257e935dd9b33a2d3507c72a (patch)
treeef86749c223d439b995859bc00efc3590405ca9d /src
parent25f8fbbf2fc74470f7edce7cae25453a3edbdfe0 (diff)
i965/fs: Plumb a mem_ctx all the way through the FS compile.
'c' is going away, but we still need a memory context that lives for the duration of the compile. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Chris Forbes <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp12
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_generator.cpp5
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h1
-rw-r--r--src/mesa/drivers/dri/i965/gen8_fs_generator.cpp3
8 files changed, 23 insertions, 15 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 38969d8a920..71e0ad33a04 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit_eu.cpp
@@ -27,7 +27,7 @@
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, c, NULL, NULL, false)
+ generator(brw, mem_ctx, c, NULL, NULL, false)
{
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 6fc92b46490..579e492d6d2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3103,7 +3103,9 @@ fs_visitor::run()
}
const unsigned *
-brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
+brw_wm_fs_emit(struct brw_context *brw,
+ void *mem_ctx,
+ struct brw_wm_compile *c,
struct gl_fragment_program *fp,
struct gl_shader_program *prog,
unsigned *final_assembly_size)
@@ -3126,7 +3128,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
/* Now the main event: Visit the shader IR and generate our FS IR for it.
*/
- fs_visitor v(brw, c, prog, fp, 8);
+ fs_visitor v(brw, mem_ctx, c, prog, fp, 8);
if (!v.run()) {
if (prog) {
prog->LinkStatus = false;
@@ -3140,7 +3142,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
}
exec_list *simd16_instructions = NULL;
- fs_visitor v2(brw, c, prog, fp, 16);
+ fs_visitor v2(brw, mem_ctx, c, prog, fp, 16);
if (brw->gen >= 5 && likely(!(INTEL_DEBUG & DEBUG_NO16))) {
if (!v.simd16_unsupported) {
/* Try a SIMD16 compile */
@@ -3159,11 +3161,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c,
const unsigned *assembly = NULL;
if (brw->gen >= 8) {
- gen8_fs_generator g(brw, c, prog, fp, v.do_dual_src);
+ gen8_fs_generator g(brw, mem_ctx, c, prog, fp, v.do_dual_src);
assembly = g.generate_assembly(&v.instructions, simd16_instructions,
final_assembly_size);
} else {
- fs_generator g(brw, c, prog, fp, v.do_dual_src);
+ fs_generator g(brw, mem_ctx, c, prog, fp, v.do_dual_src);
assembly = g.generate_assembly(&v.instructions, simd16_instructions,
final_assembly_size);
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 6611c389615..d42b7b87a47 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -250,6 +250,7 @@ class fs_visitor : public backend_visitor
public:
fs_visitor(struct brw_context *brw,
+ void *mem_ctx,
struct brw_wm_compile *c,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
@@ -596,6 +597,7 @@ class fs_generator
{
public:
fs_generator(struct brw_context *brw,
+ void *mem_ctx,
struct brw_wm_compile *c,
struct gl_shader_program *prog,
struct gl_fragment_program *fp,
@@ -722,6 +724,7 @@ class gen8_fs_generator : public gen8_generator
{
public:
gen8_fs_generator(struct brw_context *brw,
+ void *mem_ctx,
struct brw_wm_compile *c,
struct gl_shader_program *prog,
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 99207b3efe4..a337aef88b2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -37,18 +37,17 @@ extern "C" {
#include "brw_cfg.h"
fs_generator::fs_generator(struct brw_context *brw,
+ void *mem_ctx,
struct brw_wm_compile *c,
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)
+ : brw(brw), c(c), key(&c->key), prog(prog), fp(fp), dual_source_output(dual_source_output), mem_ctx(mem_ctx)
{
ctx = &brw->ctx;
prog_data = &c->prog_data;
- mem_ctx = c;
-
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 46527d912dd..4be59289136 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2954,6 +2954,7 @@ 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,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
@@ -2966,7 +2967,7 @@ fs_visitor::fs_visitor(struct brw_context *brw,
this->c = c;
this->prog_data = &c->prog_data;
this->fp = fp;
- this->mem_ctx = c;
+ this->mem_ctx = mem_ctx;
this->failed = false;
this->simd16_unsupported = false;
this->no16_msg = NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 059d848ff13..780c78f628a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -146,6 +146,7 @@ bool do_wm_prog(struct brw_context *brw,
struct brw_wm_prog_key *key)
{
struct gl_context *ctx = &brw->ctx;
+ void *mem_ctx = ralloc_context(NULL);
struct brw_wm_compile *c;
const GLuint *program;
struct gl_shader *fs = NULL;
@@ -154,7 +155,7 @@ bool do_wm_prog(struct brw_context *brw,
if (prog)
fs = prog->_LinkedShaders[MESA_SHADER_FRAGMENT];
- c = rzalloc(NULL, struct brw_wm_compile);
+ c = rzalloc(mem_ctx, struct brw_wm_compile);
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
@@ -180,9 +181,9 @@ bool do_wm_prog(struct brw_context *brw,
c->key.persample_shading,
&fp->program);
- program = brw_wm_fs_emit(brw, c, &fp->program, prog, &program_size);
+ program = brw_wm_fs_emit(brw, mem_ctx, c, &fp->program, prog, &program_size);
if (program == NULL) {
- ralloc_free(c);
+ ralloc_free(mem_ctx);
return false;
}
@@ -200,7 +201,7 @@ bool do_wm_prog(struct brw_context *brw,
&c->prog_data, sizeof(c->prog_data),
&brw->wm.base.prog_offset, &brw->wm.prog_data);
- ralloc_free(c);
+ ralloc_free(mem_ctx);
return true;
}
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index 5721d6fed76..dd57a97cfb6 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -91,6 +91,7 @@ struct brw_wm_compile {
* Returns the final assembly and the program's size.
*/
const unsigned *brw_wm_fs_emit(struct brw_context *brw,
+ void *mem_ctx,
struct brw_wm_compile *c,
struct gl_fragment_program *fp,
struct gl_shader_program *prog,
diff --git a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
index 63481b31502..9a09888012c 100644
--- a/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/gen8_fs_generator.cpp
@@ -36,11 +36,12 @@ extern "C" {
#include "glsl/ir_print_visitor.h"
gen8_fs_generator::gen8_fs_generator(struct brw_context *brw,
+ void *mem_ctx,
struct brw_wm_compile *c,
struct gl_shader_program *shader_prog,
struct gl_fragment_program *fp,
bool dual_source_output)
- : gen8_generator(brw, shader_prog, fp ? &fp->Base : NULL, c),
+ : gen8_generator(brw, shader_prog, fp ? &fp->Base : NULL, mem_ctx),
c(c), key(&c->key),
fp(fp), dual_source_output(dual_source_output)
{