r600g/sb: fix kcache handling on r6xx
[mesa.git] / src / gallium / drivers / r600 / sb / sb_sched.cpp
index d7c17952a4a6b717f2b7fe50a04c8ae3a9eb679f..d0045ce75efdd80b1b20fa4ac39c5168f5f580d6 100644 (file)
@@ -43,7 +43,11 @@ namespace r600_sb {
 using std::cerr;
 
 rp_kcache_tracker::rp_kcache_tracker(shader &sh) : rp(), uc(),
-       sel_count(sh.get_ctx().is_r600() ? 4 : 2) {}
+               // FIXME: for now we'll use "two const pairs" limit for r600, same as
+               // for other chips, otherwise additional check in alu_group_tracker is
+               // required to make sure that all 4 consts in the group fit into 2
+               // kcache sets
+               sel_count(2) {}
 
 bool rp_kcache_tracker::try_reserve(sel_chan r) {
        unsigned sel = kc_sel(r);
@@ -542,6 +546,10 @@ bool alu_group_tracker::try_reserve(alu_node* n) {
 
        assert(first_slot != ~0 && last_slot != ~0);
 
+       // silence "array subscript is above array bounds" with gcc 4.8
+       if (last_slot >= 5)
+               abort();
+
        int i = first_nf;
        alu_node *a = slots[i];
        bool backtrack = false;