4#ifndef QRHID3DHELPERS_P_H
5#define QRHID3DHELPERS_P_H
18#include <QtCore/private/qsystemlibrary_p.h>
19#include <QtCore/private/qsystemerror_p.h>
22#include <d3dcompiler.h>
24#if __has_include(<dxcapi.h>)
26#define QRHI_D3D12_HAS_DXC
35 for (
const wchar_t *libraryName : {L
"D3DCompiler_47", L
"D3DCompiler_43"}) {
38 if (
auto symbol = library.resolve(
"D3DCompile"))
39 return reinterpret_cast<pD3DCompile
>(symbol);
41 qWarning(
"Failed to load D3DCompiler_47/43.dll");
50 typedef HRESULT (__stdcall *DCompositionCreateDeviceFuncPtr)(
51 _In_opt_ IDXGIDevice *dxgiDevice,
53 _Outptr_
void **dcompositionDevice);
54 DCompositionCreateDeviceFuncPtr
func =
reinterpret_cast<DCompositionCreateDeviceFuncPtr
>(
55 dcomplib.resolve(
"DCompositionCreateDevice"));
57 qWarning(
"Unable to resolve DCompositionCreateDevice, perhaps dcomp.dll is missing?");
60 IDCompositionDevice *
device =
nullptr;
61 HRESULT hr =
func(
nullptr, __uuidof(IDCompositionDevice),
reinterpret_cast<void **
>(&
device));
63 qWarning(
"Failed to create Direct Composition device: %s",
64 qPrintable(QSystemError::windowsComString(hr)));
70#ifdef QRHI_D3D12_HAS_DXC
71inline std::pair<IDxcCompiler *, IDxcLibrary *> createDxcCompiler()
75 if (!dxclib.load(
false)) {
76 qWarning(
"Failed to load dxcompiler.dll");
79 DxcCreateInstanceProc
func =
reinterpret_cast<DxcCreateInstanceProc
>(dxclib.resolve(
"DxcCreateInstance"));
81 qWarning(
"Unable to resolve DxcCreateInstance");
84 IDxcCompiler *compiler =
nullptr;
85 HRESULT hr =
func(CLSID_DxcCompiler, __uuidof(IDxcCompiler),
reinterpret_cast<void**
>(&compiler));
87 qWarning(
"Failed to create dxc compiler instance: %s",
88 qPrintable(QSystemError::windowsComString(hr)));
91 IDxcLibrary *library =
nullptr;
92 hr =
func(CLSID_DxcLibrary, __uuidof(IDxcLibrary),
reinterpret_cast<void**
>(&library));
94 qWarning(
"Failed to create dxc library instance: %s",
95 qPrintable(QSystemError::windowsComString(hr)));
98 return { compiler, library };
IOBluetoothDevice * device
pD3DCompile resolveD3DCompile()
IDCompositionDevice * createDirectCompositionDevice()
Combined button and popup list for selecting options.
#define qPrintable(string)
#define QStringLiteral(str)