When compiling DXVK 2.6 with the latest Clang toolchain (llvm-mingw-20250319), the build fails due to a redefinition of the _D3DDEVINFO_RESOURCEMANAGER structure. This structure is now properly defined in the system headers included with the newer Clang toolchain, but DXVK also defines it in its own codebase, causing a conflict.
Error Message
In file included from ../../dxvk/src/dxso/dxso_util.cpp:1:
In file included from ../../dxvk/src/dxso/dxso_util.h:8:
In file included from ../../dxvk/src/dxso/../d3d9/d3d9_caps.h:3:
../../dxvk/src/dxso/../d3d9/d3d9_include.h:49:16: error: redefinition of '_D3DDEVINFO_RESOURCEMANAGER'
49 | typedef struct _D3DDEVINFO_RESOURCEMANAGER
| ^
/opt/llvm-mingw/llvm-mingw-20250319-msvcrt-ubuntu-20.04-x86_64/x86_64-w64-mingw32/include/d3d9types.h:1369:16: note: previous definition is here
1369 | typedef struct _D3DDEVINFO_RESOURCEMANAGER {
| ^
1 error generated.
Set up the build environment with the latest llvm-mingw toolchain (20250319 or newer)
Run the build process
Observe the compilation error in the dxso_util.cpp file
Analysis
The issue occurs because:
Newer versions of the MinGW headers (specifically d3d9types.h) now include a definition for _D3DDEVINFO_RESOURCEMANAGER
DXVK has its own definition of this structure in d3d9_include.h (line 49)
When compiling with the latest toolchain, both definitions conflict
This appears to be a backward compatibility issue where DXVK previously needed to define this structure because it was missing or incomplete in older headers.
Proposed Fix by AI
Add preprocessor guards around the structure definition in d3d9_include.h to only define it if it's not already defined in the system headers:
Alternatively, check if the structure is defined in the system headers using feature detection and only define it if necessary.
Additional Notes
This issue did not occur with older versions of the Clang-MinGW toolchain
Similar issues might exist for other Direct3D structures defined in DXVK that have been added to newer MinGW headers
A more comprehensive solution might involve checking all custom structure definitions against the latest headers
Impact
This issue blocks compilation of DXVK 2.6 with the recent Clang-MinGW toolchain, preventing users from building from source with up-to-date development environments.
I should add, the older llvm-mingw 20250305 works fine, hence this only reproduces with the newer version from 20250319. I pull directly from: https://github.com/mstorsjo/llvm-mingw/releases
Description
When compiling DXVK 2.6 with the latest Clang toolchain (llvm-mingw-20250319), the build fails due to a redefinition of the
_D3DDEVINFO_RESOURCEMANAGERstructure. This structure is now properly defined in the system headers included with the newer Clang toolchain, but DXVK also defines it in its own codebase, causing a conflict.Error Message
Environment
Reproduction Steps
dxso_util.cppfileAnalysis
The issue occurs because:
d3d9types.h) now include a definition for_D3DDEVINFO_RESOURCEMANAGERd3d9_include.h(line 49)This appears to be a backward compatibility issue where DXVK previously needed to define this structure because it was missing or incomplete in older headers.
Proposed Fix by AI
Add preprocessor guards around the structure definition in
d3d9_include.hto only define it if it's not already defined in the system headers:Alternatively, check if the structure is defined in the system headers using feature detection and only define it if necessary.
Additional Notes
Impact
This issue blocks compilation of DXVK 2.6 with the recent Clang-MinGW toolchain, preventing users from building from source with up-to-date development environments.