bugfix(dx8): Fix corner rendering and resolution switching rollback#2539
bugfix(dx8): Fix corner rendering and resolution switching rollback#2539githubawn wants to merge 1 commit 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 current display mode before resolution switch attempt, fixing incorrect rollback values when Set_Render_Device overwrites resolution state early |
| Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | Defers Render2D resolution update to post-success D3D reset, fixes fullscreen window sizing (SWP_NOSIZE |
| GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp | Mirror of Generals fix: snapshots display mode before Set_Device_Resolution for correct rollback in Zero Hour code |
| GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | Mirror of Generals fix: deferred Render2D update, correct fullscreen window sizing, and dead code removal in Zero Hour code |
Sequence Diagram
sequenceDiagram
participant W3D as W3DDisplay
participant WW3D as WW3D
participant DX8 as DX8Wrapper
participant R2D as Render2DClass
Note over W3D: Snapshot oldWidth/oldHeight/oldBitDepth/oldWindowed
W3D->>WW3D: Set_Device_Resolution(xres, yres, bitdepth, windowed)
WW3D->>DX8: Set_Render_Device(width, height, bits, windowed, ...)
Note over DX8: Writes new values to ResolutionWidth/Height (always)
DX8->>DX8: Resize_And_Position_Window() [SetWindowPos with correct flags]
DX8->>DX8: Reset_Device() or Create_Device()
alt D3D reset SUCCESS (ret == true)
DX8->>R2D: Set_Screen_Resolution(ResolutionWidth, ResolutionHeight)
DX8-->>WW3D: true
WW3D-->>W3D: WW3D_ERROR_OK
W3D->>R2D: Set_Screen_Resolution(xres, yres)
W3D->>W3D: Display::setDisplayMode(xres, yres, ...)
W3D-->>W3D: return TRUE
else D3D reset FAILED (ret == false)
Note over DX8: Render2DClass NOT updated
DX8-->>WW3D: false
WW3D-->>W3D: error
Note over W3D: Use snapshots for rollback (not stale getters)
W3D->>WW3D: Set_Device_Resolution(oldWidth, oldHeight, ...)
W3D->>R2D: Set_Screen_Resolution(oldWidth, oldHeight)
W3D->>W3D: Display::setDisplayMode(oldWidth, oldHeight, ...)
W3D-->>W3D: return FALSE
end
Reviews (1): Last reviewed commit: "dx8: Fix resolution switching, windowing..." | Re-trigger Greptile
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.