@Christian-Ehrlicher Your link no longer works - but given as it has Mingw8 in the name, I'm assuming that you were referring to a Qt 5 build with MinGW 8.
While officially Qt 5 is dead now and no longer actively supported for open-source, I also ran into the issue @gyorokpeter was having. Specifically, I am using MinGW 11.2 (the bundled MinGW compiler for Qt 6) to compile the latest Qt 5 LTS.
So to conclude, yes, Qt compiles fine with MinGW, but Qt 5 breaks when using a newer MinGW compiler. It passes the d3d12 config.test in qt/qtdeclarative, but then fails to compile the rest of the d3d12 plugin.
This is what I had to do to make Qt 5 compile again under MinGW 11.2:
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;