gallium: remove PIPE_CAP_USER_CONSTANT_BUFFERS
[mesa.git] / src / gallium / drivers / r600 / r600_asm.h
index 6ab5dacec5de541697a2a46879a39b082e155421..d7cb64f0b7d8bb93573fdeb0611be74826daf5ef 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "r600_pipe.h"
 #include "r600_isa.h"
+#include "tgsi/tgsi_exec.h"
 
 struct r600_bytecode_alu_src {
        unsigned                        sel;
@@ -33,6 +34,7 @@ struct r600_bytecode_alu_src {
        unsigned                        abs;
        unsigned                        rel;
        unsigned                        kc_bank;
+       unsigned                        kc_rel;
        uint32_t                        value;
 };
 
@@ -51,6 +53,7 @@ struct r600_bytecode_alu {
        unsigned                        op;
        unsigned                        last;
        unsigned                        is_op3;
+       unsigned                        is_lds_idx_op;
        unsigned                        execute_mask;
        unsigned                        update_pred;
        unsigned                        pred_sel;
@@ -58,6 +61,7 @@ struct r600_bytecode_alu {
        unsigned                        bank_swizzle_force;
        unsigned                        omod;
        unsigned                        index_mode;
+       unsigned                        lds_idx;
 };
 
 struct r600_bytecode_tex {
@@ -86,6 +90,9 @@ struct r600_bytecode_tex {
        unsigned                        src_sel_y;
        unsigned                        src_sel_z;
        unsigned                        src_sel_w;
+       /* indexed samplers/resources only on evergreen/cayman */
+       unsigned                        sampler_index_mode;
+       unsigned                        resource_index_mode;
 };
 
 struct r600_bytecode_vtx {
@@ -108,6 +115,28 @@ struct r600_bytecode_vtx {
        unsigned                        srf_mode_all;
        unsigned                        offset;
        unsigned                        endian;
+       unsigned                        buffer_index_mode;
+};
+
+struct r600_bytecode_gds {
+       struct list_head                list;
+       unsigned                        op;
+       unsigned                        src_gpr;
+       unsigned                        src_rel;
+       unsigned                        src_sel_x;
+       unsigned                        src_sel_y;
+       unsigned                        src_sel_z;
+       unsigned                        src_gpr2;
+       unsigned                        dst_gpr;
+       unsigned                        dst_rel;
+       unsigned                        dst_sel_x;
+       unsigned                        dst_sel_y;
+       unsigned                        dst_sel_z;
+       unsigned                        dst_sel_w;
+       unsigned                        uav_index_mode;
+       unsigned                        uav_id;
+       unsigned                        alloc_consume;
+       unsigned                        bcast_first_req;
 };
 
 struct r600_bytecode_output {
@@ -115,7 +144,6 @@ struct r600_bytecode_output {
        unsigned                        array_size;
        unsigned                        comp_mask;
        unsigned                        type;
-       unsigned                        end_of_program;
 
        unsigned                        op;
 
@@ -126,13 +154,20 @@ struct r600_bytecode_output {
        unsigned                        swizzle_z;
        unsigned                        swizzle_w;
        unsigned                        burst_count;
-       unsigned                        barrier;
+       unsigned                        index_gpr;
+};
+
+struct r600_bytecode_rat {
+       unsigned                        id;
+       unsigned                        inst;
+       unsigned                        index_mode;
 };
 
 struct r600_bytecode_kcache {
        unsigned                        bank;
        unsigned                        mode;
        unsigned                        addr;
+       unsigned                        index_mode;
 };
 
 struct r600_bytecode_cf {
@@ -144,14 +179,21 @@ struct r600_bytecode_cf {
        unsigned                        id;
        unsigned                        cond;
        unsigned                        pop_count;
+       unsigned                        count;
        unsigned                        cf_addr; /* control flow addr */
        struct r600_bytecode_kcache             kcache[4];
        unsigned                        r6xx_uses_waterfall;
        unsigned                        eg_alu_extended;
+       unsigned                        barrier;
+       unsigned                        end_of_program;
+       unsigned                        mark;
+       unsigned                        vpm;
        struct list_head                alu;
        struct list_head                tex;
        struct list_head                vtx;
+       struct list_head                gds;
        struct r600_bytecode_output             output;
+       struct r600_bytecode_rat                rat;
        struct r600_bytecode_alu                *curr_bs_head;
        struct r600_bytecode_alu                *prev_bs_head;
        struct r600_bytecode_alu                *prev2_bs_head;
@@ -195,6 +237,7 @@ struct r600_stack_info {
 
 struct r600_bytecode {
        enum chip_class                 chip_class;
+       enum radeon_family              family;
        bool                            has_compressed_msaa_texturing;
        int                             type;
        struct list_head                cf;
@@ -203,24 +246,30 @@ struct r600_bytecode {
        unsigned                        ncf;
        unsigned                        ngpr;
        unsigned                        nstack;
+       unsigned                        nlds_dw;
        unsigned                        nresource;
        unsigned                        force_add_cf;
        uint32_t                        *bytecode;
        uint32_t                        fc_sp;
-       struct r600_cf_stack_entry      fc_stack[32];
+       struct r600_cf_stack_entry      fc_stack[TGSI_EXEC_MAX_NESTING];
        struct r600_stack_info          stack;
        unsigned        ar_loaded;
        unsigned        ar_reg;
        unsigned        ar_chan;
        unsigned        ar_handling;
        unsigned        r6xx_nop_after_rel_dst;
+       bool            index_loaded[2];
+       unsigned        index_reg[2]; /* indexing register CF_INDEX_[01] */
        unsigned        debug_id;
        struct r600_isa* isa;
 };
 
 /* eg_asm.c */
 int eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf);
-
+int egcm_load_index_reg(struct r600_bytecode *bc, unsigned id, bool inside_alu_clause);
+int eg_bytecode_gds_build(struct r600_bytecode *bc, struct r600_bytecode_gds *gds, unsigned id);
+int eg_bytecode_alu_build(struct r600_bytecode *bc,
+                         struct r600_bytecode_alu *alu, unsigned id);
 /* r600_asm.c */
 void r600_bytecode_init(struct r600_bytecode *bc,
                        enum chip_class chip_class,
@@ -231,8 +280,12 @@ int r600_bytecode_add_alu(struct r600_bytecode *bc,
                const struct r600_bytecode_alu *alu);
 int r600_bytecode_add_vtx(struct r600_bytecode *bc,
                const struct r600_bytecode_vtx *vtx);
+int r600_bytecode_add_vtx_tc(struct r600_bytecode *bc,
+                            const struct r600_bytecode_vtx *vtx);
 int r600_bytecode_add_tex(struct r600_bytecode *bc,
                const struct r600_bytecode_tex *tex);
+int r600_bytecode_add_gds(struct r600_bytecode *bc,
+               const struct r600_bytecode_gds *gds);
 int r600_bytecode_add_output(struct r600_bytecode *bc,
                const struct r600_bytecode_output *output);
 int r600_bytecode_build(struct r600_bytecode *bc);
@@ -242,7 +295,7 @@ int r600_bytecode_add_cfinst(struct r600_bytecode *bc,
 int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
                const struct r600_bytecode_alu *alu, unsigned type);
 void r600_bytecode_special_constants(uint32_t value,
-               unsigned *sel, unsigned *neg);
+               unsigned *sel, unsigned *neg, unsigned abs);
 void r600_bytecode_disasm(struct r600_bytecode *bc);
 void r600_bytecode_alu_read(struct r600_bytecode *bc,
                struct r600_bytecode_alu *alu, uint32_t word0, uint32_t word1);
@@ -267,4 +320,19 @@ void eg_bytecode_export_read(struct r600_bytecode *bc,
 
 void r600_vertex_data_type(enum pipe_format pformat, unsigned *format,
                           unsigned *num_format, unsigned *format_comp, unsigned *endian);
+
+static inline int fp64_switch(int i)
+{
+       switch (i) {
+       case 0:
+               return 1;
+       case 1:
+               return 0;
+       case 2:
+               return 3;
+       case 3:
+               return 2;
+       }
+       return 0;
+}
 #endif