mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-27 16:02:37 +00:00
shader: retain bounded scalar material image selectors
This commit is contained in:
1 parent
71c7261740
commit
973809cde0
4 files changed
+247
-19
No files matched your search
@@ -742,7 +742,9 @@ void TestBoundedComputeImageLoop() {
|
||||
enum class Variant {
|
||||
Bounded, Plain, Nonzero, TrueEdge, WrongGuard, EntryBypass, ExitBypass, GuardBlock,
|
||||
WrongStep, DivergentBound, DivergentKey, Disjunction, WrongPolarity,
|
||||
IncrementBypass, PreviousBound, Masked, MaskedWrongGuard, MaskResurrection, StatusOverwrite,
|
||||
IncrementBypass, PreviousBound, Forwarded, ForwardedChain, ForwardedJoin,
|
||||
ForwardedBranch, ForwardedIncrementBypass,
|
||||
Masked, MaskedWrongGuard, MaskResurrection, StatusOverwrite,
|
||||
GuardedDiamond, GuardedDiamondBypass
|
||||
};
|
||||
const auto make_plan = [](Variant variant) {
|
||||
@@ -759,16 +761,21 @@ void TestBoundedComputeImageLoop() {
|
||||
auto *guard = masked ? fixture.AddBlock() : header;
|
||||
auto *increment = masked ? fixture.AddBlock() : latch;
|
||||
auto *final_exit = variant == Variant::PreviousBound ? fixture.AddBlock() : exit;
|
||||
const bool forwarded = variant >= Variant::Forwarded && variant <= Variant::ForwardedIncrementBypass;
|
||||
auto *forward = forwarded ? fixture.AddBlock() : increment;
|
||||
auto *incoming = variant == Variant::ForwardedChain ? fixture.AddBlock() : forward;
|
||||
auto *detour = variant == Variant::ForwardedJoin ? fixture.AddBlock() : nullptr;
|
||||
entry->AddBranch(header);
|
||||
if (!masked) {
|
||||
header->AddBranch(exit);
|
||||
header->AddBranch(body);
|
||||
body->AddBranch(latch);
|
||||
latch->AddBranch(header);
|
||||
latch->AddBranch(forwarded ? forward : header);
|
||||
if (variant == Variant::PreviousBound) latch->AddBranch(final_exit);
|
||||
if (variant == Variant::EntryBypass) entry->AddBranch(body);
|
||||
if (variant == Variant::ExitBypass) exit->AddBranch(body);
|
||||
if (variant == Variant::IncrementBypass || variant == Variant::PreviousBound)
|
||||
if (variant == Variant::IncrementBypass || variant == Variant::PreviousBound ||
|
||||
variant == Variant::ForwardedIncrementBypass)
|
||||
exit->AddBranch(latch);
|
||||
fixture.program.blocks[0]->terminator = {
|
||||
.kind = variant == Variant::EntryBypass
|
||||
@@ -789,16 +796,16 @@ void TestBoundedComputeImageLoop() {
|
||||
.kind = variant == Variant::PreviousBound
|
||||
? CFG::TerminatorKind::ConditionalBranch
|
||||
: CFG::TerminatorKind::Branch,
|
||||
.true_block = fixture.program.blocks[1u],
|
||||
.true_block = forwarded ? forward : fixture.program.blocks[1u],
|
||||
.false_block = final_exit};
|
||||
fixture.program.blocks[4]->terminator = {
|
||||
.kind = final_exit != exit || variant == Variant::ExitBypass ||
|
||||
variant == Variant::IncrementBypass
|
||||
variant == Variant::IncrementBypass || variant == Variant::ForwardedIncrementBypass
|
||||
? CFG::TerminatorKind::Branch
|
||||
: CFG::TerminatorKind::Return,
|
||||
.true_block =
|
||||
fixture.program.blocks[final_exit != exit ||
|
||||
variant == Variant::IncrementBypass
|
||||
variant == Variant::IncrementBypass || variant == Variant::ForwardedIncrementBypass
|
||||
? 3u
|
||||
: 2u]};
|
||||
if (final_exit != exit)
|
||||
@@ -822,6 +829,29 @@ void TestBoundedComputeImageLoop() {
|
||||
count}, 0, compare);
|
||||
const auto initial_active = fixture.Emit(ValueOpcode::INotEqual32,
|
||||
{local, Value(0u)}, 0, entry);
|
||||
if (forwarded) {
|
||||
forward->AddBranch(incoming == forward ? header : incoming);
|
||||
forward->terminator = {.kind = CFG::TerminatorKind::Branch,
|
||||
.true_block = incoming == forward ? header : incoming};
|
||||
if (incoming != forward) {
|
||||
incoming->AddBranch(header);
|
||||
incoming->terminator = {.kind = CFG::TerminatorKind::Branch, .true_block = header};
|
||||
}
|
||||
if (variant == Variant::ForwardedBranch) {
|
||||
forward->AddBranch(exit);
|
||||
forward->condition = initial_active;
|
||||
forward->terminator = {.kind = CFG::TerminatorKind::ConditionalBranch,
|
||||
.true_block = header, .false_block = exit};
|
||||
}
|
||||
if (detour != nullptr) {
|
||||
latch->AddBranch(detour);
|
||||
latch->condition = initial_active;
|
||||
latch->terminator = {.kind = CFG::TerminatorKind::ConditionalBranch,
|
||||
.true_block = forward, .false_block = detour};
|
||||
detour->AddBranch(forward);
|
||||
detour->terminator = {.kind = CFG::TerminatorKind::Branch, .true_block = forward};
|
||||
}
|
||||
}
|
||||
if (masked) {
|
||||
auto *active_phi = diamond ? nullptr : &header->AppendNewInst(
|
||||
ValueOpcode::Phi, {}, static_cast<uint64_t>(Type::U1));
|
||||
@@ -934,7 +964,9 @@ void TestBoundedComputeImageLoop() {
|
||||
{key, Value(variant == Variant::WrongStep ? 2u : 1u)},
|
||||
0, increment);
|
||||
phi.AddPhiOperand(entry, variant == Variant::DivergentKey ? local : Value(0u));
|
||||
phi.AddPhiOperand(increment, step);
|
||||
phi.AddPhiOperand(forwarded ? incoming : increment, step);
|
||||
Check(!forwarded || step.ResolveInstruction()->Parent() != phi.PhiBlock(1),
|
||||
"forwarded loop fixture did not separate the increment from its Phi incoming edge");
|
||||
|
||||
fixture.block = variant == Variant::GuardBlock ? header : body;
|
||||
const auto table = fixture.Address(fixture.UserData(0), fixture.UserData(1));
|
||||
@@ -975,7 +1007,11 @@ void TestBoundedComputeImageLoop() {
|
||||
make_plan(Variant::TrueEdge);
|
||||
make_plan(Variant::Masked);
|
||||
make_plan(Variant::GuardedDiamond);
|
||||
make_plan(Variant::Forwarded);
|
||||
make_plan(Variant::ForwardedChain);
|
||||
for (const auto variant : {Variant::IncrementBypass, Variant::PreviousBound,
|
||||
Variant::ForwardedJoin, Variant::ForwardedBranch,
|
||||
Variant::ForwardedIncrementBypass,
|
||||
Variant::MaskedWrongGuard,
|
||||
Variant::MaskResurrection, Variant::StatusOverwrite,
|
||||
Variant::GuardedDiamondBypass}) {
|
||||
|
||||
Reference in new issue
Block a user