-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate DX8 wrapper to DX9 following OpenW3D PR #17 approach #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…proach TheSuperHackers @feature JohnsterID 14/09/2025 Core changes: - Updated dx8wrapper.h: d3d8.h→d3d9.h, all DX8 API types→DX9 equivalents - Updated dx8wrapper.cpp: Direct3DCreate8→Direct3DCreate9, D3D8.DLL→D3D9.DLL - Updated dx8caps.h: D3DCAPS8→D3DCAPS9, D3DADAPTER_IDENTIFIER8→D3DADAPTER_IDENTIFIER9 API compatibility fixes: - D3DRS_ZBIAS → D3DRS_DEPTHBIAS with proper float conversion - D3DENUM_NO_WHQL_LEVEL → 0 (removed in DX9) - SetGammaRamp: added swapchain index parameter (0) - ResourceManagerDiscardBytes: commented out (removed in DX9) - Texture stage states → sampler states: D3DTSS_ADDRESSU→D3DSAMP_ADDRESSU Deprecated constants removed: - D3DRS_SOFTWAREVERTEXPROCESSING, D3DRS_LINEPATTERN, D3DRS_ZVISIBLE - D3DRS_EDGEANTIALIAS, D3DRS_PATCHSEGMENTS - D3DTSS_ADDRESSU/V/W, D3DTSS_MAGFILTER, D3DTSS_MINFILTER, etc. Build system: - Added cmake/dx9.cmake with madebr/min-dx9-sdk reference - Added cmake/mingw-w64-i686.cmake for cross-compilation Maintains existing DX8Wrapper class names for minimal code impact. Follows OpenW3D PR TheSuperHackers#17 migration patterns for compatibility.
TheSuperHackers @feature JohnsterID 14/09/2025 - Updated assetmgr.cpp debug format strings: D3DFMT_X8R8G8B8 → D3DFMT_A8R8G8B8 - Updated formconv.cpp format conversion table: WW3D_FORMAT_X8R8G8B8 maps to D3DFMT_A8R8G8B8 - Maintains backward compatibility through wrapper layer - Follows OpenW3D PR TheSuperHackers#17 texture format migration approach
|
Fix BrowserEngine Linux compatibility with cross-platform COM support: db106a4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it possible to not break Direct X 8, simply make Direct X 9 a compile switch?
|
You want to seperate out the directx 9 into it's own files instead of just altering the directx8 within directx8 named files, keep them as two parallel code bases. Doing this can then be a starting point for implementing a higher level interface that can then let us switch between DX8 and DX9 to test the interface before branching to any other graphics API's as we should have two working DX codebases at that point. |
- Fixed MinGW-w64 compatibility by changing #ifdef to #if for RTS_USE_DIRECTX9 macro - Fixed DirectX header conflicts in dx8caps.h with conditional inclusion - Fixed corrupted DirectX 8 SDK file (dxfile.h EOF character) - Simplified dx9.cmake to match dx8.cmake pattern for reliability - DirectX 8 remains default (RTS_USE_DIRECTX9=OFF), DirectX 9 enabled with RTS_USE_DIRECTX9=ON - Both configurations successfully compile and fetch appropriate DirectX SDKs - Uses proper MinGW-w64 headers, avoids stubs, follows project guidelines - Restored accidentally deleted Dependencies files (MaxSDK, Utility) - Simplified DirectX approach using d3d8lib alias instead of complex unified interface - Reverted unnecessary changes to CMakeLists.txt files for cleaner implementation - Fixed circular dependency bug in main CMakeLists.txt
8e25e05 to
740f774
Compare
|
Added compile-time selection attempt will look at other comments as soon as I can. |
Use conditional compilation to properly handle X8R8G8B8 format mapping: - DX8: WW3D_FORMAT_X8R8G8B8 -> D3DFMT_X8R8G8B8 (native format) - DX9: WW3D_FORMAT_X8R8G8B8 -> D3DFMT_A8R8G8B8 (X8R8G8B8 not available) This eliminates the confusing duplicate array entry while maintaining correct format mapping for both DirectX versions.
Summary
This PR migrates the DirectX 8 wrapper to DirectX 9 following the minimal changes approach from w3dhub/OpenW3D#17. The migration maintains backward compatibility by keeping existing DX8Wrapper class names while updating the underlying API calls to use DirectX 9.
Changes Made
Core Wrapper Migration
dx8wrapper.h: Updated all DirectX 8 types to DirectX 9 equivalents
IDirect3D8→IDirect3D9IDirect3DDevice8→IDirect3DDevice9D3DLIGHT8→D3DLIGHT9D3DMATERIAL8→D3DMATERIAL9D3DVIEWPORT8→D3DVIEWPORT9dx8wrapper.cpp: Updated implementation to use DX9 API
Direct3DCreate8→Direct3DCreate9D3D8.DLL→D3D9.DLLdx8caps.h: Updated capability structures
D3DCAPS8→D3DCAPS9D3DADAPTER_IDENTIFIER8→D3DADAPTER_IDENTIFIER9Format and Constant Updates
D3DFMT_X8R8G8B8→D3DFMT_A8R8G8B8D3DRS_ZBIAS→D3DRS_DEPTHBIAS(handled internally by wrapper)formconv.cppassetmgr.cppBuild System
cmake/dx9.cmakewith reference tomadebr/min-dx9-sdkTesting
Compatibility
Implementation Notes
Related Issues
Commits
4831e52d: Core DX8 wrapper migration to DX904be58c4: Updated texture format references for DX9 compatibilityTheSuperHackers @feature JohnsterID 14/09/2025