mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 09:40:40 +02:00
Handle labels for IF/ELSE correctly
This commit is contained in:
parent
f141399031
commit
281dad2259
2 changed files with 23 additions and 4 deletions
|
|
@ -686,12 +686,15 @@ dump_immediate_verbose(
|
|||
static void
|
||||
dump_instruction_short(
|
||||
struct text_dump *dump,
|
||||
struct tgsi_full_instruction *inst )
|
||||
struct tgsi_full_instruction *inst,
|
||||
GLuint instno )
|
||||
{
|
||||
GLuint i;
|
||||
GLboolean first_reg = GL_TRUE;
|
||||
|
||||
CHR( '\n' );
|
||||
UID( instno );
|
||||
CHR( ':' );
|
||||
ENM( inst->Instruction.Opcode, TGSI_OPCODES_SHORT );
|
||||
|
||||
switch( inst->Instruction.Saturate ) {
|
||||
|
|
@ -781,6 +784,14 @@ dump_instruction_short(
|
|||
|
||||
first_reg = GL_FALSE;
|
||||
}
|
||||
|
||||
switch( inst->Instruction.Opcode ) {
|
||||
case TGSI_OPCODE_IF:
|
||||
case TGSI_OPCODE_ELSE:
|
||||
TXT( " : " );
|
||||
UID( inst->InstructionExtLabel.Label );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1140,6 +1151,7 @@ tgsi_dump(
|
|||
GLuint verbose = flags & TGSI_DUMP_VERBOSE;
|
||||
GLuint ignored = !(flags & TGSI_DUMP_NO_IGNORED);
|
||||
GLuint deflt = !(flags & TGSI_DUMP_NO_DEFAULT);
|
||||
GLuint instno = 0;
|
||||
|
||||
{
|
||||
#if 0
|
||||
|
|
@ -1206,7 +1218,9 @@ tgsi_dump(
|
|||
case TGSI_TOKEN_TYPE_INSTRUCTION:
|
||||
dump_instruction_short(
|
||||
dump,
|
||||
&parse.FullToken.FullInstruction );
|
||||
&parse.FullToken.FullInstruction,
|
||||
instno );
|
||||
instno++;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ compile_instruction(
|
|||
const struct prog_instruction *inst,
|
||||
struct tgsi_full_instruction *fullinst,
|
||||
GLuint inputs_read,
|
||||
GLuint preamble_size,
|
||||
GLuint processor )
|
||||
{
|
||||
GLuint i;
|
||||
|
|
@ -293,7 +294,7 @@ compile_instruction(
|
|||
break;
|
||||
case OPCODE_ELSE:
|
||||
fullinst->Instruction.Opcode = TGSI_OPCODE_ELSE;
|
||||
fullinst->InstructionExtLabel.Label = inst->BranchTarget;
|
||||
fullinst->InstructionExtLabel.Label = inst->BranchTarget + preamble_size;
|
||||
break;
|
||||
case OPCODE_ENDIF:
|
||||
fullinst->Instruction.Opcode = TGSI_OPCODE_ENDIF;
|
||||
|
|
@ -318,7 +319,7 @@ compile_instruction(
|
|||
break;
|
||||
case OPCODE_IF:
|
||||
fullinst->Instruction.Opcode = TGSI_OPCODE_IF;
|
||||
fullinst->InstructionExtLabel.Label = inst->BranchTarget;
|
||||
fullinst->InstructionExtLabel.Label = inst->BranchTarget + preamble_size;
|
||||
break;
|
||||
case OPCODE_INT:
|
||||
fullinst->Instruction.Opcode = TGSI_OPCODE_INT;
|
||||
|
|
@ -473,6 +474,7 @@ tgsi_mesa_compile_fp_program(
|
|||
struct tgsi_full_dst_register *fulldst;
|
||||
struct tgsi_full_src_register *fullsrc;
|
||||
GLuint inputs_read;
|
||||
GLuint preamble_size = 0;
|
||||
|
||||
*(struct tgsi_version *) &tokens[0] = tgsi_build_version();
|
||||
|
||||
|
|
@ -559,12 +561,14 @@ tgsi_mesa_compile_fp_program(
|
|||
&tokens[ti],
|
||||
header,
|
||||
maxTokens - ti );
|
||||
preamble_size++;
|
||||
|
||||
for( i = 0; i < program->Base.NumInstructions; i++ ) {
|
||||
if( compile_instruction(
|
||||
&program->Base.Instructions[i],
|
||||
&fullinst,
|
||||
inputs_read,
|
||||
preamble_size,
|
||||
TGSI_PROCESSOR_FRAGMENT ) ) {
|
||||
assert( i == program->Base.NumInstructions - 1 );
|
||||
tgsi_dump(
|
||||
|
|
@ -610,6 +614,7 @@ tgsi_mesa_compile_vp_program(
|
|||
&program->Base.Instructions[ii],
|
||||
&fullinst,
|
||||
inputs_read,
|
||||
0,
|
||||
TGSI_PROCESSOR_VERTEX ) ) {
|
||||
assert( ii == program->Base.NumInstructions - 1 );
|
||||
tgsi_dump( tokens, TGSI_DUMP_NO_IGNORED | TGSI_DUMP_NO_DEFAULT );
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue