Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VertexManagerBase: Skip drawing objects with mismatched xf/bp stages #8717

Merged
merged 2 commits into from
Apr 21, 2020
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
24 changes: 12 additions & 12 deletions Source/Core/Core/Analytics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,18 @@ void DolphinAnalytics::ReportGameStart()
}

// Keep in sync with enum class GameQuirk definition.
constexpr std::array<const char*, 10> GAME_QUIRKS_NAMES{
"icache-matters",
"directly-reads-wiimote-input",
"uses-DVDLowStopLaser",
"uses-DVDLowOffset",
"uses-DVDLowReadDiskBca",
"uses-DVDLowRequestDiscStatus",
"uses-DVDLowRequestRetryNumber",
"uses-DVDLowSerMeasControl",
"uses-different-partition-command",
"uses-di-interrupt-command",
};
constexpr std::array<const char*, 12> GAME_QUIRKS_NAMES{"icache-matters",
"directly-reads-wiimote-input",
"uses-DVDLowStopLaser",
"uses-DVDLowOffset",
"uses-DVDLowReadDiskBca",
"uses-DVDLowRequestDiscStatus",
"uses-DVDLowRequestRetryNumber",
"uses-DVDLowSerMeasControl",
"uses-different-partition-command",
"uses-di-interrupt-command",
"mismatched-gpu-texgens-between-xf-and-bp",
"mismatched-gpu-colors-between-xf-and-bp"};
static_assert(GAME_QUIRKS_NAMES.size() == static_cast<u32>(GameQuirk::COUNT),
"Game quirks names and enum definition are out of sync.");

Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/Analytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ enum class GameQuirk
// (DVDLowClearCoverInterrupt is used, though)
USES_DI_INTERRUPT_MASK_COMMAND,

// Some games configure a mismatched number of texture coordinates or colors between the transform
// and TEV/BP stages of the rendering pipeline. Currently, Dolphin just skips over these objects
// as the hardware renderers are not equipped to handle the case where the registers between
// stages are mismatched.
MISMATCHED_GPU_TEXGENS_BETWEEN_XF_AND_BP,
MISMATCHED_GPU_COLORS_BETWEEN_XF_AND_BP,

COUNT,
};

Expand Down
26 changes: 26 additions & 0 deletions Source/Core/VideoCommon/VertexManagerBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Common/Logging/Log.h"
#include "Common/MathUtil.h"

#include "Core/Analytics.h"
#include "Core/ConfigManager.h"

#include "VideoCommon/BPMemory.h"
Expand Down Expand Up @@ -344,6 +345,31 @@ void VertexManagerBase::Flush()

m_is_flushed = true;

if (xfmem.numTexGen.numTexGens != bpmem.genMode.numtexgens ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it hurt that this block (which can early return) is after m_is_flushed = true ?

Copy link
Contributor Author

@stenzek stenzek Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we want to skip the object, i.e. set it as flushed.

xfmem.numChan.numColorChans != bpmem.genMode.numcolchans)
{
ERROR_LOG(VIDEO,
"Mismatched configuration between XF and BP stages - %u/%u texgens, %u/%u colors. "
"Skipping draw. Please report on the issue tracker.",
xfmem.numTexGen.numTexGens, bpmem.genMode.numtexgens.Value(),
xfmem.numChan.numColorChans, bpmem.genMode.numcolchans.Value());

// Analytics reporting so we can discover which games have this problem, that way when we
// eventually simulate the behavior we have test cases for it.
if (xfmem.numTexGen.numTexGens != bpmem.genMode.numtexgens)
{
DolphinAnalytics::Instance().ReportGameQuirk(
GameQuirk::MISMATCHED_GPU_TEXGENS_BETWEEN_XF_AND_BP);
}
if (xfmem.numChan.numColorChans != bpmem.genMode.numcolchans)
{
DolphinAnalytics::Instance().ReportGameQuirk(
GameQuirk::MISMATCHED_GPU_TEXGENS_BETWEEN_XF_AND_BP);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be MISMATCHED_GPU_COLORS_BETWEEN_XF_AND_BP?

}

return;
}

#if defined(_DEBUG) || defined(DEBUGFAST)
PRIM_LOG("frame%d:\n texgen=%u, numchan=%u, dualtex=%u, ztex=%u, cole=%u, alpe=%u, ze=%u",
g_ActiveConfig.iSaveTargetId, xfmem.numTexGen.numTexGens, xfmem.numChan.numColorChans,
Expand Down