r300: simplify KILL transformation

We had some special cases before when we could actually get some IFs on
R300 with VDPAU. Now that VDPAU is gone and everything goes through
ntt, we don't have to worry anymore. Remove the complicated logic and
just always transform KILL into KIL none.-1

No shader-db change on RV530 or RV370.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21503>
This commit is contained in:
Pavel Ondračka 2023-02-22 20:32:33 +01:00 committed by Marge Bot
parent fc0f694676
commit a8e1e5b5c2
3 changed files with 8 additions and 63 deletions

View file

@ -100,9 +100,6 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
struct radeon_compiler_pass fs_list[] = {
/* NAME DUMP PREDICATE FUNCTION PARAM */
{"rewrite depth out", 1, 1, rc_rewrite_depth_out, NULL},
/* This transformation needs to be done before any of the IF
* instructions are modified. */
{"transform KILP", 1, 1, rc_transform_KILL, NULL},
{"force alpha to one", 1, alpha2one, rc_local_transform, force_alpha_to_one},
{"transform TEX", 1, 1, rc_local_transform, rewrite_tex},
{"transform IF", 1, is_r500, r500_transform_IF, NULL},

View file

@ -569,6 +569,13 @@ static void transform_SUB(struct radeon_compiler* c,
inst->U.I.SrcReg[1] = negate(inst->U.I.SrcReg[1]);
}
static void transform_KILP(struct radeon_compiler * c,
struct rc_instruction * inst)
{
inst->U.I.SrcReg[0] = negate(builtin_one);
inst->U.I.Opcode = RC_OPCODE_KIL;
}
/**
* Can be used as a transformation for @ref radeonClauseLocalTransform,
* no userData necessary.
@ -593,6 +600,7 @@ int radeonTransformALU(
case RC_OPCODE_DP2: transform_DP2(c, inst); return 1;
case RC_OPCODE_DST: transform_DST(c, inst); return 1;
case RC_OPCODE_FLR: transform_FLR(c, inst); return 1;
case RC_OPCODE_KILP: transform_KILP(c, inst); return 1;
case RC_OPCODE_LIT: transform_LIT(c, inst); return 1;
case RC_OPCODE_LRP: transform_LRP(c, inst); return 1;
case RC_OPCODE_POW: transform_POW(c, inst); return 1;
@ -1080,63 +1088,6 @@ int radeonTransformDeriv(struct radeon_compiler* c,
return 1;
}
/**
* IF Temp[0].x -> IF Temp[0].x
* ... -> ...
* KILL -> KIL -abs(Temp[0].x)
* ... -> ...
* ENDIF -> ENDIF
*
* === OR ===
*
* IF Temp[0].x -> IF Temp[0].x
* ... -> ...
* ELSE -> ELSE
* ... -> ...
* KILL -> KIL -abs(Temp[0].x)
* ... -> ...
* ENDIF -> ENDIF
*
* === OR ===
*
* KILL -> KIL -none.1111
*
* This needs to be done in its own pass, because it might modify the
* instructions before and after KILL.
*/
void rc_transform_KILL(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst;
for (inst = c->Program.Instructions.Next;
inst != &c->Program.Instructions; inst = inst->Next) {
struct rc_instruction * if_inst;
unsigned in_if = 0;
if (inst->U.I.Opcode != RC_OPCODE_KILP)
continue;
for (if_inst = inst->Prev; if_inst != &c->Program.Instructions;
if_inst = if_inst->Prev) {
if (if_inst->U.I.Opcode == RC_OPCODE_IF) {
in_if = 1;
break;
}
}
inst->U.I.Opcode = RC_OPCODE_KIL;
if (!in_if) {
inst->U.I.SrcReg[0] = negate(builtin_one);
} else {
/* This should work even if the KILP is inside the ELSE
* block, because -0.0 is considered negative. */
inst->U.I.SrcReg[0] =
negate(absolute(if_inst->U.I.SrcReg[0]));
}
}
}
int rc_force_output_alpha_to_one(struct radeon_compiler *c,
struct rc_instruction *inst, void *data)
{

View file

@ -65,9 +65,6 @@ int radeonTransformDeriv(
struct rc_instruction * inst,
void*);
void rc_transform_KILL(struct radeon_compiler * c,
void *user);
int rc_force_output_alpha_to_one(struct radeon_compiler *c,
struct rc_instruction *inst, void *data);