summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-19 14:06:22 -0700
committerBrian <[email protected]>2007-12-19 14:06:22 -0700
commite9207430cefd44beb1a16cfb5879a7ace475e2f5 (patch)
tree85f061f0ffb43f9c628d96b62eb497e1a746870a /src/mesa/state_tracker
parent4a1776a763f2c3b3d1d5bdb5720cafad3ac932c6 (diff)
Add some prototype code for converting RET to END for main(). Disabled for now.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_mesa_to_tgsi.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c
index 470cef8e854..01dc70b66e8 100644
--- a/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -180,7 +180,8 @@ compile_instruction(
const GLuint outputMapping[],
const GLuint immediateMapping[],
GLuint preamble_size,
- GLuint processor )
+ GLuint processor,
+ GLboolean *insideSubroutine)
{
GLuint i;
struct tgsi_full_dst_register *fulldst;
@@ -283,6 +284,7 @@ compile_instruction(
break;
case OPCODE_BGNSUB:
fullinst->Instruction.Opcode = TGSI_OPCODE_BGNSUB;
+ *insideSubroutine = GL_TRUE;
break;
case OPCODE_BRA:
fullinst->Instruction.Opcode = TGSI_OPCODE_BRA;
@@ -334,6 +336,7 @@ compile_instruction(
break;
case OPCODE_ENDSUB:
fullinst->Instruction.Opcode = TGSI_OPCODE_ENDSUB;
+ *insideSubroutine = GL_FALSE;
break;
case OPCODE_EX2:
fullinst->Instruction.Opcode = TGSI_OPCODE_EX2;
@@ -412,7 +415,16 @@ compile_instruction(
fullinst->Instruction.Opcode = TGSI_OPCODE_RCP;
break;
case OPCODE_RET:
- fullinst->Instruction.Opcode = TGSI_OPCODE_RET;
+ /* If RET is used inside main (not a real subroutine) we may want
+ * to execute END instead of RET. TBD...
+ */
+ if (1 /* *insideSubroutine */) {
+ fullinst->Instruction.Opcode = TGSI_OPCODE_RET;
+ }
+ else {
+ /* inside main() pseudo-function */
+ fullinst->Instruction.Opcode = TGSI_OPCODE_END;
+ }
break;
case OPCODE_RSQ:
fullinst->Instruction.Opcode = TGSI_OPCODE_RSQ;
@@ -682,6 +694,7 @@ tgsi_translate_mesa_program(
GLuint preamble_size = 0;
GLuint immediates[1000];
GLuint numImmediates = 0;
+ GLboolean insideSubroutine = GL_FALSE;
assert(procType == TGSI_PROCESSOR_FRAGMENT ||
procType == TGSI_PROCESSOR_VERTEX);
@@ -879,7 +892,8 @@ tgsi_translate_mesa_program(
outputMapping,
immediates,
preamble_size,
- procType );
+ procType,
+ &insideSubroutine);
ti += tgsi_build_full_instruction(
&fullinst,