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 <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>
This commit is contained in:
Jesse Natalie 2020-06-21 14:35:29 -07:00 committed by Dave Airlie
parent 0a6e1cf383
commit 2a3fe68c33
2 changed files with 16 additions and 0 deletions

View file

@ -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) \

View file

@ -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