[Mesa-dev] [PATCH 2/7] i965/fs: Save push constant location information.

Pohjolainen, Topi topi.pohjolainen at intel.com
Sat Mar 15 00:28:51 PDT 2014


On Fri, Mar 14, 2014 at 01:39:05PM -0700, Kenneth Graunke wrote:
> On 03/14/2014 11:40 AM, Pohjolainen, Topi wrote:
> > On Tue, Mar 11, 2014 at 11:48:51PM -0700, Kenneth Graunke wrote:
> >> 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 <kenneth at whitecape.org>
> >> ---
> >>  src/mesa/drivers/dri/i965/brw_fs.cpp         | 7 +++++--
> >>  src/mesa/drivers/dri/i965/brw_fs.h           | 6 ++++++
> >>  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 c24d2f8..8faf401 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();
> > 
> > I'm confused. I wondered what was the reason for patch number four removing
> > this call. But this is not present in current master and the first patch does
> > not introduce it either. Leftover from somewhere else, perhaps?
> 
> Sorry, I sent out a few patches separately, and one of them added this
> call.  I've pushed those to master now.

I just checked, and now I even recall reading that patch in the list. My
mistake.

> 
> Patch 4 actually just moves the call into demote_pull_constants() - it
> still happens at the same time.
> 

True, I missed that as I was looking for explicit
"+   invalidate_live_intervals();" in the patch.


More information about the mesa-dev mailing list