fix(agc-driver): accept per-engine primitive discard in PA_SC_MODE_CNTL_1

Bit 17 of PA_SC_MODE_CNTL_1 (MULTI_SHADER_ENGINE_PRIM_DISCARD_ENABLE)
lets each shader engine drop primitives outside its screen region, a
work distribution setting with no visible effect. Draws with it set were
skipped as unsupported. PPSA12544 sets it (0x06020000, with the already
accepted EOV bits 25 and 26) on the draws that produce its presented
image, so every frame it presented was black.

AI-assisted: yes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Merijn
2026-10-06 10:41:54 +02:00
parent 481c85e7c9
commit ef10a36b8a
2 changed files with 8 additions and 1 deletions
@@ -67,7 +67,7 @@ constexpr std::uint32_t DepthControlMask = ~0x007007f0u;
constexpr std::uint32_t ShaderControlMask = ~(0x0000f870u | 0x00020600u);
constexpr std::uint32_t AlphaToCoverageMask = ~0x0001ff00u;
constexpr std::uint32_t ScanModeMask = ~2u;
constexpr std::uint32_t ScanControlMask = ~0x06003fffu;
constexpr std::uint32_t ScanControlMask = ~0x06023fffu;
constexpr std::uint32_t ScreenOffsetMask = ~0x01ff01ffu;
// Bits 26/27 (ZCLIP_NEAR/FAR_DISABLE) become depth clamping; bit 19 selects the [0, 1] clip space.
constexpr std::uint32_t ClipControlMask = ~(0x80000u | 0x01000000u | 0x0c000000u);
@@ -108,6 +108,13 @@ void stateTests() {
queue.context[0x103] = 5;
Require(AgcDriver::Graphics::DrawRejection(queue, true).find("all ones") != std::string::npos, "a restart index other than all ones was accepted");
queue = makeState();
queue.context[0x293] = 0x06020000u;
(void)AgcDriver::Graphics::DecodeState(queue);
Require(AgcDriver::Graphics::DrawRejection(queue, false).find("sample iteration") == std::string::npos, "per-engine primitive discard was rejected");
queue.context[0x293] = 0x06030000u;
Require(AgcDriver::Graphics::DrawRejection(queue, false).find("sample iteration") != std::string::npos, "per-sample shading was accepted");
expectFailure([&] { AgcDriver::Graphics::DecodeState(queue); }, "sample iteration");
queue = makeState();
queue.userConfig.erase(0x24b);
queue.context[0x2a5] = 0;
expectFailure([&] { AgcDriver::Graphics::DecodeState(queue); }, "user-config bank at DWORD 0x24b");