freedreno/ir3: refactor NIR IR handling
[mesa.git] / src / gallium / drivers / freedreno / ir3 / ir3_shader.h
index 6dc0ce1133f517c2e3560263bc4fc8ada90ba4e9..b3c28a41387596ad8fd1c42ccf217408a6d27833 100644 (file)
@@ -30,7 +30,7 @@
 #define IR3_SHADER_H_
 
 #include "pipe/p_state.h"
-#include "glsl/shader_enums.h"
+#include "glsl/nir/shader_enums.h"
 
 #include "ir3.h"
 #include "disasm.h"
@@ -166,7 +166,9 @@ struct ir3_shader_variant {
        } outputs[16 + 2];  /* +POSITION +PSIZE */
        bool writes_pos, writes_psize;
 
-       /* vertices/inputs: */
+       /* attributes (VS) / varyings (FS):
+        * Note that sysval's should come *after* normal inputs.
+        */
        unsigned inputs_count;
        struct {
                uint8_t slot;
@@ -193,7 +195,15 @@ struct ir3_shader_variant {
                enum glsl_interp_qualifier interpolate;
        } inputs[16 + 2];  /* +POSITION +FACE */
 
-       unsigned total_in;       /* sum of inputs (scalar) */
+       /* sum of input components (scalar).  For frag shaders, it only counts
+        * the varying inputs:
+        */
+       unsigned total_in;
+
+       /* For frag shaders, the total number of inputs (not scalar,
+        * ie. SP_VS_PARAM_REG.TOTALVSOUTVAR)
+        */
+       unsigned varying_in;
 
        /* do we have one or more texture sample instructions: */
        bool has_samp;
@@ -220,6 +230,8 @@ struct ir3_shader_variant {
        struct ir3_shader *shader;
 };
 
+typedef struct nir_shader nir_shader;
+
 struct ir3_shader {
        enum shader_t type;
 
@@ -229,8 +241,8 @@ struct ir3_shader {
 
        struct ir3_compiler *compiler;
 
-       struct pipe_context *pctx;
-       const struct tgsi_token *tokens;
+       struct pipe_context *pctx;    /* TODO replace w/ pipe_screen */
+       nir_shader *nir;
        struct pipe_stream_output_info stream_output;
 
        struct ir3_shader_variant *variants;