Prerequisites:
- Visual Studio, with fxc.exe from Windows Kits
- MinGW 11.2 from Qt official installer
- Checkout the kde/5.15 branch from invent.kde.org
- In a x64 Visual Studio dev prompt:
where fxc.exe
. Then add that directory to the PATH. - Add the MinGW
bin/
folder to PATH (typicallyC:\Qt\Tools\mingw1120_64
for the official Qt installer). - Apply this diff to qtdeclarative to fix D3D12 FTBFS issues [1]:
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
index 75bde2c66b..3594878eca 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine.cpp
@@ -221,7 +221,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte
if (SUCCEEDED(factory->EnumAdapters1(adapterIndex, &adapter))) {
adapter->GetDesc1(&desc);
const QString name = QString::fromUtf16((char16_t *) desc.Description);
- HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr);
+ HRESULT hr = D3D12CreateDevice(adapter.Get(), fl, __uuidof(ID3D12Device), nullptr);
if (SUCCEEDED(hr)) {
qCDebug(QSG_LOG_INFO_GENERAL, "Using requested adapter '%s'", qPrintable(name));
*outAdapter = adapter.Detach();
@@ -238,7 +238,7 @@ static void getHardwareAdapter(IDXGIFactory1 *factory, IDXGIAdapter1 **outAdapte
if (desc.Flags & DXGI_ADAPTER_FLAG_SOFTWARE)
continue;
- if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, _uuidof(ID3D12Device), nullptr))) {
+ if (SUCCEEDED(D3D12CreateDevice(adapter.Get(), fl, __uuidof(ID3D12Device), nullptr))) {
const QString name = QString::fromUtf16((char16_t *) desc.Description);
qCDebug(QSG_LOG_INFO_GENERAL, "Using adapter '%s'", qPrintable(name));
break;
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
index a95cbb1cbb..54a2c4dc8f 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12engine_p_p.h
@@ -55,6 +55,7 @@
#include <QCache>
#include <d3d12.h>
+#include <d3d12sdklayers.h>
#include <dxgi1_4.h>
#include <dcomp.h>
#include <wrl/client.h>
@@ -263,8 +264,8 @@ private:
void beginFrameDraw();
void endDrawCalls(bool lastInFrame = false);
- static const int MAX_SWAP_CHAIN_BUFFER_COUNT = 4;
- static const int MAX_FRAME_IN_FLIGHT_COUNT = 4;
+ static inline const int MAX_SWAP_CHAIN_BUFFER_COUNT = 4;
+ static inline const int MAX_FRAME_IN_FLIGHT_COUNT = 4;
bool initialized = false;
bool inFrame = false;
- Then apply this diff to qtbase to compile qmake faster:
diff --git a/configure.bat b/configure.bat
index b34e146f5f..2ba220ee32 100644
--- a/configure.bat
+++ b/configure.bat
@@ -182,7 +182,7 @@ if "%PLATFORM:g++=%" == "%PLATFORM%" (
set tmpl=win32
) else (
if "%MAKE%" == "" (
- set MAKE=mingw32-make
+ set MAKE=mingw32-make -j%NUMBER_OF_PROCESSORS%
)
set tmpl=unix
)
- The compile will fail with either
gl/gl.h
not found or a debug postfix issue for one of the examples, so be sure to add-opengl desktop -nomake examples
to the configure command.
[1]. https://forum.qt.io/topic/128587/build-failure-_uuidof-was-not-declared-in-this-scope
As an alternative, one could of course configure with
-no-feature-d3d12
. The experimental D3D12 scene graph renderer was removed shortly after 5.15.2 anyway (in qtdeclarative 0b9fcb829313d0eaf2b496bf3ad44e5628fa43b2).