diff options
author | Jason Ekstrand <[email protected]> | 2017-09-28 21:45:41 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-10-12 22:39:31 -0700 |
commit | 29737eac985cf028b19d977cb8fa0d7320cf91cf (patch) | |
tree | 5d20822db9d678ae549c0c57b540ddec6d9fbcd9 /src/mesa/drivers/dri/i965/brw_wm.c | |
parent | c3d54d03757fcb656cc4839a2c7978d97f75508d (diff) |
intel: Allocate prog_data::[pull_]param deeper inside the compiler
Now that we're always growing the param array as-needed, we can
allocate the param array in common code and stop repeating the
allocation everywere. In order to keep things sane, we ralloc the
[pull_]param array off of the compile context and then steal it back
to a NULL context later. This doesn't get us all the way to where
prog_data::[pull_]param is purely an out parameter of the back-end
compiler but it gets us a lot closer.
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 1b5774e4e8a..69d8e61e402 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -144,22 +144,13 @@ brw_codegen_wm_prog(struct brw_context *brw, assign_fs_binding_table_offsets(devinfo, &fp->program, key, &prog_data); - /* Allocate the references to the uniforms that will end up in the - * prog_data associated with the compiled program, and which will be freed - * by the state cache. - */ - int param_count = fp->program.nir->num_uniforms / 4; - prog_data.base.param = rzalloc_array(NULL, uint32_t, param_count); - prog_data.base.pull_param = rzalloc_array(NULL, uint32_t, param_count); - prog_data.base.nr_params = param_count; - if (!fp->program.is_arb_asm) { - brw_nir_setup_glsl_uniforms(fp->program.nir, &fp->program, + brw_nir_setup_glsl_uniforms(mem_ctx, fp->program.nir, &fp->program, &prog_data.base, true); brw_nir_analyze_ubo_ranges(brw->screen->compiler, fp->program.nir, prog_data.base.ubo_ranges); } else { - brw_nir_setup_arb_uniforms(fp->program.nir, &fp->program, + brw_nir_setup_arb_uniforms(mem_ctx, fp->program.nir, &fp->program, &prog_data.base); if (unlikely(INTEL_DEBUG & DEBUG_WM)) @@ -217,6 +208,9 @@ brw_codegen_wm_prog(struct brw_context *brw, if (unlikely((INTEL_DEBUG & DEBUG_WM) && fp->program.is_arb_asm)) fprintf(stderr, "\n"); + /* The param and pull_param arrays will be freed by the shader cache. */ + ralloc_steal(NULL, prog_data.base.param); + ralloc_steal(NULL, prog_data.base.pull_param); brw_upload_cache(&brw->cache, BRW_CACHE_FS_PROG, key, sizeof(struct brw_wm_prog_key), program, program_size, |