}
break;
+ case TGSI_OPCODE_END:
+ /* halt execution */
+ *pc = -1;
+ break;
+
case TGSI_OPCODE_ENDIF:
/* pop CondMask */
assert(mach->CondStackTop > 0);
{
uint i;
- int pc;
+ int pc = 0;
for (i = 0; i < mach->NumDeclarations; i++) {
exec_declaration( mach, mach->Declarations+i );
}
- pc = 0;
-
- while (pc != 99 && pc < mach->NumInstructions) {
+ while (pc != -1) {
+ assert(pc < mach->NumInstructions);
exec_instruction( mach, mach->Instructions + pc, &pc );
}
}
/* TGSI_OPCODE_MOVA */
/* TGSI_OPCODE_LOGP */
-#define TGSI_OPCODE_LAST 133
+#define TGSI_OPCODE_END 133 /* aka HALT */
+
+#define TGSI_OPCODE_LAST 134
#define TGSI_SAT_NONE 0 /* do not saturate */
#define TGSI_SAT_ZERO_ONE 1 /* clamp to [0,1] */
return writemask;\r
}\r
\r
-static GLboolean\r
+static void\r
compile_instruction(\r
const struct prog_instruction *inst,\r
struct tgsi_full_instruction *fullinst,\r
fulldst->DstRegister.WriteMask &= TGSI_WRITEMASK_XYZ;\r
break;\r
case OPCODE_END:\r
- return GL_TRUE;\r
+ fullinst->Instruction.Opcode = TGSI_OPCODE_END;\r
+ break;\r
default:\r
assert( 0 );\r
}\r
-\r
- return GL_FALSE;\r
}\r
\r
static struct tgsi_full_declaration\r
#endif\r
\r
for( i = 0; i < program->Base.NumInstructions; i++ ) {\r
- if( compile_instruction(\r
+ compile_instruction(\r
&program->Base.Instructions[i],\r
&fullinst,\r
inputMapping,\r
outputMapping,\r
preamble_size,\r
- TGSI_PROCESSOR_FRAGMENT ) ) {\r
- assert( i == program->Base.NumInstructions - 1 );\r
-\r
- if( TGSI_DEBUG ) {\r
- tgsi_dump( tokens, 0 );\r
- }\r
- break;\r
- }\r
+ TGSI_PROCESSOR_FRAGMENT );\r
\r
ti += tgsi_build_full_instruction(\r
&fullinst,\r
\r
\r
for( i = 0; i < program->Base.NumInstructions; i++ ) {\r
- if( compile_instruction(\r
+ compile_instruction(\r
&program->Base.Instructions[i],\r
&fullinst,\r
inputMapping,\r
outputMapping,\r
0,\r
- TGSI_PROCESSOR_VERTEX ) ) {\r
- assert( i == program->Base.NumInstructions - 1 );\r
-\r
- if( TGSI_DEBUG ) {\r
- tgsi_dump( tokens, 0 );\r
- }\r
- break;\r
- }\r
+ TGSI_PROCESSOR_VERTEX );\r
\r
ti += tgsi_build_full_instruction(\r
&fullinst,\r