summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_emit.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-26 15:32:02 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-26 15:32:02 -0600
commite3cef5887540016a6d198598cb50bebe09e3f4cf (patch)
tree01202fd6cb4a08507540eb4806dc7fdde70e1bf1 /src/mesa/shader/slang/slang_emit.c
parent9ed040c3c9afe06a8f6b28bc223751e3b2d65fe3 (diff)
Fix function call bug 11731. Also, fix up IR_CALL/IR_FUNC confusion.
Diffstat (limited to 'src/mesa/shader/slang/slang_emit.c')
-rw-r--r--src/mesa/shader/slang/slang_emit.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c
index 02c74095a9..fe13f2865c 100644
--- a/src/mesa/shader/slang/slang_emit.c
+++ b/src/mesa/shader/slang/slang_emit.c
@@ -780,16 +780,18 @@ emit_label(slang_emit_info *emitInfo, const slang_ir_node *n)
/**
- * Emit code for an inlined function call (subroutine).
+ * Emit code for a function call.
+ * Note that for each time a function is called, we emit the function's
+ * body code again because the set of available registers may be different.
*/
static struct prog_instruction *
-emit_func(slang_emit_info *emitInfo, slang_ir_node *n)
+emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n)
{
struct gl_program *progSave;
struct prog_instruction *inst;
GLuint subroutineId;
- assert(n->Opcode == IR_FUNC);
+ assert(n->Opcode == IR_CALL);
assert(n->Label);
/* save/push cur program */
@@ -1687,10 +1689,10 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
case IR_KILL:
return emit_kill(emitInfo);
- case IR_FUNC:
- /* new variable scope for subroutines/function calls*/
+ case IR_CALL:
+ /* new variable scope for subroutines/function calls */
_slang_push_var_table(emitInfo->vt);
- inst = emit_func(emitInfo, n);
+ inst = emit_fcall(emitInfo, n);
_slang_pop_var_table(emitInfo->vt);
return inst;
@@ -1782,7 +1784,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo)
emitInfo->NumSubroutines = 0;
/* Examine CAL instructions.
- * At this point, the BranchTarget field of the CAL instructions is
+ * At this point, the BranchTarget field of the CAL instruction is
* the number/id of the subroutine to call (an index into the
* emitInfo->Subroutines list).
* Translate that into an actual instruction location now.