[Mesa-dev] [PATCH 02/16] gallium: add NIR as a possible IR

Marek Olšák maraeo at gmail.com
Sun Mar 27 18:14:23 UTC 2016


Patches 1-2:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Sat, Mar 26, 2016 at 10:02 PM, Rob Clark <robdclark at gmail.com> wrote:
> From: Rob Clark <robclark at freedesktop.org>
>
> Signed-off-by: Rob Clark <robclark at freedesktop.org>
> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
> ---
>  src/gallium/include/pipe/p_defines.h | 1 +
>  src/gallium/include/pipe/p_screen.h  | 9 +++++++++
>  src/gallium/include/pipe/p_state.h   | 6 ++++++
>  3 files changed, 16 insertions(+)
>
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index d9d10af..b255531 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -776,6 +776,7 @@ enum pipe_shader_ir
>     PIPE_SHADER_IR_TGSI = 0,
>     PIPE_SHADER_IR_LLVM,
>     PIPE_SHADER_IR_NATIVE,
> +   PIPE_SHADER_IR_NIR,
>  };
>
>  /**
> diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
> index 4f30e75..a3b00ed 100644
> --- a/src/gallium/include/pipe/p_screen.h
> +++ b/src/gallium/include/pipe/p_screen.h
> @@ -272,6 +272,15 @@ struct pipe_screen {
>      */
>     void (*query_memory_info)(struct pipe_screen *screen,
>                               struct pipe_memory_info *info);
> +
> +   /**
> +    * Get IR specific compiler options struct.  For PIPE_SHADER_IR_NIR this
> +    * returns a 'struct nir_shader_compiler_options'.  Drivers reporting
> +    * NIR as the preferred IR must implement this.
> +    */
> +   const void *(*get_compiler_options)(struct pipe_screen *screen,
> +                                      enum pipe_shader_ir ir,
> +                                      unsigned shader);
>  };
>
>
> diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
> index 2c464a4..24e1640 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -221,6 +221,11 @@ struct pipe_stream_output_info
>   *
>   * TODO pipe_compute_state should probably get similar treatment to handle
>   * multiple IR's in a cleaner way..
> + *
> + * NOTE: since it is expected that the consumer will want to perform
> + * additional passes on the nir_shader, the driver takes ownership of
> + * the nir_shader.  If state trackers need to hang on to the IR (for
> + * example, variant management), it should use nir_shader_clone().
>   */
>  struct pipe_shader_state
>  {
> @@ -230,6 +235,7 @@ struct pipe_shader_state
>     union {
>        void *llvm;
>        void *native;
> +      void *nir;
>     } ir;
>     struct pipe_stream_output_info stream_output;
>  };
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list