chore: Remove unused code in dx8wrapper#2504
Conversation
stephanmeesters
commented
Mar 30, 2026
- related to unify(ww3d2): Merge dx8wrapper, dx8caps, shdlib #2499
|
| Filename | Overview |
|---|---|
| Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h | Removes unused static members (old_world/old_view/old_prj, Render_Info), dead declarations (Peek_Light, Is_Light_Enabled, Validate_Device), empty macros (prevVer/nextVer), and the obfuscated flimby() helper — all unreachable code. |
| Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | Removes static definitions for old_world/old_view/old_prj and Render_Info, their ZeroMemory initialisation in Init(), and the never-called Validate_Device() implementation. |
| GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.h | Same dead-code removals as the Generals counterpart, plus removal of the Set_DX8_ZBias inline, its declaration, and the now-redundant ZTextureClass/DX8Caps forward declarations (both types are already fully defined via texture.h / dx8caps.h includes). |
| GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8wrapper.cpp | Removes same dead static members as Generals, plus the file-scope DesktopMode variable (declared but never read or written); all removals are safe. |
| GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8renderer.cpp | Removes already-commented-out ZBias calls and surrounding blank lines; no functional change. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Removed["Removed Dead Code"]
A["old_world / old_view / old_prj\n(D3DMATRIX static members)"]
B["Render_Info\n(RenderInfoClass* static member)"]
C["DesktopMode\n(D3DDISPLAYMODE, GeneralsMD only)"]
D["Validate_Device()\n(never called)"]
E["Peek_Light() / Is_Light_Enabled()\n(never called)"]
F["Set_DX8_ZBias()\n(all call-sites commented out)"]
G["flimby()\n(only call-site commented out)"]
H["#define prevVer / nextVer\n(only used by flimby)"]
end
subgraph Retained["Retained (pre-existing dead state)"]
I["ZBias member\n(always 0; read in Set_Projection_Transform_With_Z_Bias)"]
end
F -->|"was the only setter for"| I
G -->|"depended on"| H
Reviews (3): Last reviewed commit: "chore(ww3d2): Remove unused Validate_Dev..." | Re-trigger Greptile
2e4b483 to
7142e33
Compare
| static unsigned Get_Last_Frame_Render_State_Changes(); | ||
| static unsigned Get_Last_Frame_Texture_Stage_State_Changes(); | ||
| static unsigned Get_Last_Frame_DX8_Calls(); | ||
| static unsigned Get_Last_Frame_Draw_Calls(); |
There was a problem hiding this comment.
This block was likely added for debugging purposes. Having insights to draw calls is generally a useful thing to have. Why do you want to remove it?
It does not make sense to remove this while keeping End_Statistics
Instead of removing, this could be simplified to return a statistics struct and therefore just be one function call.
There was a problem hiding this comment.
Might have nuked these a bit too quick on the basis of them being unused.
Get_Last_Frame_Draw_Calls has an equivalent in W3DDisplay and can be toggled with -displayDebug in the win32-debug profile.
I'll do the statistics struct in another PR. See #2507. Removed the commit from current PR
7142e33 to
bfa6e67
Compare