diff options
author | Brian Paul <[email protected]> | 2008-07-01 11:48:57 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-07-01 11:48:57 -0600 |
commit | 44c99ad23655204fd2e567fc38512f12e5f262af (patch) | |
tree | 954a996ef3c2dd659ba324efe4390529f6acc1db /src/glw | |
parent | 7d4f01413f16c15b55e99aba6da18b5c979c880c (diff) |
mesa: better function inlining in the presence of 'return' statements
Before, the presence of a 'return' statement always prevented inlining
a function. This was because we didn't want to accidentally return from
the _calling_ function. We still need the semantic of 'return' when inlining
but we can't always use unconditional branches/jumps (GPUs don't always
support arbitrary branching).
Now, we allow inlining functions w/ return if the return is the last
statement in the function. This fixes the common case of a function
that returns a value, such as:
vec4 square(const in vec4 x)
{
return x * x;
}
which effectively compiles into:
vec4 square(const in vec4 x)
{
__retVal = x * x;
return;
}
The 'return' can be no-op'd now and we can inline the function.
cherry-picked from master
Diffstat (limited to 'src/glw')
0 files changed, 0 insertions, 0 deletions