diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2008-07-01 11:41:21 -0600 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2008-07-01 11:41:21 -0600 |
commit | 32a5c4033665d51277c733318ac0461e5f85ad09 (patch) | |
tree | 5d788e14e59221d65a7d0a2fc123d0c3616546d9 /src/mesa/shader/slang/slang_print.h | |
parent | b2247c7d29667047cd34180826a8966675f8be3a (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.
Diffstat (limited to 'src/mesa/shader/slang/slang_print.h')
0 files changed, 0 insertions, 0 deletions