[Mesa-dev] [RFCv2 02/13] gallium: add NIR as a possible IR
Rob Clark
robdclark at gmail.com
Sun Nov 8 12:12:23 PST 2015
---
src/gallium/include/pipe/p_defines.h | 1 +
src/gallium/include/pipe/p_state.h | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 0a9d98d..572461f 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -718,6 +718,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_state.h b/src/gallium/include/pipe/p_state.h
index f1c4b49..7eee709 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -221,6 +221,12 @@ 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 the nir_shader is reference counted, the semantics are a bit
+ * different from create_xyz_state(ir=TGSI). The driver takes ownership of
+ * the nir_shader (and must nir_shader_unref()) at some point. If state
+ * trackers need to hang on to the IR (for example, variant management), it
+ * should increment the refcnt before calling create_xyz_shader(ir=NIR).
*/
struct pipe_shader_state
{
@@ -230,6 +236,7 @@ struct pipe_shader_state
const struct tgsi_token *tokens;
void *llvm;
void *native;
+ void *nir;
};
struct pipe_stream_output_info stream_output;
};
--
2.5.0
More information about the mesa-dev
mailing list