Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);

Expand Down
7 changes: 7 additions & 0 deletions core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading