bugfix(dx8): Improve display mode transition reliability#2539
bugfix(dx8): Improve display mode transition reliability#2539xezon merged 3 commits intoTheSuperHackers:mainfrom
Conversation
- Defer Render2D resolution update until after successful D3D reset - Snapshot current mode before Set_Device_Resolution for correct rollback - Fix fullscreen window failing to cover desktop by removing SWP_NOSIZE/NOMOVE - Remove dead D3DInterface release block in Shutdown
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | Snapshots pre-change resolution values before calling Set_Device_Resolution to ensure rollback uses correct original state on failure |
| Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | Defers Render2D resolution update to after successful D3D reset; fixes SetWindowPos silently discarding size/position via SWP_NOSIZE |
| GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | Mirrors Generals fix: snapshots pre-change resolution values to fix incorrect rollback on failed mode switch |
| GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | Mirrors Generals fix: defers Render2D update, fixes SetWindowPos flags, removes dead D3DInterface release in Shutdown |
Sequence Diagram
sequenceDiagram
participant WD as W3DDisplay
participant WW3D as WW3D
participant DX8 as DX8Wrapper
participant R2D as Render2DClass
participant WIN as Win32 SetWindowPos
WD->>WD: Snapshot oldWidth/Height/BitDepth/Windowed
WD->>WW3D: Set_Device_Resolution(xres, yres, ...)
WW3D->>DX8: Set_Render_Device(...)
DX8->>WIN: SetWindowPos(HWND_TOPMOST, 0, 0, w, h, flags=0)
Note over WIN: SWP_NOSIZE|SWP_NOMOVE removed — size+position now applied
DX8->>DX8: Reset_Device() / Create_Device()
alt D3D reset succeeds (ret=true)
DX8->>R2D: Set_Screen_Resolution(w, h)
DX8-->>WW3D: ret=true
WW3D-->>WD: WW3D_ERROR_OK
WD->>R2D: Set_Screen_Resolution(xres, yres)
WD->>WD: Display::setDisplayMode(xres, yres)
WD-->>WD: return TRUE
else D3D reset fails (ret=false)
Note over DX8: Render2D NOT updated (deferred guard)
DX8-->>WW3D: ret=false
WW3D-->>WD: error
WD->>WW3D: Set_Device_Resolution(oldWidth, oldHeight, ...)
WD->>R2D: Set_Screen_Resolution(oldWidth, oldHeight)
WD->>WD: Display::setDisplayMode(oldWidth, oldHeight)
WD-->>WD: return FALSE
end
Reviews (3): Last reviewed commit: "unfancied const" | Re-trigger Greptile
xezon
left a comment
There was a problem hiding this comment.
Code looks ok.
So this change fixes 4 issues. The title is not so clear about what this fixes. It is unclear what "corner rendering" refers to. Can it be clearer?
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
Outdated
Show resolved
Hide resolved
|
Changed the title to "bugfix(dx8): Improve display mode transition reliability" and switched to standard styling |
This PR addresses stability issues in the resolution switching logic.
These changes particularly improve stability when running under Wine but also resolve rare race conditions on native Windows.