diff options
author | Kenneth Graunke <[email protected]> | 2018-11-08 22:10:03 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2018-11-20 15:53:46 -0800 |
commit | 562448b75a7ab9035954d539dc3002a02e6263f8 (patch) | |
tree | 120b315b41ba225c79404d773f2ef45d46f61578 /src/mesa/drivers/dri | |
parent | 6a10dd08f4311c9d46231269fb35f7cf8cb124c7 (diff) |
i965: Do NIR shader cloning in the caller.
This moves nir_shader_clone() to the driver-specific compile function,
rather than the shared src/intel/compiler code. This allows i965 to do
key-specific passes before calling brw_compile_*. Vulkan should not
need this cloning as it doesn't compile multiple variants.
We do need to continue cloning in the compute shader code because we
lower various things in NIR based on the SIMD width.
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_gs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tcs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_tes.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 2 |
6 files changed, 7 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index 3ae54830f78..4d968c26656 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -58,7 +58,7 @@ brw_codegen_cs_prog(struct brw_context *brw, struct brw_cs_prog_data prog_data; bool start_busy = false; double start_time = 0; - nir_shader *nir = cp->program.nir; + nir_shader *nir = nir_shader_clone(mem_ctx, cp->program.nir); memset(&prog_data, 0, sizeof(prog_data)); diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 55c2923bded..a35ce97db3e 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -89,7 +89,7 @@ brw_codegen_gs_prog(struct brw_context *brw, void *mem_ctx = ralloc_context(NULL); - nir_shader *nir = gp->program.nir; + nir_shader *nir = nir_shader_clone(mem_ctx, gp->program.nir); assign_gs_binding_table_offsets(devinfo, &gp->program, &prog_data); diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 6e60a44fc10..86c09b92168 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -84,7 +84,7 @@ brw_codegen_tcs_prog(struct brw_context *brw, struct brw_program *tcp, void *mem_ctx = ralloc_context(NULL); if (tcp) { - nir = tcp->program.nir; + nir = nir_shader_clone(mem_ctx, tcp->program.nir); } else { const nir_shader_compiler_options *options = ctx->Const.ShaderCompilerOptions[MESA_SHADER_TESS_CTRL].NirOptions; diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 8f8f68530b7..567fed6f808 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -70,7 +70,6 @@ brw_codegen_tes_prog(struct brw_context *brw, const struct brw_compiler *compiler = brw->screen->compiler; const struct gen_device_info *devinfo = &brw->screen->devinfo; struct brw_stage_state *stage_state = &brw->tes.base; - nir_shader *nir = tep->program.nir; struct brw_tes_prog_data prog_data; bool start_busy = false; double start_time = 0; @@ -79,6 +78,8 @@ brw_codegen_tes_prog(struct brw_context *brw, void *mem_ctx = ralloc_context(NULL); + nir_shader *nir = nir_shader_clone(mem_ctx, tep->program.nir); + brw_assign_common_binding_table_offsets(devinfo, &tep->program, &prog_data.base.base, 0); diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index d557e82f9fc..01ddf9a4851 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -174,7 +174,7 @@ brw_codegen_vs_prog(struct brw_context *brw, mem_ctx = ralloc_context(NULL); - nir_shader *nir = vp->program.nir; + nir_shader *nir = nir_shader_clone(mem_ctx, vp->program.nir); brw_assign_common_binding_table_offsets(devinfo, &vp->program, &prog_data.base.base, 0); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 8ca6b9a84e9..536e47638e6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -139,7 +139,7 @@ brw_codegen_wm_prog(struct brw_context *brw, bool start_busy = false; double start_time = 0; - nir_shader *nir = fp->program.nir; + nir_shader *nir = nir_shader_clone(mem_ctx, fp->program.nir); memset(&prog_data, 0, sizeof(prog_data)); |