bugfix(rendering): Fix Microwave Heat Haze blackout on forced AA#2374
bugfix(rendering): Fix Microwave Heat Haze blackout on forced AA#2374githubawn wants to merge 5 commits intoTheSuperHackers:mainfrom
Conversation
Co-authored-by: stm <[email protected]>
|
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
Outdated
Show resolved
Hide resolved
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|
Maybe we can accurately tell if MSAA was forced with some of the changes in #1073 like below, and use that in place of Do you know if the RTT path is much faster when MSAA is off compared to copyRects? Is it worth the extra complexity to support both? |
To find this bug I tested a benchmark, but the test ran differently on different vendors, is this needed?
I tried benchmarking them, but the game lacks robust benchmarking tools. Using CapFrameX with a DX8 bridge means we’re mostly benchmarking the wrapper’s translation overhead; there’s too much fluctuation between runs to see a real difference between RTT and copyRects. It might be worth keeping both around in case we move to a native DX9 base where RTT isn't broken? |
If you're up for it you could give #2202 a try; add a zone in the smudge code, then do a testrun on a replay or something that's kinda reproduceable. Tracy can compare histograms of zones between two different captures |
|
I actually tried to set this up by bringing the Tracy profiling (#2202) into this branch to compare them. Looking at the traces, the overall render zone copy is almost invisible below PassDefault in both pathways. The smudge rendering is incredibly fast either way. I added the detail zones and did a direct comparison between the RTT and CopyRects (smudge copy) pathways. A true 1:1 benchmark would require reverting to a pre-safety commit, reapplying Tracy, and resolving build conflicts, which I've partially done but found overly time intensive. Given the minimal frame time impact, I think CopyRects is sufficient here, but if you have ideas for a cleaner benchmark setup, I'm happy to iterate. These are the results:
|
I will take a look at this soon |
There was a problem hiding this comment.
I can confirm that it also fixes the Smudge on my machine (AMD Video Card). Very nice.
I did a very basic performance comparison between before and after fix with 35 Microwave tanks in an otherwise empty scene.
Before: ~230 FPS
After: ~230 FPS
I think we need to not worry about performance for now. The Microwave tank is also not a unit that is spammed much.
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp
Outdated
Show resolved
Hide resolved
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
Outdated
Show resolved
Hide resolved
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp
Outdated
Show resolved
Hide resolved
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
Outdated
Show resolved
Hide resolved
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
Outdated
Show resolved
Hide resolved
Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DSmudge.cpp
Outdated
Show resolved
Hide resolved
|
Title needs updating because it is not Nvidia specific bug. |
| #include "stringex.h" | ||
| #include <Utility/stdio_adapter.h> | ||
|
|
||
| #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } |
There was a problem hiding this comment.
SAFE_RELEASE macro is moved from its local definition in W3DWater.cpp to the global WWCommon.h header without a redefinition guard. If any other header file defines SAFE_RELEASE before this one is processed, it will trigger a macro-redefinition warning or error (especially with -Werror). Add a guard:
| #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } | |
| #ifndef SAFE_RELEASE | |
| #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } } | |
| #endif |
Prompt To Fix With AI
This is a comment left during a code review.
Path: Core/Libraries/Source/WWVegas/WWLib/WWCommon.h
Line: 26
Comment:
`SAFE_RELEASE` macro is moved from its local definition in `W3DWater.cpp` to the global `WWCommon.h` header without a redefinition guard. If any other header file defines `SAFE_RELEASE` before this one is processed, it will trigger a macro-redefinition warning or error (especially with `-Werror`). Add a guard:
```suggestion
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=nullptr; } }
#endif
```
How can I resolve this? If you propose a fix, please make it concise.




This PR aims to resolve the black screen bug caused by driver-forced MSAA, continuing and refining the work started in #1073.
The Bug: When users force MSAA via their driver control panel, the driver secretly upgrades the depth buffer to be multisampled. However, the Direct3D 8 API still reports MultiSampleType=NONE for created textures. When ScreenDefaultFilter attempts to use Render-To-Texture (RTT), it binds a non-MSAA texture to this secretly-MSAA depth buffer. This surface mismatch is a D3D API violation that silently breaks depth testing, resulting in a black screen.
This PR fixes the issue by permanently disabling the RTT path inside ScreenDefaultFilter::preRender (falling back to the CopyRects smudge path).