diff options
author | Vadim Girlin <[email protected]> | 2013-05-02 07:56:32 +0400 |
---|---|---|
committer | Vadim Girlin <[email protected]> | 2013-05-03 16:53:41 +0400 |
commit | e16ef1f454905252f9986bd2714fd6ae37a5aa75 (patch) | |
tree | 2faaa4328ba4a8cdeda11b568caaff89fa84eb94 /src/gallium/drivers/r600/sb | |
parent | a6fe055fa77e42e35f25272bdd5ca7213b436a1a (diff) |
r600g/sb: fix allocation of indirectly addressed input arrays
Some inputs may be preloaded into predefined GPRs,
so we can't reallocate arrays with such inputs.
Fixes issues with webgl demo: http://oos.moxiecode.com/js_webgl/snake/
Signed-off-by: Vadim Girlin <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/sb')
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp | 14 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_ra_init.cpp | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_shader.cpp | 13 | ||||
-rw-r--r-- | src/gallium/drivers/r600/sb/sb_shader.h | 2 |
4 files changed, 25 insertions, 10 deletions
diff --git a/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp b/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp index cec4bbc74de..25c46f79c8e 100644 --- a/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp +++ b/src/gallium/drivers/r600/sb/sb_ra_coalesce.cpp @@ -345,13 +345,17 @@ void coalescer::init_reg_bitset(sb_bitset &bs, val_set &vs) { for (val_set::iterator I = vs.begin(sh), E = vs.end(sh); I != E; ++I) { value *v = *I; - if (!v->is_sgpr()) + if (!v->is_any_gpr()) continue; - if (v->gpr) { - if (v->gpr >= bs.size()) - bs.resize(v->gpr + 64); - bs.set(v->gpr, 1); + unsigned gpr = v->get_final_gpr(); + if (!gpr) + continue; + + if (gpr) { + if (gpr >= bs.size()) + bs.resize(gpr + 64); + bs.set(gpr, 1); } } } diff --git a/src/gallium/drivers/r600/sb/sb_ra_init.cpp b/src/gallium/drivers/r600/sb/sb_ra_init.cpp index 0447f29eb1b..99ff6ff3ff5 100644 --- a/src/gallium/drivers/r600/sb/sb_ra_init.cpp +++ b/src/gallium/drivers/r600/sb/sb_ra_init.cpp @@ -244,6 +244,12 @@ void ra_init::alloc_arrays() { cerr << "\n"; ); + // skip preallocated arrays (e.g. with preloaded inputs) + if (a->gpr) { + RA_DUMP( cerr << " FIXED at " << a->gpr << "\n"; ); + continue; + } + bool dead = a->is_dead(); if (dead) { diff --git a/src/gallium/drivers/r600/sb/sb_shader.cpp b/src/gallium/drivers/r600/sb/sb_shader.cpp index 6dd3678e66a..3fd6ea49f54 100644 --- a/src/gallium/drivers/r600/sb/sb_shader.cpp +++ b/src/gallium/drivers/r600/sb/sb_shader.cpp @@ -61,7 +61,7 @@ bool shader::assign_slot(alu_node* n, alu_node *slots[5]) { return true; } -void shader::add_gpr_values(vvec& vec, unsigned gpr, unsigned comp_mask, +void shader::add_pinned_gpr_values(vvec& vec, unsigned gpr, unsigned comp_mask, bool src) { unsigned chan = 0; while (comp_mask) { @@ -72,6 +72,11 @@ void shader::add_gpr_values(vvec& vec, unsigned gpr, unsigned comp_mask, v->gpr = v->pin_gpr = v->select; v->fix(); } + if (v->array && !v->array->gpr) { + // if pinned value can be accessed with indirect addressing + // pin the entire array to its original location + v->array->gpr = v->array->base_gpr; + } vec.push_back(v); } comp_mask >>= 1; @@ -199,7 +204,7 @@ void shader::add_input(unsigned gpr, bool preloaded, unsigned comp_mask) { i.comp_mask = comp_mask; if (preloaded) { - add_gpr_values(root->dst, gpr, comp_mask, true); + add_pinned_gpr_values(root->dst, gpr, comp_mask, true); } } @@ -217,9 +222,9 @@ void shader::init_call_fs(cf_node* cf) { for(inputs_vec::const_iterator I = inputs.begin(), E = inputs.end(); I != E; ++I, ++gpr) { if (!I->preloaded) - add_gpr_values(cf->dst, gpr, I->comp_mask, false); + add_pinned_gpr_values(cf->dst, gpr, I->comp_mask, false); else - add_gpr_values(cf->src, gpr, I->comp_mask, true); + add_pinned_gpr_values(cf->src, gpr, I->comp_mask, true); } } diff --git a/src/gallium/drivers/r600/sb/sb_shader.h b/src/gallium/drivers/r600/sb/sb_shader.h index aa71d542aad..b2e3837c4c0 100644 --- a/src/gallium/drivers/r600/sb/sb_shader.h +++ b/src/gallium/drivers/r600/sb/sb_shader.h @@ -315,7 +315,7 @@ public: value* get_value_version(value* v, unsigned ver); void init(); - void add_gpr_values(vvec& vec, unsigned gpr, unsigned comp_mask, bool src); + void add_pinned_gpr_values(vvec& vec, unsigned gpr, unsigned comp_mask, bool src); void dump_ir(); |