gallium: add NIR as a possible IR
authorRob Clark <robclark@freedesktop.org>
Sat, 30 Jan 2016 18:11:47 +0000 (13:11 -0500)
committerRob Clark <robclark@freedesktop.org>
Wed, 11 May 2016 16:20:11 +0000 (12:20 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_screen.h
src/gallium/include/pipe/p_state.h

index 2f481091858dd13f9fc43e980025d9f8bee0c512..0cea2e3dadddc810f8890f9c10bc480c34c4f163 100644 (file)
@@ -813,6 +813,7 @@ enum pipe_shader_ir
    PIPE_SHADER_IR_TGSI = 0,
    PIPE_SHADER_IR_LLVM,
    PIPE_SHADER_IR_NATIVE,
+   PIPE_SHADER_IR_NIR,
 };
 
 /**
index 3ac5f3cc9fff8c893df7c3d2b1cef14d2233b296..755291ae501c52093991b13c438db8f0b91abac1 100644 (file)
@@ -275,6 +275,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);
 };
 
 
index 3f14e41dff1a0e961fd1ff915c42ba621916f4f0..eacf9bbe68b27efdaf6de8bd1faf6d2b330a6c8d 100644 (file)
@@ -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;
 };