aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_vs.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-28 21:45:41 -0700
committerJason Ekstrand <[email protected]>2017-10-12 22:39:31 -0700
commit29737eac985cf028b19d977cb8fa0d7320cf91cf (patch)
tree5d20822db9d678ae549c0c57b540ddec6d9fbcd9 /src/mesa/drivers/dri/i965/brw_vs.c
parentc3d54d03757fcb656cc4839a2c7978d97f75508d (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_vs.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index c3440fde58d..fb5ea4e7ed1 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -178,24 +178,14 @@ brw_codegen_vs_prog(struct brw_context *brw,
brw_assign_common_binding_table_offsets(devinfo, &vp->program,
&prog_data.base.base, 0);
- /* 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 = vp->program.nir->num_uniforms / 4;
-
- stage_prog_data->param = rzalloc_array(NULL, uint32_t, param_count);
- stage_prog_data->pull_param = rzalloc_array(NULL, uint32_t, param_count);
- stage_prog_data->nr_params = param_count;
-
if (!vp->program.is_arb_asm) {
- brw_nir_setup_glsl_uniforms(vp->program.nir, &vp->program,
+ brw_nir_setup_glsl_uniforms(mem_ctx, vp->program.nir, &vp->program,
&prog_data.base.base,
compiler->scalar_stage[MESA_SHADER_VERTEX]);
brw_nir_analyze_ubo_ranges(compiler, vp->program.nir,
prog_data.base.base.ubo_ranges);
} else {
- brw_nir_setup_arb_uniforms(vp->program.nir, &vp->program,
+ brw_nir_setup_arb_uniforms(mem_ctx, vp->program.nir, &vp->program,
&prog_data.base.base);
}
@@ -262,6 +252,9 @@ brw_codegen_vs_prog(struct brw_context *brw,
prog_data.base.base.total_scratch,
devinfo->max_vs_threads);
+ /* The param and pull_param arrays will be freed by the shader cache. */
+ ralloc_steal(NULL, prog_data.base.base.param);
+ ralloc_steal(NULL, prog_data.base.base.pull_param);
brw_upload_cache(&brw->cache, BRW_CACHE_VS_PROG,
key, sizeof(struct brw_vs_prog_key),
program, program_size,