const GLuint outputMapping[],
const GLuint immediateMapping[],
GLuint preamble_size,
- GLuint processor )
+ GLuint processor,
+ GLboolean *insideSubroutine)
{
GLuint i;
struct tgsi_full_dst_register *fulldst;
break;
case OPCODE_BGNSUB:
fullinst->Instruction.Opcode = TGSI_OPCODE_BGNSUB;
+ *insideSubroutine = GL_TRUE;
break;
case OPCODE_BRA:
fullinst->Instruction.Opcode = TGSI_OPCODE_BRA;
break;
case OPCODE_ENDSUB:
fullinst->Instruction.Opcode = TGSI_OPCODE_ENDSUB;
+ *insideSubroutine = GL_FALSE;
break;
case OPCODE_EX2:
fullinst->Instruction.Opcode = TGSI_OPCODE_EX2;
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;
GLuint preamble_size = 0;
GLuint immediates[1000];
GLuint numImmediates = 0;
+ GLboolean insideSubroutine = GL_FALSE;
assert(procType == TGSI_PROCESSOR_FRAGMENT ||
procType == TGSI_PROCESSOR_VERTEX);
outputMapping,
immediates,
preamble_size,
- procType );
+ procType,
+ &insideSubroutine);
ti += tgsi_build_full_instruction(
&fullinst,