nir/lower_tex: Add support for tg4 offsets lowering
[mesa.git] / src / compiler / nir / nir.h
index 067287fab1ce67a8da6338c6989281afa57a15a4..1da9874060bf46a47f66e84a261bc3fba8640d52 100644 (file)
@@ -59,6 +59,7 @@ extern "C" {
 #define NIR_FALSE 0u
 #define NIR_TRUE (~0u)
 #define NIR_MAX_VEC_COMPONENTS 4
+#define NIR_MAX_MATRIX_COLUMNS 4
 typedef uint8_t nir_component_mask_t;
 
 /** Defines a cast function
@@ -141,7 +142,7 @@ typedef struct nir_constant {
     * by the type associated with the \c nir_variable.  Constants may be
     * scalars, vectors, or matrices.
     */
-   nir_const_value values[NIR_MAX_VEC_COMPONENTS];
+   nir_const_value values[NIR_MAX_MATRIX_COLUMNS];
 
    /* we could get this from the var->type but makes clone *much* easier to
     * not have to care about the type.
@@ -1481,6 +1482,9 @@ typedef struct {
    /* gather component selector */
    unsigned component : 2;
 
+   /* gather offsets */
+   int8_t tg4_offsets[4][2];
+
    /** The texture index
     *
     * If this texture instruction has a nir_tex_src_texture_offset source,
@@ -1698,6 +1702,8 @@ void nir_tex_instr_add_src(nir_tex_instr *tex,
 
 void nir_tex_instr_remove_src(nir_tex_instr *tex, unsigned src_idx);
 
+bool nir_tex_instr_has_explicit_tg4_offsets(nir_tex_instr *tex);
+
 typedef struct {
    nir_instr instr;
 
@@ -3230,6 +3236,11 @@ typedef struct nir_lower_tex_options {
     */
    bool lower_tg4_broadcom_swizzle;
 
+   /**
+    * If true, lowers tg4 with 4 constant offsets to 4 tg4 calls
+    */
+   bool lower_tg4_offsets;
+
    enum nir_lower_tex_packing lower_tex_packing[32];
 } nir_lower_tex_options;