mesa: Drop unused control flow instructions for ARB programs.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111>
This commit is contained in:
@@ -80,12 +80,7 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
|
||||
{ OPCODE_ABS, "ABS", 1, 1 },
|
||||
{ OPCODE_ADD, "ADD", 2, 1 },
|
||||
{ OPCODE_ARL, "ARL", 1, 1 },
|
||||
{ OPCODE_BGNLOOP,"BGNLOOP", 0, 0 },
|
||||
{ OPCODE_BGNSUB, "BGNSUB", 0, 0 },
|
||||
{ OPCODE_BRK, "BRK", 0, 0 },
|
||||
{ OPCODE_CAL, "CAL", 0, 0 },
|
||||
{ OPCODE_CMP, "CMP", 3, 1 },
|
||||
{ OPCODE_CONT, "CONT", 0, 0 },
|
||||
{ OPCODE_COS, "COS", 1, 1 },
|
||||
{ OPCODE_DDX, "DDX", 1, 1 },
|
||||
{ OPCODE_DDY, "DDY", 1, 1 },
|
||||
@@ -94,16 +89,11 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
|
||||
{ OPCODE_DP4, "DP4", 2, 1 },
|
||||
{ OPCODE_DPH, "DPH", 2, 1 },
|
||||
{ OPCODE_DST, "DST", 2, 1 },
|
||||
{ OPCODE_ELSE, "ELSE", 0, 0 },
|
||||
{ OPCODE_END, "END", 0, 0 },
|
||||
{ OPCODE_ENDIF, "ENDIF", 0, 0 },
|
||||
{ OPCODE_ENDLOOP,"ENDLOOP", 0, 0 },
|
||||
{ OPCODE_ENDSUB, "ENDSUB", 0, 0 },
|
||||
{ OPCODE_EX2, "EX2", 1, 1 },
|
||||
{ OPCODE_EXP, "EXP", 1, 1 },
|
||||
{ OPCODE_FLR, "FLR", 1, 1 },
|
||||
{ OPCODE_FRC, "FRC", 1, 1 },
|
||||
{ OPCODE_IF, "IF", 1, 0 },
|
||||
{ OPCODE_KIL, "KIL", 1, 0 },
|
||||
{ OPCODE_LG2, "LG2", 1, 1 },
|
||||
{ OPCODE_LIT, "LIT", 1, 1 },
|
||||
@@ -120,7 +110,6 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
|
||||
{ OPCODE_NOISE4, "NOISE4", 1, 1 },
|
||||
{ OPCODE_POW, "POW", 2, 1 },
|
||||
{ OPCODE_RCP, "RCP", 1, 1 },
|
||||
{ OPCODE_RET, "RET", 0, 0 },
|
||||
{ OPCODE_RSQ, "RSQ", 1, 1 },
|
||||
{ OPCODE_SCS, "SCS", 1, 1 },
|
||||
{ OPCODE_SGE, "SGE", 2, 1 },
|
||||
|
||||
@@ -115,12 +115,7 @@ enum prog_opcode {
|
||||
OPCODE_ABS, /* X X 1.1 X */
|
||||
OPCODE_ADD, /* X X X X X */
|
||||
OPCODE_ARL, /* X X X */
|
||||
OPCODE_BGNLOOP, /* opt */
|
||||
OPCODE_BGNSUB, /* opt */
|
||||
OPCODE_BRK, /* 2 opt */
|
||||
OPCODE_CAL, /* 2 2 opt */
|
||||
OPCODE_CMP, /* X X */
|
||||
OPCODE_CONT, /* opt */
|
||||
OPCODE_COS, /* X 2 X X */
|
||||
OPCODE_DDX, /* X X */
|
||||
OPCODE_DDY, /* X X */
|
||||
@@ -129,16 +124,11 @@ enum prog_opcode {
|
||||
OPCODE_DP4, /* X X X X X */
|
||||
OPCODE_DPH, /* X X 1.1 */
|
||||
OPCODE_DST, /* X X X X */
|
||||
OPCODE_ELSE, /* opt */
|
||||
OPCODE_END, /* X X X X opt */
|
||||
OPCODE_ENDIF, /* opt */
|
||||
OPCODE_ENDLOOP, /* opt */
|
||||
OPCODE_ENDSUB, /* opt */
|
||||
OPCODE_EX2, /* X X 2 X X */
|
||||
OPCODE_EXP, /* X X */
|
||||
OPCODE_FLR, /* X X 2 X X */
|
||||
OPCODE_FRC, /* X X 2 X X */
|
||||
OPCODE_IF, /* opt */
|
||||
OPCODE_KIL, /* X X */
|
||||
OPCODE_LG2, /* X X 2 X X */
|
||||
OPCODE_LIT, /* X X X X */
|
||||
@@ -155,7 +145,6 @@ enum prog_opcode {
|
||||
OPCODE_NOISE4, /* X */
|
||||
OPCODE_POW, /* X X X X */
|
||||
OPCODE_RCP, /* X X X X X */
|
||||
OPCODE_RET, /* 2 2 opt */
|
||||
OPCODE_RSQ, /* X X X X X */
|
||||
OPCODE_SCS, /* X X */
|
||||
OPCODE_SGE, /* X X X X X */
|
||||
@@ -245,15 +234,6 @@ struct prog_instruction
|
||||
/** True if tex instruction should do shadow comparison */
|
||||
GLuint TexShadow:1;
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* For BRA and CAL instructions, the location to jump to.
|
||||
* For BGNLOOP, points to ENDLOOP (and vice-versa).
|
||||
* For BRK, points to ENDLOOP
|
||||
* For IF, points to ELSE or ENDIF.
|
||||
* For ELSE, points to ENDIF.
|
||||
*/
|
||||
GLint BranchTarget;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -610,12 +610,6 @@ _mesa_fprint_instruction_opt(FILE *f,
|
||||
{
|
||||
GLint i;
|
||||
|
||||
if (inst->Opcode == OPCODE_ELSE ||
|
||||
inst->Opcode == OPCODE_ENDIF ||
|
||||
inst->Opcode == OPCODE_ENDLOOP ||
|
||||
inst->Opcode == OPCODE_ENDSUB) {
|
||||
indent -= 3;
|
||||
}
|
||||
for (i = 0; i < indent; i++) {
|
||||
fprintf(f, " ");
|
||||
}
|
||||
@@ -682,51 +676,6 @@ _mesa_fprint_instruction_opt(FILE *f,
|
||||
fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
|
||||
fprintf(f, ";\n");
|
||||
break;
|
||||
case OPCODE_IF:
|
||||
fprintf(f, "IF ");
|
||||
fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
|
||||
fprintf(f, "; ");
|
||||
fprintf(f, " # (if false, goto %d)", inst->BranchTarget);
|
||||
fprintf(f, ";\n");
|
||||
return indent + 3;
|
||||
case OPCODE_ELSE:
|
||||
fprintf(f, "ELSE; # (goto %d)\n", inst->BranchTarget);
|
||||
return indent + 3;
|
||||
case OPCODE_ENDIF:
|
||||
fprintf(f, "ENDIF;\n");
|
||||
break;
|
||||
case OPCODE_BGNLOOP:
|
||||
fprintf(f, "BGNLOOP; # (end at %d)\n", inst->BranchTarget);
|
||||
return indent + 3;
|
||||
case OPCODE_ENDLOOP:
|
||||
fprintf(f, "ENDLOOP; # (goto %d)\n", inst->BranchTarget);
|
||||
break;
|
||||
case OPCODE_BRK:
|
||||
case OPCODE_CONT:
|
||||
fprintf(f, "%s; # (goto %d)",
|
||||
_mesa_opcode_string(inst->Opcode),
|
||||
inst->BranchTarget);
|
||||
fprintf(f, ";\n");
|
||||
break;
|
||||
|
||||
case OPCODE_BGNSUB:
|
||||
fprintf(f, "BGNSUB");
|
||||
fprintf(f, ";\n");
|
||||
return indent + 3;
|
||||
case OPCODE_ENDSUB:
|
||||
if (mode == PROG_PRINT_DEBUG) {
|
||||
fprintf(f, "ENDSUB");
|
||||
fprintf(f, ";\n");
|
||||
}
|
||||
break;
|
||||
case OPCODE_CAL:
|
||||
fprintf(f, "CAL %u", inst->BranchTarget);
|
||||
fprintf(f, ";\n");
|
||||
break;
|
||||
case OPCODE_RET:
|
||||
fprintf(f, "RET");
|
||||
fprintf(f, ";\n");
|
||||
break;
|
||||
|
||||
case OPCODE_END:
|
||||
fprintf(f, "END\n");
|
||||
|
||||
Reference in New Issue
Block a user