[Mesa-dev] [PATCH 7/9] i965/nir: Lower nir compute shader shared variables

Jason Ekstrand jason at jlekstrand.net
Tue Mar 15 20:47:28 UTC 2016


On Mon, Mar 14, 2016 at 11:57 PM, Jordan Justen <jordan.l.justen at intel.com>
wrote:

> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 1 +
>  src/mesa/drivers/dri/i965/brw_nir.c  | 8 ++++++++
>  src/mesa/drivers/dri/i965/brw_nir.h  | 1 +
>  3 files changed, 10 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index ff67cf4..41bb170 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -5730,6 +5730,7 @@ brw_compile_cs(const struct brw_compiler *compiler,
> void *log_data,
>     nir_shader *shader = nir_shader_clone(mem_ctx, src_shader);
>     shader = brw_nir_apply_sampler_key(shader, compiler->devinfo,
> &key->tex,
>                                        true);
> +   brw_nir_lower_cs_shared(shader);
>     shader = brw_postprocess_nir(shader, compiler->devinfo, true);
>
>     prog_data->local_size[0] = shader->info.cs.local_size[0];
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c
> b/src/mesa/drivers/dri/i965/brw_nir.c
> index a5949d5..2435046 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir.c
> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
> @@ -377,6 +377,14 @@ brw_nir_lower_uniforms(nir_shader *nir, bool
> is_scalar)
>     }
>  }
>
> +void
> +brw_nir_lower_cs_shared(nir_shader *nir)
> +{
> +   nir_assign_var_locations(&nir->shared, &nir->num_shared,
> +                            type_size_scalar_bytes);
> +   nir_lower_io(nir, nir_var_shared, type_size_scalar_bytes);
>

I'm not seeing how this doesn't stomp num_shared which has previously been
loaded up with values from GLSL.  I looked through the other two patches
and it's still not clear.  I think the best thing to do is to just drop
patches 8 and 9 as they are GL-specific and GL should work without them.
With that, the series is

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>


> +}
> +
>  #define OPT(pass, ...) ({                                  \
>     bool this_progress = false;                             \
>     NIR_PASS(this_progress, nir, pass, ##__VA_ARGS__);      \
> diff --git a/src/mesa/drivers/dri/i965/brw_nir.h
> b/src/mesa/drivers/dri/i965/brw_nir.h
> index 2d8341f..440b4ce 100644
> --- a/src/mesa/drivers/dri/i965/brw_nir.h
> +++ b/src/mesa/drivers/dri/i965/brw_nir.h
> @@ -95,6 +95,7 @@ void brw_nir_lower_fs_inputs(nir_shader *nir);
>  void brw_nir_lower_vue_outputs(nir_shader *nir, bool is_scalar);
>  void brw_nir_lower_tcs_outputs(nir_shader *nir, const struct brw_vue_map
> *vue);
>  void brw_nir_lower_fs_outputs(nir_shader *nir);
> +void brw_nir_lower_cs_shared(nir_shader *nir);
>
>  nir_shader *brw_postprocess_nir(nir_shader *nir,
>                                  const struct brw_device_info *devinfo,
> --
> 2.7.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160315/8f9dbe09/attachment.html>


More information about the mesa-dev mailing list