Merge pull request #1414 from TheAggie/fix/agc-color-control-disable

fix(agc): render CB_COLOR_CONTROL mode disable as a draw without color
This commit is contained in:
Adrià 2026-10-08 15:16:42 +02:00 committed by GitHub
commit 83c57cb8fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -273,7 +273,7 @@ std::uint32_t effectiveDepthControl(std::uint32_t depthControl) {
bool colorControlSupported(std::uint32_t colorControl, bool hasColorTarget) {
colorControl &= ~1u;
return colorControl == 0xcc0010u || (!hasColorTarget && (colorControl & ~0x70u) == 0xcc0000u);
return colorControl == 0xcc0010u || ((colorControl >> 4u) & 7u) == 0u || (!hasColorTarget && (colorControl & ~0x70u) == 0xcc0000u);
}
std::string colorControlMessage(std::uint32_t colorControl) {
@ -570,6 +570,7 @@ State DecodeState(const QueueState& queue) {
for (std::uint32_t index = 0; index < exportSlots.size(); ++index) {
if (written(exportSlots[index])) exportCount = index + 1;
}
if (((read(cx, 0x202) >> 4u) & 7u) == 0u) exportCount = 0;
result.hasColorTarget = exportCount != 0;
APS5_LOG_OUT_DEBUG("hasColorTarget=%u exports=%u", result.hasColorTarget ? 1u : 0u, exportCount);

View File

@ -607,6 +607,13 @@ void DisabledColorTests() {
queue.context[0x00b] = std::bit_cast<std::uint32_t>(1.0f);
const auto depthOnly = AgcDriver::Graphics::DecodeState(queue);
Require(!depthOnly.hasColorTarget && depthOnly.depth && depthOnly.depthTest && depthOnly.depthWrite && depthOnly.renderExtent.height == 64, "COLOR_INVALID discarded a depth-only draw");
for (const auto colorControl : {0x0u, 0xcc0000u}) {
queue = makeState();
queue.context[0x202] = colorControl;
const auto unwritten = AgcDriver::Graphics::DecodeState(queue);
Require(!unwritten.hasColorTarget && unwritten.colors.empty() && unwritten.color.address == 0, "CB_COLOR_CONTROL mode disable kept a color attachment");
Require(unwritten.renderExtent.width == 64 && unwritten.renderExtent.height == 4, "CB_COLOR_CONTROL mode disable lost the screen scissor extent");
}
}
void TuningFieldTests() {