diff options
author | Kenneth Graunke <[email protected]> | 2014-03-07 02:10:14 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-03-18 10:11:21 -0700 |
commit | 7c7627781feca0c8738da66425d6c530ea598dc4 (patch) | |
tree | e24035dd4adda143e3bb58db6a44f01facb921ef | |
parent | de77efde91401919fe7282a4b07300a10185792b (diff) |
i965/fs: Save push constant location information.
Previously, both move_uniform_array_access_to_pull_constants() and
setup_pull_constants() maintained stack-local arrays with this
information. Storing this information will allow it to be used from
multiple functions, allowing us to split and move code around.
We'll also eventually want to pass pull constant location information
to the SIMD16 compile. Saving this information will help us do that.
Unfortunately, the two functions *cannot* share the contents of the
array just yet. remove_dead_constants() renumbers all the UNIFORM
registers to be contiguous starting at zero, so the two functions
talk about uniforms using different names. We can't even remap them,
since move_uniform_array_access_to_pull_constants() deletes UNIFORM
registers that are only accessed with reladdr, so remove_dead_constants
can't even see them.
This situation will improve in the next few patches.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.h | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index c24d2f8dd79..8faf4016731 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1827,7 +1827,7 @@ fs_visitor::remove_dead_constants() void fs_visitor::move_uniform_array_access_to_pull_constants() { - int pull_constant_loc[uniforms]; + pull_constant_loc = ralloc_array(mem_ctx, int, uniforms); for (unsigned int i = 0; i < uniforms; i++) { pull_constant_loc[i] = -1; @@ -1884,6 +1884,9 @@ fs_visitor::move_uniform_array_access_to_pull_constants() } } invalidate_live_intervals(); + + ralloc_free(pull_constant_loc); + pull_constant_loc = NULL; } /** @@ -1909,7 +1912,7 @@ fs_visitor::setup_pull_constants() */ unsigned int pull_uniform_base = max_uniform_components; - int pull_constant_loc[uniforms]; + pull_constant_loc = ralloc_array(mem_ctx, int, uniforms); for (unsigned int i = 0; i < uniforms; i++) { if (i < pull_uniform_base) { pull_constant_loc[i] = -1; diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 86c95dfb124..abfdb104169 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -509,6 +509,12 @@ public: /** Number of uniform variable components visited. */ unsigned uniforms; + /** + * Array mapping UNIFORM register numbers to the pull parameter index, + * or -1 if this uniform register isn't being uploaded as a pull constant. + */ + int *pull_constant_loc; + /* This is the map from UNIFORM hw_reg + reg_offset as generated by * the visitor to the packed uniform number after * remove_dead_constants() that represents the actual uploaded diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 90272eb68f5..404af306bb5 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2971,6 +2971,7 @@ fs_visitor::fs_visitor(struct brw_context *brw, this->regs_live_at_ip = NULL; this->uniforms = 0; + this->pull_constant_loc = NULL; this->params_remap = NULL; this->nr_params_remap = 0; |