From 1b672951cadd9da8873793d8787025076293016c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 28 Jan 2022 12:05:11 +0100 Subject: rhi: d3d11: switch to uuidof everywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There seems to be bizarre issues with IID_* as they are not always exported or are in a different library depending on the SDK and where dxguid.lib comes from. If not mistaken, we don't need these symbols at all because in C++ one can use __uuidof instead (which would not be possible in C code and there the IID_ objects are necessary). Pick-to: 6.3 Change-Id: I04712382630768a742bb5f42cc5fca9ad10ff719 Reviewed-by: Qt CI Bot Reviewed-by: Christian Strømme Reviewed-by: Andy Nichols --- src/gui/rhi/qrhid3d11.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 41898ecace..90e0214df8 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -141,7 +141,7 @@ QRhiD3D11::QRhiD3D11(QRhiD3D11InitParams *params, QRhiD3D11NativeHandles *import if (importParams->dev && importParams->context) { dev = reinterpret_cast(importParams->dev); ID3D11DeviceContext *ctx = reinterpret_cast(importParams->context); - if (SUCCEEDED(ctx->QueryInterface(IID_ID3D11DeviceContext1, reinterpret_cast(&context)))) { + if (SUCCEEDED(ctx->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast(&context)))) { // get rid of the ref added by QueryInterface ctx->Release(); importedDeviceAndContext = true; @@ -173,7 +173,7 @@ inline Int aligned(Int v, Int byteAlign) static IDXGIFactory1 *createDXGIFactory2() { IDXGIFactory1 *result = nullptr; - const HRESULT hr = CreateDXGIFactory2(0, IID_IDXGIFactory2, reinterpret_cast(&result)); + const HRESULT hr = CreateDXGIFactory2(0, __uuidof(IDXGIFactory2), reinterpret_cast(&result)); if (FAILED(hr)) { qWarning("CreateDXGIFactory2() failed to create DXGI factory: %s", qPrintable(comErrorMessage(hr))); result = nullptr; @@ -184,7 +184,7 @@ static IDXGIFactory1 *createDXGIFactory2() static IDXGIFactory1 *createDXGIFactory1() { IDXGIFactory1 *result = nullptr; - const HRESULT hr = CreateDXGIFactory1(IID_IDXGIFactory1, reinterpret_cast(&result)); + const HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), reinterpret_cast(&result)); if (FAILED(hr)) { qWarning("CreateDXGIFactory1() failed to create DXGI factory: %s", qPrintable(comErrorMessage(hr))); result = nullptr; @@ -319,7 +319,7 @@ bool QRhiD3D11::create(QRhi::Flags flags) qWarning("Failed to create D3D11 device and context: %s", qPrintable(comErrorMessage(hr))); return false; } - if (SUCCEEDED(ctx->QueryInterface(IID_ID3D11DeviceContext1, reinterpret_cast(&context)))) { + if (SUCCEEDED(ctx->QueryInterface(__uuidof(ID3D11DeviceContext1), reinterpret_cast(&context)))) { ctx->Release(); } else { qWarning("ID3D11DeviceContext1 not supported"); @@ -329,7 +329,7 @@ bool QRhiD3D11::create(QRhi::Flags flags) Q_ASSERT(dev && context); featureLevel = dev->GetFeatureLevel(); IDXGIDevice *dxgiDev = nullptr; - if (SUCCEEDED(dev->QueryInterface(IID_IDXGIDevice, reinterpret_cast(&dxgiDev)))) { + if (SUCCEEDED(dev->QueryInterface(__uuidof(IDXGIDevice), reinterpret_cast(&dxgiDev)))) { IDXGIAdapter *adapter = nullptr; if (SUCCEEDED(dxgiDev->GetAdapter(&adapter))) { DXGI_ADAPTER_DESC desc; @@ -345,7 +345,7 @@ bool QRhiD3D11::create(QRhi::Flags flags) qCDebug(QRHI_LOG_INFO, "Using imported device %p", dev); } - if (FAILED(context->QueryInterface(IID_ID3DUserDefinedAnnotation, reinterpret_cast(&annotations)))) + if (FAILED(context->QueryInterface(__uuidof(ID3DUserDefinedAnnotation), reinterpret_cast(&annotations)))) annotations = nullptr; deviceLost = false; @@ -409,7 +409,7 @@ void QRhiD3D11::reportLiveObjects(ID3D11Device *device) { // this works only when params.enableDebugLayer was true ID3D11Debug *debug; - if (SUCCEEDED(device->QueryInterface(IID_ID3D11Debug, reinterpret_cast(&debug)))) { + if (SUCCEEDED(device->QueryInterface(__uuidof(ID3D11Debug), reinterpret_cast(&debug)))) { debug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL); debug->Release(); } @@ -4682,7 +4682,7 @@ bool QD3D11SwapChain::createOrResize() swapChain = sc1; if (m_format != SDR) { IDXGISwapChain3 *sc3 = nullptr; - if (SUCCEEDED(sc1->QueryInterface(IID_IDXGISwapChain3, reinterpret_cast(&sc3)))) { + if (SUCCEEDED(sc1->QueryInterface(__uuidof(IDXGISwapChain3), reinterpret_cast(&sc3)))) { hr = sc3->SetColorSpace1(hdrColorSpace); if (FAILED(hr)) qWarning("Failed to set color space on swapchain: %s", qPrintable(comErrorMessage(hr))); @@ -4748,7 +4748,7 @@ bool QD3D11SwapChain::createOrResize() // swapchain." // So just query index 0 once (per resize) and be done with it. - HRESULT hr = swapChain->GetBuffer(0, IID_ID3D11Texture2D, reinterpret_cast(&backBufferTex)); + HRESULT hr = swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast(&backBufferTex)); if (FAILED(hr)) { qWarning("Failed to query swapchain backbuffer: %s", qPrintable(comErrorMessage(hr))); return false; -- cgit v1.2.3