diff options
author | Eric Anholt <[email protected]> | 2012-10-30 11:09:59 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2012-11-08 14:50:32 -0800 |
commit | 177c82555b24a80c15c34315ff17437cc39d1ba5 (patch) | |
tree | 39ecf2ef08bbe0725b9a7089a58f81c80f82bcbf /src/glsl/opt_algebraic.cpp | |
parent | 9785ae0973cc206afc36dbc7d5b9553f92d06b47 (diff) |
i965/fs: Add support for global copy propagation.
It is common for complicated shaders, particularly code-generated ones, to
have a big array of uniforms or attributes, and a prologue in the shader that
dereferences from the big array to more informatively-named local variables.
Then there will be some small control flow operation (like a ? : statement),
and then use of those informatively-named variables. We were emitting extra
MOVs in these cases, because copy propagation couldn't reach across control
flow.
Instead, implement dataflow analysis on the output of the first copy
propagation pass and re-run it to propagate those extra MOVs out.
On one future Steam release, reduces VS+FS instruction count from 42837 to
41437. No statistically significant performance difference (n=48), though, at
least at the low resolution I'm running it at.
shader-db results:
total instructions in shared programs: 722170 -> 702545 (-2.72%)
instructions in affected programs: 260618 -> 240993 (-7.53%)
Some shaders do get hurt by up to 2 instructions, because a choice to copy
propagate instead of coalesce or something like that results in a dead write
sticking around. Given that we already have instances of those instructions
in the affected programs (particularly unigine), we should just improve dead
code elimination to fix the problem.
Diffstat (limited to 'src/glsl/opt_algebraic.cpp')
0 files changed, 0 insertions, 0 deletions