<p dir="ltr">This looks better. Sorry I didn't catch the scalar vs problems before.<br>
R-B</p>
<div class="gmail_quote">On Aug 1, 2015 5:16 AM, "Eduardo Lima Mitev" <<a href="mailto:elima@igalia.com">elima@igalia.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The upcoming introduction of NIR->vec4 pass will require that some NIR lowering<br>
passes are enabled/disabled depending on the type of shader (scalar vs. vector).<br>
<br>
With this patch we pass a 'is_scalar' variable to the process of constructing the<br>
NIR, to let an external context decide how the shader should be handled.<br>
---<br>
src/mesa/drivers/dri/i965/brw_nir.c | 3 ++-<br>
src/mesa/drivers/dri/i965/brw_nir.h | 3 ++-<br>
src/mesa/drivers/dri/i965/brw_program.c | 5 +++--<br>
src/mesa/drivers/dri/i965/brw_shader.cpp | 6 ++++--<br>
src/mesa/drivers/dri/i965/brw_vec4.cpp | 2 +-<br>
5 files changed, 12 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c<br>
index 3e154c1..4aa893a 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_nir.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_nir.c<br>
@@ -61,7 +61,8 @@ nir_shader *<br>
brw_create_nir(struct brw_context *brw,<br>
const struct gl_shader_program *shader_prog,<br>
const struct gl_program *prog,<br>
- gl_shader_stage stage)<br>
+ gl_shader_stage stage,<br>
+ bool is_scalar)<br>
{<br>
struct gl_context *ctx = &brw->ctx;<br>
const nir_shader_compiler_options *options =<br>
diff --git a/src/mesa/drivers/dri/i965/brw_nir.h b/src/mesa/drivers/dri/i965/brw_nir.h<br>
index 3131109..c76defd 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_nir.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_nir.h<br>
@@ -77,7 +77,8 @@ void brw_nir_analyze_boolean_resolves(nir_shader *nir);<br>
nir_shader *brw_create_nir(struct brw_context *brw,<br>
const struct gl_shader_program *shader_prog,<br>
const struct gl_program *prog,<br>
- gl_shader_stage stage);<br>
+ gl_shader_stage stage,<br>
+ bool is_scalar);<br>
<br>
#ifdef __cplusplus<br>
}<br>
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c<br>
index 85e271d..467a893 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_program.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_program.c<br>
@@ -143,7 +143,7 @@ brwProgramStringNotify(struct gl_context *ctx,<br>
brw_add_texrect_params(prog);<br>
<br>
if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_FRAGMENT].NirOptions) {<br>
- prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_FRAGMENT);<br>
+ prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_FRAGMENT, true);<br>
}<br>
<br>
brw_fs_precompile(ctx, NULL, prog);<br>
@@ -169,7 +169,8 @@ brwProgramStringNotify(struct gl_context *ctx,<br>
brw_add_texrect_params(prog);<br>
<br>
if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].NirOptions) {<br>
- prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_VERTEX);<br>
+ prog->nir = brw_create_nir(brw, NULL, prog, MESA_SHADER_VERTEX,<br>
+ brw->intelScreen->compiler->scalar_vs);<br>
}<br>
<br>
brw_vs_precompile(ctx, NULL, prog);<br>
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
index 524798c..7c5095d 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
@@ -398,8 +398,10 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)<br>
<br>
brw_add_texrect_params(prog);<br>
<br>
- if (options->NirOptions)<br>
- prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage);<br>
+ if (options->NirOptions) {<br>
+ prog->nir = brw_create_nir(brw, shProg, prog, (gl_shader_stage) stage,<br>
+ is_scalar_shader_stage(brw, stage));<br>
+ }<br>
<br>
_mesa_reference_program(ctx, &prog, NULL);<br>
}<br>
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
index ce04f1b..4e55185 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
@@ -1919,7 +1919,7 @@ brw_vs_emit(struct brw_context *brw,<br>
*/<br>
assert(vp->Base.Id == 0 && prog == NULL);<br>
vp->Base.nir =<br>
- brw_create_nir(brw, NULL, &vp->Base, MESA_SHADER_VERTEX);<br>
+ brw_create_nir(brw, NULL, &vp->Base, MESA_SHADER_VERTEX, true);<br>
}<br>
<br>
prog_data->base.dispatch_mode = DISPATCH_MODE_SIMD8;<br>
--<br>
2.4.6<br>
<br>
</blockquote></div>