summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_emit.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-07-01 11:41:21 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-07-01 11:41:21 -0600
commit32a5c4033665d51277c733318ac0461e5f85ad09 (patch)
tree5d788e14e59221d65a7d0a2fc123d0c3616546d9 /src/mesa/shader/slang/slang_emit.c
parentb2247c7d29667047cd34180826a8966675f8be3a (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_emit.c')
0 files changed, 0 insertions, 0 deletions