<p dir="ltr"><br>
On Jul 26, 2015 1:40 PM, "Eduardo Lima Mitev" <<a href="mailto:elima@igalia.com">elima@igalia.com</a>> wrote:<br>
><br>
> On 07/23/2015 11:25 PM, Jason Ekstrand wrote:<br>
> > On Thu, Jul 23, 2015 at 3:16 AM, Eduardo Lima Mitev <<a href="mailto:elima@igalia.com">elima@igalia.com</a>> wrote:<br>
> >> The NIR->vec4 pass will be activated if both the following conditions are met:<br>
> >><br>
> >> * INTEL_USE_NIR environment variable is defined and is positive (1 or true)<br>
> >> * The stage is vertex shader (support for geometry shaders and<br>
> >>   ARB_vertex_program will be added later).<br>
> >> ---<br>
> >>  src/mesa/drivers/dri/i965/brw_shader.cpp | 14 ++++++++------<br>
> >>  src/mesa/drivers/dri/i965/brw_vec4.cpp   | 18 ++++++++++++++----<br>
> >>  2 files changed, 22 insertions(+), 10 deletions(-)<br>
> >><br>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
> >> index 9d60543..cb04d8a 100644<br>
> >> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
> >> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
> >> @@ -122,12 +122,14 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo)<br>
> >>     compiler->glsl_compiler_options[MESA_SHADER_VERTEX].OptimizeForAOS = true;<br>
> >>     compiler->glsl_compiler_options[MESA_SHADER_GEOMETRY].OptimizeForAOS = true;<br>
> >><br>
> >> -   if (compiler->scalar_vs) {<br>
> >> -      /* If we're using the scalar backend for vertex shaders, we need to<br>
> >> -       * configure these accordingly.<br>
> >> -       */<br>
> >> -      compiler->glsl_compiler_options[MESA_SHADER_VERTEX].EmitNoIndirectOutput = true;<br>
> >> -      compiler->glsl_compiler_options[MESA_SHADER_VERTEX].EmitNoIndirectTemp = true;<br>
> >> +   if (compiler->scalar_vs || brw_env_var_as_boolean("INTEL_USE_NIR", false)) {<br>
> >> +      if (compiler->scalar_vs) {<br>
> >> +         /* If we're using the scalar backend for vertex shaders, we need to<br>
> >> +          * configure these accordingly.<br>
> >> +          */<br>
> >> +         compiler->glsl_compiler_options[MESA_SHADER_VERTEX].EmitNoIndirectOutput = true;<br>
> >> +         compiler->glsl_compiler_options[MESA_SHADER_VERTEX].EmitNoIndirectTemp = true;<br>
> >> +      }<br>
> >>        compiler->glsl_compiler_options[MESA_SHADER_VERTEX].OptimizeForAOS = false;<br>
> >><br>
> >>        compiler->glsl_compiler_options[MESA_SHADER_VERTEX].NirOptions = nir_options;<br>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
> >> index 53270fb..ce04f1b 100644<br>
> >> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
> >> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp<br>
> >> @@ -1709,6 +1709,9 @@ vec4_visitor::emit_shader_time_write(int shader_time_subindex, src_reg value)<br>
> >>  bool<br>
> >>  vec4_visitor::run(gl_clip_plane *clip_planes)<br>
> >>  {<br>
> >> +   bool use_vec4_nir =<br>
> >> +      compiler->glsl_compiler_options[MESA_SHADER_VERTEX].NirOptions != NULL;<br>
> >> +<br>
> >>     sanity_param_count = prog->Parameters->NumParameters;<br>
> >><br>
> >>     if (shader_time_index >= 0)<br>
> >> @@ -1718,11 +1721,18 @@ vec4_visitor::run(gl_clip_plane *clip_planes)<br>
> >><br>
> >>     emit_prolog();<br>
> >><br>
> >> -   /* Generate VS IR for main().  (the visitor only descends into<br>
> >> -    * functions called "main").<br>
> >> -    */<br>
> >>     if (shader) {<br>
> >> -      visit_instructions(shader-><a href="http://base.ir">base.ir</a>);<br>
> >> +      if (use_vec4_nir) {<br>
> ><br>
> > We could put the compiler_options[].NirOptions check here.  I don't<br>
> > care too much though.<br>
> ><br>
><br>
> Yes, the extra variable is not necessary at this point, but later on in<br>
> the series we have the patch<br>
> <a href="http://lists.freedesktop.org/archives/mesa-dev/2015-July/089653.html">http://lists.freedesktop.org/archives/mesa-dev/2015-July/089653.html</a><br>
> which uses the bool variable again in the same method. Hence, I think we<br>
> can leave it there if you don't feel strongly about it. Otherwise, we<br>
> can introduce the variable in the later commit where the condition is<br>
> needed again.</p>
<p dir="ltr">That's fine. Go ahead and leave it.</p>
<p dir="ltr">> >> +         assert(prog->nir != NULL);<br>
> >> +         emit_nir_code();<br>
> >> +         if (failed)<br>
> >> +            return false;<br>
> >> +      } else {<br>
> >> +         /* Generate VS IR for main().  (the visitor only descends into<br>
> >> +          * functions called "main").<br>
> >> +          */<br>
> >> +         visit_instructions(shader-><a href="http://base.ir">base.ir</a>);<br>
> >> +      }<br>
> >>     } else {<br>
> >>        emit_program_code();<br>
> >>     }<br>
> >> --<br>
> >> 2.1.4<br>
> >><br>
> >> _______________________________________________<br>
> >> mesa-dev mailing list<br>
> >> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> >> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
> ><br>
><br>
</p>