From 65f2014740eb26c1b740dab435b9964e4bdb1164 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Wed, 28 Feb 2018 17:14:50 -0800 Subject: [PATCH] i965: Replace brw_setup_tex_for_precompile brw with devinfo Trying to make sure the setup of the default program key is not dependent on the GL state. Signed-off-by: Jordan Justen Reviewed-by: Timothy Arceri --- src/mesa/drivers/dri/i965/brw_cs.c | 2 +- src/mesa/drivers/dri/i965/brw_gs.c | 2 +- src/mesa/drivers/dri/i965/brw_program.c | 3 +-- src/mesa/drivers/dri/i965/brw_program.h | 2 +- src/mesa/drivers/dri/i965/brw_tcs.c | 2 +- src/mesa/drivers/dri/i965/brw_tes.c | 2 +- src/mesa/drivers/dri/i965/brw_vs.c | 2 +- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- 8 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_cs.c b/src/mesa/drivers/dri/i965/brw_cs.c index e3f8fc67a4b..9b1b0832b5a 100644 --- a/src/mesa/drivers/dri/i965/brw_cs.c +++ b/src/mesa/drivers/dri/i965/brw_cs.c @@ -196,7 +196,7 @@ brw_cs_precompile(struct gl_context *ctx, struct gl_program *prog) memset(&key, 0, sizeof(key)); key.program_string_id = bcp->id; - brw_setup_tex_for_precompile(brw, &key.tex, prog); + brw_setup_tex_for_precompile(&brw->screen->devinfo, &key.tex, prog); uint32_t old_prog_offset = brw->cs.base.prog_offset; struct brw_stage_prog_data *old_prog_data = brw->cs.base.prog_data; diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index f74ee178f25..f488fab009e 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -221,7 +221,7 @@ brw_gs_precompile(struct gl_context *ctx, struct gl_program *prog) memset(&key, 0, sizeof(key)); - brw_setup_tex_for_precompile(brw, &key.tex, prog); + brw_setup_tex_for_precompile(&brw->screen->devinfo, &key.tex, prog); key.program_string_id = bgp->id; success = brw_codegen_gs_prog(brw, bgp, &key); diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index 7f0b7133f54..4dd27d84676 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -739,11 +739,10 @@ brw_dump_arb_asm(const char *stage, struct gl_program *prog) } void -brw_setup_tex_for_precompile(struct brw_context *brw, +brw_setup_tex_for_precompile(const struct gen_device_info *devinfo, struct brw_sampler_prog_key_data *tex, struct gl_program *prog) { - const struct gen_device_info *devinfo = &brw->screen->devinfo; const bool has_shader_channel_select = devinfo->is_haswell || devinfo->gen >= 8; unsigned sampler_count = util_last_bit(prog->SamplersUsed); for (unsigned i = 0; i < sampler_count; i++) { diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h index 3cdb90264ad..c8656fcff1f 100644 --- a/src/mesa/drivers/dri/i965/brw_program.h +++ b/src/mesa/drivers/dri/i965/brw_program.h @@ -66,7 +66,7 @@ struct nir_shader *brw_create_nir(struct brw_context *brw, void brw_shader_gather_info(nir_shader *nir, struct gl_program *prog); -void brw_setup_tex_for_precompile(struct brw_context *brw, +void brw_setup_tex_for_precompile(const struct gen_device_info *devinfo, struct brw_sampler_prog_key_data *tex, struct gl_program *prog); diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c index 931ef64166c..70313fee8ac 100644 --- a/src/mesa/drivers/dri/i965/brw_tcs.c +++ b/src/mesa/drivers/dri/i965/brw_tcs.c @@ -374,7 +374,7 @@ brw_tcs_precompile(struct gl_context *ctx, memset(&key, 0, sizeof(key)); key.program_string_id = btcp->id; - brw_setup_tex_for_precompile(brw, &key.tex, prog); + brw_setup_tex_for_precompile(&brw->screen->devinfo, &key.tex, prog); /* Guess that the input and output patches have the same dimensionality. */ if (devinfo->gen < 8) diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c index 2f3697ce961..72b218ac14f 100644 --- a/src/mesa/drivers/dri/i965/brw_tes.c +++ b/src/mesa/drivers/dri/i965/brw_tes.c @@ -239,7 +239,7 @@ brw_tes_precompile(struct gl_context *ctx, key.patch_inputs_read |= tcp->nir->info.patch_outputs_written; } - brw_setup_tex_for_precompile(brw, &key.tex, prog); + brw_setup_tex_for_precompile(&brw->screen->devinfo, &key.tex, prog); success = brw_codegen_tes_prog(brw, btep, &key); diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 5154dee3ca3..f024c33c02d 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -369,7 +369,7 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_program *prog) memset(&key, 0, sizeof(key)); - brw_setup_tex_for_precompile(brw, &key.tex, prog); + brw_setup_tex_for_precompile(&brw->screen->devinfo, &key.tex, prog); key.program_string_id = bvp->id; key.clamp_vertex_color = (prog->info.outputs_written & diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index cc6eaae1a84..0fda9c5069d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -637,7 +637,7 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_program *prog) key.input_slots_valid = prog->info.inputs_read | VARYING_BIT_POS; } - brw_setup_tex_for_precompile(brw, &key.tex, prog); + brw_setup_tex_for_precompile(&brw->screen->devinfo, &key.tex, prog); key.nr_color_regions = _mesa_bitcount_64(outputs_written & ~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |