Merge pull request #4076 from Nesyth/fix/agc-cb-metadata-pass-without-depth-planes

fix(agc): accept a CB metadata pass beside depth state without depth or stencil planes
This commit is contained in:
Dean 2026-10-12 23:47:38 +13:00 committed by GitHub
commit 52973f89db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -1087,7 +1087,7 @@ std::optional<ColorMetadataPass> DecodeColorMetadataPass(const QueueState& queue
if (mode != 2u && mode != 6u && !resolve) return std::nullopt;
ColorMetadataPass pass{resolve ? ColorMetadataPass::Mode::Resolve : mode == 2u ? ColorMetadataPass::Mode::EliminateFastClear : ColorMetadataPass::Mode::DccDecompress, {}, std::nullopt};
Require((control->second & ~0x70u) == 0xcc0000u, "CB metadata pass with a nonstandard ROP, dual quads disabled or degamma");
Require((read(cx, 0x200) & 0xfu) == 0 && (read(cx, 0x0) & 0xfu) == 0, "CB metadata pass with depth or stencil work");
Require(depthPlanesAbsent(cx) || ((read(cx, 0x200) & 0xfu) == 0 && (read(cx, 0x0) & 0xfu) == 0), "CB metadata pass with depth or stencil work");
const auto samples = resolve ? decodeSamples(cx) : 1u;
if (!resolve) zero(cx, 0x2f8, ~0u, "multisampling or coverage conversion");
zero(cx, 0x80, ~0u, "window offset");

View File

@ -1527,6 +1527,23 @@ void metadataPassTests() {
queue.context[0x202] = 0xcc0060;
queue.context[0x200] = 2;
expectFailure([&] { DecodeColorMetadataPass(queue); }, "depth or stencil work");
queue.context[0x10] = 0x80000180;
queue.context[0x11] = 0x20000180;
queue.context[0x200] = 0x700763;
queue.context[0x0] = 0x20;
Require(DecodeColorMetadataPass(queue).has_value(), "depth and stencil state without depth or stencil planes refused the pass");
queue.context[0x10] = 0x80000183;
expectFailure([&] { DecodeColorMetadataPass(queue); }, "depth or stencil work");
queue.context[0x10] = 0x80000180;
queue.context[0x11] = 0x20000181;
expectFailure([&] { DecodeColorMetadataPass(queue); }, "depth or stencil work");
queue.context[0x11] = 0x20000180;
queue.context.erase(0x200);
queue.context.erase(0x0);
Require(DecodeColorMetadataPass(queue).has_value(), "unwritten depth and render control refused a pass without depth or stencil planes");
queue.context.erase(0x10);
queue.context.erase(0x11);
queue.context[0x0] = 0;
queue.context[0x200] = 0x70;
Require(DecodeColorMetadataPass(queue).has_value(), "an always-pass depth function without a test refused the pass");
queue.context[0x91] = 0x40020;