<div dir="ltr"><div>Can we get rid of is_scalar while we're at it? It should be equivalent to compiler->scalar_stage[nir->stage]. Feel free to make that a follow-on. Either way,<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 21, 2016 at 6:26 PM, Timothy Arceri <span dir="ltr"><<a href="mailto:timothy.arceri@collabora.com" target="_blank">timothy.arceri@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Later we will pass compiler to nir_optimise to be used by the loop unroll<br>
pass.<br>
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>fs.cpp | 10 ++++------<br>
src/mesa/drivers/dri/i965/brw_<wbr>nir.c | 7 ++++---<br>
src/mesa/drivers/dri/i965/brw_<wbr>nir.h | 4 ++--<br>
src/mesa/drivers/dri/i965/brw_<wbr>shader.cpp | 4 ++--<br>
src/mesa/drivers/dri/i965/brw_<wbr>vec4.cpp | 5 ++---<br>
src/mesa/drivers/dri/i965/brw_<wbr>vec4_gs_visitor.cpp | 5 ++---<br>
src/mesa/drivers/dri/i965/brw_<wbr>vec4_tcs.cpp | 4 ++--<br>
7 files changed, 18 insertions(+), 21 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp<br>
index 671b44b..c8a0693 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_fs.cpp<br>
@@ -6396,14 +6396,13 @@ brw_compile_fs(const struct brw_compiler *compiler, void *log_data,<br>
char **error_str)<br>
{<br>
nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);<br>
- shader = brw_nir_apply_sampler_key(<wbr>shader, compiler->devinfo, &key->tex,<br>
- true);<br>
+ shader = brw_nir_apply_sampler_key(<wbr>shader, compiler, &key->tex, true);<br>
brw_nir_lower_fs_inputs(<wbr>shader, vue_map, prog, compiler->devinfo, key);<br>
brw_nir_lower_fs_outputs(<wbr>shader);<br>
if (!key->multisample_fbo)<br>
NIR_PASS_V(shader, demote_sample_qualifiers);<br>
NIR_PASS_V(shader, move_interpolation_to_top);<br>
- shader = brw_postprocess_nir(shader, compiler->devinfo, true);<br>
+ shader = brw_postprocess_nir(shader, compiler, true);<br>
<br>
/* key->alpha_test_func means simulating alpha testing via discards,<br>
* so the shader definitely kills pixels.<br>
@@ -6628,8 +6627,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
char **error_str)<br>
{<br>
nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);<br>
- shader = brw_nir_apply_sampler_key(<wbr>shader, compiler->devinfo, &key->tex,<br>
- true);<br>
+ shader = brw_nir_apply_sampler_key(<wbr>shader, compiler, &key->tex, true);<br>
brw_nir_lower_cs_shared(<wbr>shader);<br>
prog_data->base.total_shared += shader->num_shared;<br>
<br>
@@ -6642,7 +6640,7 @@ brw_compile_cs(const struct brw_compiler *compiler, void *log_data,<br>
(unsigned)4 * (prog_data->thread_local_id_<wbr>index + 1));<br>
<br>
brw_nir_lower_intrinsics(<wbr>shader, &prog_data->base);<br>
- shader = brw_postprocess_nir(shader, compiler->devinfo, true);<br>
+ shader = brw_postprocess_nir(shader, compiler, true);<br>
<br>
prog_data->local_size[0] = shader->info->cs.local_size[0]<wbr>;<br>
prog_data->local_size[1] = shader->info->cs.local_size[1]<wbr>;<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_nir.c b/src/mesa/drivers/dri/i965/<wbr>brw_nir.c<br>
index 7624126..b44cbe8 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_nir.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_nir.c<br>
@@ -514,10 +514,10 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)<br>
* will not work.<br>
*/<br>
nir_shader *<br>
-brw_postprocess_nir(nir_<wbr>shader *nir,<br>
- const struct gen_device_info *devinfo,<br>
+brw_postprocess_nir(nir_<wbr>shader *nir, const struct brw_compiler *compiler,<br>
bool is_scalar)<br>
{<br>
+ const struct gen_device_info *devinfo = compiler->devinfo;<br>
bool debug_enabled =<br>
(INTEL_DEBUG & intel_debug_flag_for_shader_<wbr>stage(nir->stage));<br>
<br>
@@ -579,10 +579,11 @@ brw_postprocess_nir(nir_shader *nir,<br>
<br>
nir_shader *<br>
brw_nir_apply_sampler_key(nir_<wbr>shader *nir,<br>
- const struct gen_device_info *devinfo,<br>
+ const struct brw_compiler *compiler,<br>
const struct brw_sampler_prog_key_data *key_tex,<br>
bool is_scalar)<br>
{<br>
+ const struct gen_device_info *devinfo = compiler->devinfo;<br>
nir_lower_tex_options tex_options = { 0 };<br>
<br>
/* Iron Lake and prior require lowering of all rectangle textures */<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_nir.h b/src/mesa/drivers/dri/i965/<wbr>brw_nir.h<br>
index 3c774d0..8cfb6c1 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_nir.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_nir.h<br>
@@ -114,7 +114,7 @@ void brw_nir_lower_fs_outputs(nir_<wbr>shader *nir);<br>
void brw_nir_lower_cs_shared(nir_<wbr>shader *nir);<br>
<br>
nir_shader *brw_postprocess_nir(nir_<wbr>shader *nir,<br>
- const struct gen_device_info *devinfo,<br>
+ const struct brw_compiler *compiler,<br>
bool is_scalar);<br>
<br>
bool brw_nir_apply_attribute_<wbr>workarounds(nir_shader *nir,<br>
@@ -126,7 +126,7 @@ bool brw_nir_apply_trig_<wbr>workarounds(nir_shader *nir);<br>
void brw_nir_apply_tcs_quads_<wbr>workaround(nir_shader *nir);<br>
<br>
nir_shader *brw_nir_apply_sampler_key(<wbr>nir_shader *nir,<br>
- const struct gen_device_info *devinfo,<br>
+ const struct brw_compiler *compiler,<br>
const struct brw_sampler_prog_key_data *key,<br>
bool is_scalar);<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_shader.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_shader.cpp<br>
index afab4aa..9487a3e 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_shader.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_shader.cpp<br>
@@ -1361,10 +1361,10 @@ brw_compile_tes(const struct brw_compiler *compiler,<br>
brw_compute_tess_vue_map(&<wbr>input_vue_map, nir->info->inputs_read,<br>
nir->info->patch_inputs_read);<br>
<br>
- nir = brw_nir_apply_sampler_key(nir, devinfo, &key->tex, is_scalar);<br>
+ nir = brw_nir_apply_sampler_key(nir, compiler, &key->tex, is_scalar);<br>
brw_nir_lower_tes_inputs(nir, &input_vue_map);<br>
brw_nir_lower_vue_outputs(nir, is_scalar);<br>
- nir = brw_postprocess_nir(nir, compiler->devinfo, is_scalar);<br>
+ nir = brw_postprocess_nir(nir, compiler, is_scalar);<br>
<br>
brw_compute_vue_map(devinfo, &prog_data->base.vue_map,<br>
nir->info->outputs_written,<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_vec4.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_vec4.cpp<br>
index b9e592f..d42bcd9 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_vec4.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_vec4.cpp<br>
@@ -2112,12 +2112,11 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,<br>
{<br>
const bool is_scalar = compiler->scalar_stage[MESA_<wbr>SHADER_VERTEX];<br>
nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);<br>
- shader = brw_nir_apply_sampler_key(<wbr>shader, compiler->devinfo, &key->tex,<br>
- is_scalar);<br>
+ shader = brw_nir_apply_sampler_key(<wbr>shader, compiler, &key->tex, is_scalar);<br>
brw_nir_lower_vs_inputs(<wbr>shader, is_scalar,<br>
use_legacy_snorm_formula, key->gl_attrib_wa_flags);<br>
brw_nir_lower_vue_outputs(<wbr>shader, is_scalar);<br>
- shader = brw_postprocess_nir(shader, compiler->devinfo, is_scalar);<br>
+ shader = brw_postprocess_nir(shader, compiler, is_scalar);<br>
<br>
const unsigned *assembly = NULL;<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_vec4_gs_visitor.cpp<br>
index 3894a63..5f49db1 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_vec4_gs_visitor.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_vec4_gs_visitor.cpp<br>
@@ -615,11 +615,10 @@ brw_compile_gs(const struct brw_compiler *compiler, void *log_data,<br>
&c.input_vue_map, inputs_read,<br>
shader->info->separate_shader)<wbr>;<br>
<br>
- shader = brw_nir_apply_sampler_key(<wbr>shader, compiler->devinfo, &key->tex,<br>
- is_scalar);<br>
+ shader = brw_nir_apply_sampler_key(<wbr>shader, compiler, &key->tex, is_scalar);<br>
brw_nir_lower_vue_inputs(<wbr>shader, is_scalar, &c.input_vue_map);<br>
brw_nir_lower_vue_outputs(<wbr>shader, is_scalar);<br>
- shader = brw_postprocess_nir(shader, compiler->devinfo, is_scalar);<br>
+ shader = brw_postprocess_nir(shader, compiler, is_scalar);<br>
<br>
prog_data->base.clip_distance_<wbr>mask =<br>
((1 << shader->info->clip_distance_<wbr>array_size) - 1);<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp<br>
index b6ff4fd..92c5d9c 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp<br>
@@ -467,13 +467,13 @@ brw_compile_tcs(const struct brw_compiler *compiler,<br>
nir->info->outputs_written,<br>
nir->info->patch_outputs_<wbr>written);<br>
<br>
- nir = brw_nir_apply_sampler_key(nir, devinfo, &key->tex, is_scalar);<br>
+ nir = brw_nir_apply_sampler_key(nir, compiler, &key->tex, is_scalar);<br>
brw_nir_lower_vue_inputs(nir, is_scalar, &input_vue_map);<br>
brw_nir_lower_tcs_outputs(nir, &vue_prog_data->vue_map);<br>
if (key->quads_workaround)<br>
brw_nir_apply_tcs_quads_<wbr>workaround(nir);<br>
<br>
- nir = brw_postprocess_nir(nir, compiler->devinfo, is_scalar);<br>
+ nir = brw_postprocess_nir(nir, compiler, is_scalar);<br>
<br>
if (is_scalar)<br>
prog_data->instances = DIV_ROUND_UP(nir->info->tcs.<wbr>vertices_out, 8);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>