Skip to content

.pr_agent_accepted_suggestions

qodo-merge-bot edited this page Aug 16, 2026 · 3 revisions
                     PR 3140 (2026-08-14)                    
[correctness] Stale smudge count
Stale smudge count The new early-return path in W3DSmudgeManager::render exits before updating m_smudgeCountLastFrame, so SmudgeManager::getSmudgeCountLastFrame() can return a previous-frame value when there are no smudges/sets. This breaks the contract of a “last frame” counter on frames where the global smudge set is empty.

Issue description

W3DSmudgeManager::render now returns early when there are no smudge sets or no smudges in the global set, but it does so before updating m_smudgeCountLastFrame. This leaves SmudgeManager::getSmudgeCountLastFrame() returning a stale non-zero value on subsequent empty frames.

Issue Context

m_smudgeCountLastFrame is only assigned later in render after the visibility pass. With the new early return, that assignment is skipped entirely.

Fix Focus Areas

  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp[311-317]
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp[429-436]

Proposed fix

Set m_smudgeCountLastFrame = 0; before returning from the new early-return condition (or otherwise ensure it is updated on all return paths that represent “no smudges rendered this frame”).


[reliability] Support check never runs
Support check never runs The early return can prevent testHardwareSupport() from ever being called when the global smudge set remains empty, leaving m_hardwareSupportStatus stuck at SMUDGE_SUPPORT_UNKNOWN. Since getHardwareSupport() treats UNKNOWN as supported, upstream code may keep smudge-related processing enabled even on unsupported hardware until at least one smudge exists.

Issue description

W3DSmudgeManager::render now returns before calling testHardwareSupport() when the smudge-set list is empty or the global set has zero smudges. This can leave m_hardwareSupportStatus as SMUDGE_SUPPORT_UNKNOWN indefinitely, while getHardwareSupport() reports support for all states except SMUDGE_SUPPORT_NO.

Issue Context

  • SmudgeManager initializes m_hardwareSupportStatus to SMUDGE_SUPPORT_UNKNOWN.
  • getHardwareSupport() returns true for UNKNOWN.
  • Multiple call sites gate smudge work on getHardwareSupport().
  • testHardwareSupport() is the codepath that transitions UNKNOWN -> YES/NO.

Fix Focus Areas

  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp[311-320]
  • Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp[203-221]
  • Core/GameEngine/Include/GameClient/Smudge.h[106-113]
  • Core/GameEngine/Source/GameClient/System/Smudge.cpp[36-40]

Proposed fix

Preserve the perf win (skipping Flush/visibility pass/backbuffer copy) while still allowing capability detection by:

  1. Calling testHardwareSupport() before the early-return check (it is effectively one-time work due to internal caching), or
  2. Calling testHardwareSupport() only when m_hardwareSupportStatus == SMUDGE_SUPPORT_UNKNOWN even if returning early. Either approach avoids leaving hardware support permanently UNKNOWN in smudge-free sessions.


Clone this wiki locally