Module: Mesa
Branch: master
Commit: 2a3fe68c33257790c051ed03077c52a8ef8f1e0b
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a3fe68c33257790c051ed03077c52a8ef8f1e0b

Author: Jesse Natalie <[email protected]>
Date:   Sun Jun 21 14:35:29 2020 -0700

nir: Add intrinsic and string ptrs

This just adds the basic nir support for printf,
intrinsic, and support for storing the printf info.

Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>

---

 src/compiler/nir/nir.h             | 10 ++++++++++
 src/compiler/nir/nir_intrinsics.py |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 33ddfb0421c..33732dbe406 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -3010,6 +3010,13 @@ typedef struct {
    uint8_t bit_size;
 } nir_parameter;
 
+typedef struct nir_printf_info {
+   unsigned num_args;
+   unsigned *arg_sizes;
+   unsigned string_size;
+   char *strings;
+} nir_printf_info;
+
 typedef struct nir_function {
    struct exec_node node;
 
@@ -3407,6 +3414,9 @@ typedef struct nir_shader {
    void *constant_data;
    /** Size of the constant data associated with the shader, in bytes */
    unsigned constant_data_size;
+
+   unsigned printf_info_count;
+   nir_printf_info *printf_info;
 } nir_shader;
 
 #define nir_foreach_function(func, shader) \
diff --git a/src/compiler/nir/nir_intrinsics.py 
b/src/compiler/nir/nir_intrinsics.py
index f1626bbab0b..9406fcbdb97 100644
--- a/src/compiler/nir/nir_intrinsics.py
+++ b/src/compiler/nir/nir_intrinsics.py
@@ -952,6 +952,12 @@ store("scratch", [1], [ALIGN_MUL, ALIGN_OFFSET, 
WRITE_MASK])
 intrinsic("load_frag_shading_rate", dest_comp=1, bit_sizes=[32],
           flags=[CAN_ELIMINATE, CAN_REORDER])
 
+# OpenCL printf instruction
+# First source is a deref to the format string
+# Second source is a deref to a struct containing the args
+# Dest is success or failure
+intrinsic("printf", src_comp=[1, 1], dest_comp=1, bit_sizes=[32])
+
 # IR3-specific version of most SSBO intrinsics. The only different
 # compare to the originals is that they add an extra source to hold
 # the dword-offset, which is needed by the backend code apart from

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to