v3d: Use the new lower_to_scratch implementation for indirects on temps.
[mesa.git] / src / broadcom / compiler / v3d_compiler.h
index ebfbe364cab8a6c29b31d2586c21c88c1a389c4f..2bc07de7e1f3ed31ee52e1b149e0ebbbaef43423 100644 (file)
@@ -69,9 +69,6 @@ enum qfile {
          * or physical registers later.
          */
         QFILE_TEMP,
-        QFILE_UNIF,
-        QFILE_TLB,
-        QFILE_TLBU,
 
         /**
          * VPM reads use this with an index value to say what part of the VPM
@@ -105,6 +102,11 @@ static inline struct qreg vir_reg(enum qfile file, uint32_t index)
         return (struct qreg){file, index};
 }
 
+static inline struct qreg vir_magic_reg(uint32_t index)
+{
+        return (struct qreg){QFILE_MAGIC, index};
+}
+
 static inline struct qreg vir_nop_reg(void)
 {
         return (struct qreg){QFILE_NULL, 0};
@@ -279,17 +281,18 @@ enum quniform_contents {
         QUNIFORM_SHARED_OFFSET,
 };
 
-static inline uint32_t v3d_tmu_config_data_create(uint32_t unit, uint32_t value)
+static inline uint32_t v3d_unit_data_create(uint32_t unit, uint32_t value)
 {
+        assert(value < (1 << 24));
         return unit << 24 | value;
 }
 
-static inline uint32_t v3d_tmu_config_data_get_unit(uint32_t data)
+static inline uint32_t v3d_unit_data_get_unit(uint32_t data)
 {
         return data >> 24;
 }
 
-static inline uint32_t v3d_tmu_config_data_get_value(uint32_t data)
+static inline uint32_t v3d_unit_data_get_offset(uint32_t data)
 {
         return data & 0xffffff;
 }
@@ -315,25 +318,6 @@ static inline uint8_t v3d_slot_get_component(struct v3d_varying_slot slot)
         return slot.slot_and_component & 3;
 }
 
-struct v3d_ubo_range {
-        /**
-         * offset in bytes from the start of the ubo where this range is
-         * uploaded.
-         *
-         * Only set once used is set.
-         */
-        uint32_t dst_offset;
-
-        /**
-         * offset in bytes from the start of the gallium uniforms where the
-         * data comes from.
-         */
-        uint32_t src_offset;
-
-        /** size in bytes of this ubo range */
-        uint32_t size;
-};
-
 struct v3d_key {
         void *shader_state;
         struct {
@@ -530,13 +514,6 @@ struct v3d_compile {
         bool uses_center_w;
         bool writes_z;
 
-        struct v3d_ubo_range *ubo_ranges;
-        bool *ubo_range_used;
-        uint32_t ubo_ranges_array_size;
-        /** Number of uniform areas tracked in ubo_ranges. */
-        uint32_t num_ubo_ranges;
-        uint32_t next_ubo_dst_offset;
-
         /* State for whether we're executing on each channel currently.  0 if
          * yes, otherwise a block number + 1 that the channel jumped to.
          */
@@ -632,18 +609,6 @@ struct v3d_compile {
          */
         uint32_t num_inputs;
 
-        /**
-         * Number of inputs from num_inputs remaining to be queued to the read
-         * FIFO in the VS/CS.
-         */
-        uint32_t num_inputs_remaining;
-
-        /* Number of inputs currently in the read FIFO for the VS/CS */
-        uint32_t num_inputs_in_fifo;
-
-        /** Next offset in the VPM to read from in the VS/CS */
-        uint32_t vpm_read_offset;
-
         uint32_t program_id;
         uint32_t variant_id;
 
@@ -671,9 +636,6 @@ struct v3d_uniform_list {
 struct v3d_prog_data {
         struct v3d_uniform_list uniforms;
 
-        struct v3d_ubo_range *ubo_ranges;
-        uint32_t num_ubo_ranges;
-        uint32_t ubo_size;
         uint32_t spill_size;
 
         uint8_t threads;
@@ -729,6 +691,12 @@ struct v3d_fs_prog_data {
         bool uses_center_w;
 };
 
+struct v3d_compute_prog_data {
+        struct v3d_prog_data base;
+        /* Size in bytes of the workgroup's shared space. */
+        uint32_t shared_size;
+};
+
 static inline bool
 vir_has_uniform(struct qinst *inst)
 {
@@ -781,6 +749,7 @@ struct qreg vir_uniform(struct v3d_compile *c,
                         enum quniform_contents contents,
                         uint32_t data);
 void vir_schedule_instructions(struct v3d_compile *c);
+void v3d_setup_spill_base(struct v3d_compile *c);
 struct v3d_qpu_instr v3d_qpu_nop(void);
 
 struct qreg vir_emit_def(struct v3d_compile *c, struct qinst *inst);
@@ -823,10 +792,12 @@ bool vir_opt_constant_folding(struct v3d_compile *c);
 bool vir_opt_copy_propagate(struct v3d_compile *c);
 bool vir_opt_dead_code(struct v3d_compile *c);
 bool vir_opt_peephole_sf(struct v3d_compile *c);
+bool vir_opt_redundant_flags(struct v3d_compile *c);
 bool vir_opt_small_immediates(struct v3d_compile *c);
 bool vir_opt_vpm(struct v3d_compile *c);
 void v3d_nir_lower_blend(nir_shader *s, struct v3d_compile *c);
 void v3d_nir_lower_io(nir_shader *s, struct v3d_compile *c);
+void v3d_nir_lower_scratch(nir_shader *s);
 void v3d_nir_lower_txf_ms(nir_shader *s, struct v3d_compile *c);
 void v3d_nir_lower_image_load_store(nir_shader *s);
 void vir_lower_uniforms(struct v3d_compile *c);