Re: [Mesa-dev] [PATCH 08/11] nir/lower_tex: Report progress

2015-11-13 Thread Jason Ekstrand
On Nov 13, 2015 5:25 AM, "Iago Toral"  wrote:
>
> On Wed, 2015-11-11 at 17:26 -0800, Jason Ekstrand wrote:
> > ---
> >  src/glsl/nir/nir.h   |  2 +-
> >  src/glsl/nir/nir_lower_tex.c | 19 +++
> >  2 files changed, 16 insertions(+), 5 deletions(-)
> >
> > diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> > index 41125b1..2299ece 100644
> > --- a/src/glsl/nir/nir.h
> > +++ b/src/glsl/nir/nir.h
> > @@ -1981,7 +1981,7 @@ typedef struct nir_lower_tex_options {
> > unsigned saturate_r;
> >  } nir_lower_tex_options;
> >
> > -void nir_lower_tex(nir_shader *shader,
> > +bool nir_lower_tex(nir_shader *shader,
> > const nir_lower_tex_options *options);
> >
> >  void nir_lower_idiv(nir_shader *shader);
> > diff --git a/src/glsl/nir/nir_lower_tex.c b/src/glsl/nir/nir_lower_tex.c
> > index 8aaa48a..21ed103 100644
> > --- a/src/glsl/nir/nir_lower_tex.c
> > +++ b/src/glsl/nir/nir_lower_tex.c
> > @@ -41,6 +41,7 @@
> >  typedef struct {
> > nir_builder b;
> > const nir_lower_tex_options *options;
> > +   bool progress;
> >  } lower_tex_state;
> >
> >  static void
> > @@ -239,15 +240,21 @@ nir_lower_tex_block(nir_block *block, void
*void_state)
> >/* If we are clamping any coords, we must lower projector first
> > * as clamping happens *after* projection:
> > */
> > -  if (lower_txp || sat_mask)
> > +  if (lower_txp || sat_mask) {
> >   project_src(b, tex);
> > + state->progress = true;
> > +  }
> >
> >if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) &&
> > -  state->options->lower_rect)
> > +  state->options->lower_rect) {
> >   lower_rect(b, tex);
> > + state->progress = true;
> > +  }
> >
> > -  if (sat_mask)
> > +  if (sat_mask) {
> >   saturate_src(b, tex, sat_mask);
> > + state->progress = true;
> > +  }
> > }
> >
> > return true;
> > @@ -264,13 +271,17 @@ nir_lower_tex_impl(nir_function_impl *impl,
lower_tex_state *state)
> > nir_metadata_dominance);
> >  }
> >
> > -void
> > +bool
> >  nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
> >  {
> > lower_tex_state state;
> > state.options = options;
> > +   state.progress = false;
> > +
> > nir_foreach_overload(shader, overload) {
> >if (overload->impl)
> >   nir_lower_tex_impl(overload->impl, &state);
> > }
> > +
> > +   return state.progress;
> >  }
>
> If we are making this change then we also want to make the call to this
> pass use OPT() instead of OPT_V() in brw_preprocess_nir(), so it is
> consistent with patch 3 in this series.

Good call. Will do.

> With that change,
> Reviewed-by: Iago Toral Quiroga 
>
> Iago
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/11] nir/lower_tex: Report progress

2015-11-13 Thread Iago Toral
On Wed, 2015-11-11 at 17:26 -0800, Jason Ekstrand wrote:
> ---
>  src/glsl/nir/nir.h   |  2 +-
>  src/glsl/nir/nir_lower_tex.c | 19 +++
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
> index 41125b1..2299ece 100644
> --- a/src/glsl/nir/nir.h
> +++ b/src/glsl/nir/nir.h
> @@ -1981,7 +1981,7 @@ typedef struct nir_lower_tex_options {
> unsigned saturate_r;
>  } nir_lower_tex_options;
>  
> -void nir_lower_tex(nir_shader *shader,
> +bool nir_lower_tex(nir_shader *shader,
> const nir_lower_tex_options *options);
>  
>  void nir_lower_idiv(nir_shader *shader);
> diff --git a/src/glsl/nir/nir_lower_tex.c b/src/glsl/nir/nir_lower_tex.c
> index 8aaa48a..21ed103 100644
> --- a/src/glsl/nir/nir_lower_tex.c
> +++ b/src/glsl/nir/nir_lower_tex.c
> @@ -41,6 +41,7 @@
>  typedef struct {
> nir_builder b;
> const nir_lower_tex_options *options;
> +   bool progress;
>  } lower_tex_state;
>  
>  static void
> @@ -239,15 +240,21 @@ nir_lower_tex_block(nir_block *block, void *void_state)
>/* If we are clamping any coords, we must lower projector first
> * as clamping happens *after* projection:
> */
> -  if (lower_txp || sat_mask)
> +  if (lower_txp || sat_mask) {
>   project_src(b, tex);
> + state->progress = true;
> +  }
>  
>if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) &&
> -  state->options->lower_rect)
> +  state->options->lower_rect) {
>   lower_rect(b, tex);
> + state->progress = true;
> +  }
>  
> -  if (sat_mask)
> +  if (sat_mask) {
>   saturate_src(b, tex, sat_mask);
> + state->progress = true;
> +  }
> }
>  
> return true;
> @@ -264,13 +271,17 @@ nir_lower_tex_impl(nir_function_impl *impl, 
> lower_tex_state *state)
> nir_metadata_dominance);
>  }
>  
> -void
> +bool
>  nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
>  {
> lower_tex_state state;
> state.options = options;
> +   state.progress = false;
> +
> nir_foreach_overload(shader, overload) {
>if (overload->impl)
>   nir_lower_tex_impl(overload->impl, &state);
> }
> +
> +   return state.progress;
>  }

If we are making this change then we also want to make the call to this
pass use OPT() instead of OPT_V() in brw_preprocess_nir(), so it is
consistent with patch 3 in this series.

With that change,
Reviewed-by: Iago Toral Quiroga 

Iago

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/11] nir/lower_tex: Report progress

2015-11-12 Thread Kenneth Graunke
On Wednesday, November 11, 2015 05:26:28 PM Jason Ekstrand wrote:
> ---
>  src/glsl/nir/nir.h   |  2 +-
>  src/glsl/nir/nir_lower_tex.c | 19 +++
>  2 files changed, 16 insertions(+), 5 deletions(-)

(a bit of drive by reviewing, since we talked about patch 10 on IRC)

Patches 8-10 are:
Reviewed-by: Kenneth Graunke 


signature.asc
Description: This is a digitally signed message part.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/11] nir/lower_tex: Report progress

2015-11-11 Thread Jason Ekstrand
---
 src/glsl/nir/nir.h   |  2 +-
 src/glsl/nir/nir_lower_tex.c | 19 +++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h
index 41125b1..2299ece 100644
--- a/src/glsl/nir/nir.h
+++ b/src/glsl/nir/nir.h
@@ -1981,7 +1981,7 @@ typedef struct nir_lower_tex_options {
unsigned saturate_r;
 } nir_lower_tex_options;
 
-void nir_lower_tex(nir_shader *shader,
+bool nir_lower_tex(nir_shader *shader,
const nir_lower_tex_options *options);
 
 void nir_lower_idiv(nir_shader *shader);
diff --git a/src/glsl/nir/nir_lower_tex.c b/src/glsl/nir/nir_lower_tex.c
index 8aaa48a..21ed103 100644
--- a/src/glsl/nir/nir_lower_tex.c
+++ b/src/glsl/nir/nir_lower_tex.c
@@ -41,6 +41,7 @@
 typedef struct {
nir_builder b;
const nir_lower_tex_options *options;
+   bool progress;
 } lower_tex_state;
 
 static void
@@ -239,15 +240,21 @@ nir_lower_tex_block(nir_block *block, void *void_state)
   /* If we are clamping any coords, we must lower projector first
* as clamping happens *after* projection:
*/
-  if (lower_txp || sat_mask)
+  if (lower_txp || sat_mask) {
  project_src(b, tex);
+ state->progress = true;
+  }
 
   if ((tex->sampler_dim == GLSL_SAMPLER_DIM_RECT) &&
-  state->options->lower_rect)
+  state->options->lower_rect) {
  lower_rect(b, tex);
+ state->progress = true;
+  }
 
-  if (sat_mask)
+  if (sat_mask) {
  saturate_src(b, tex, sat_mask);
+ state->progress = true;
+  }
}
 
return true;
@@ -264,13 +271,17 @@ nir_lower_tex_impl(nir_function_impl *impl, 
lower_tex_state *state)
nir_metadata_dominance);
 }
 
-void
+bool
 nir_lower_tex(nir_shader *shader, const nir_lower_tex_options *options)
 {
lower_tex_state state;
state.options = options;
+   state.progress = false;
+
nir_foreach_overload(shader, overload) {
   if (overload->impl)
  nir_lower_tex_impl(overload->impl, &state);
}
+
+   return state.progress;
 }
-- 
2.5.0.400.gff86faf

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev