Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.8.0 Beta4
-
None
Description
Currently, `qrhid3d12_p.h` has an include directive for `D3D12MemAlloc.h`, which is neither part of DirectX 12 SDK nor deployed by the Qt installation. This makes `qrhid3d12_p.h` unusable for applications that want to use it.
However, with the following simple change I was able to prevent including the said header file in `qrhid3d12_p.h`:
From cf3f69d8fbc5574fefdf0590768ac93a3cc093fd Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu <fuzun54@outlook.com> Date: Mon, 22 Jan 2024 21:19:55 +0200 Subject: [PATCH 4/7] Do not include D3D12MemAlloc.h in header file--- src/gui/rhi/qrhid3d12.cpp | 11 +++++++++++ src/gui/rhi/qrhid3d12_p.h | 17 +++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-)diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp index de314e3fca..d40f14c5a3 100644 --- a/src/gui/rhi/qrhid3d12.cpp +++ b/src/gui/rhi/qrhid3d12.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qrhid3d12_p.h" +#include "D3D12MemAlloc.h" #include <qmath.h> #include <QtCore/private/qsystemerror_p.h> #include <comdef.h> @@ -149,6 +150,16 @@ QT_BEGIN_NAMESPACE // https://learn.microsoft.com/en-us/windows/win32/direct3d12/hardware-feature-levels static const D3D_FEATURE_LEVEL MIN_FEATURE_LEVEL = D3D_FEATURE_LEVEL_11_0; +void QD3D12Resource::releaseResources() +{ + if (owns) { + // order matters: resource first, then the allocation + resource->Release(); + if (allocation) + allocation->Release(); + } +} + QRhiD3D12::QRhiD3D12(QRhiD3D12InitParams *params, QRhiD3D12NativeHandles *importParams) { debugLayer = params->enableDebugLayer; diff --git a/src/gui/rhi/qrhid3d12_p.h b/src/gui/rhi/qrhid3d12_p.h index c6d4123c09..08d11e9e47 100644 --- a/src/gui/rhi/qrhid3d12_p.h +++ b/src/gui/rhi/qrhid3d12_p.h @@ -27,7 +27,12 @@ #include <dxgi1_6.h> #include <dcomp.h> -#include "D3D12MemAlloc.h" +namespace D3D12MA { + struct Budget; + struct Statistics; + class Allocation; + class Allocator; +} // ID3D12Device2 and ID3D12GraphicsCommandList1 and types and enums introduced // with those are hard requirements now. These should be declared in any @@ -311,15 +316,7 @@ struct QD3D12Resource return pool->add({ resource, state, resource->GetDesc(), nullptr, nullptr, 0, false }); } - void releaseResources() - { - if (owns) { - // order matters: resource first, then the allocation - resource->Release(); - if (allocation) - allocation->Release(); - } - } + void releaseResources(); }; struct QD3D12Pipeline -- 2.45.2
Request review lagocs.