Revision control

Copy as Markdown

// Copyright (C) 2026 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef RHI_SUPPORT_P_H
#define RHI_SUPPORT_P_H
#include <QtGui/qoffscreensurface.h>
#include <QtGui/rhi/qrhi.h>
#include <QtCore/private/qexpected_p.h>
#include <memory>
#if defined(Q_OS_WIN)
# include <QtMultimediaTestLib/private/qwindowsd3d11testdevicecontext_p.h>
#endif
QT_BEGIN_NAMESPACE
namespace QtMultimediaTest {
std::unique_ptr<QRhi> createNullRhi();
#if QT_CONFIG(opengl)
struct OffscreenGlRhi
{
// the QRhi must be destroyed before the QOffscreenSurface it was built from.
std::unique_ptr<QOffscreenSurface> fallbackSurface;
std::unique_ptr<QRhi> rhi;
};
q23::expected<OffscreenGlRhi, QString> createOffscreenGlRhi();
#endif
#if QT_CONFIG(vulkan)
struct OffscreenVulkanRhi
{
// the QRhi must be destroyed before the QVulkanInstance it was built from.
std::unique_ptr<QVulkanInstance> vulkanInstance;
std::unique_ptr<QRhi> rhi;
};
// Requests Vulkan 1.1 (so that callers relying on functionality promoted to core in 1.1, e.g.
// vkGetPhysicalDeviceProperties2 or VK_KHR_external_memory, don't need to enable it as an
// extension) and any device extensions the caller asks for (e.g. "VK_KHR_external_memory_fd").
q23::expected<OffscreenVulkanRhi, QString>
createOffscreenVulkanRhi(const QByteArrayList &deviceExtensions = {});
#endif
#if QT_CONFIG(metal)
std::unique_ptr<QRhi> createOffscreenMetalRhi();
#endif
#if defined(Q_OS_WIN)
std::unique_ptr<QRhi> createOffscreenD3D11Rhi();
std::unique_ptr<QRhi> createWarpD3D11Rhi(const QWindowsD3D11TestDeviceContext &warpDevice);
std::unique_ptr<QRhi> createD3D12Rhi();
#endif
q23::expected<QByteArray, QString> readBackPlane(QRhi &, quint64 handle, QSize planeSize,
QRhiTexture::Format);
#if QT_CONFIG(opengl)
q23::expected<QByteArray, QString> readBackExternalOesTexture(QRhi &, quint64 handle, QSize size);
#endif
} // namespace QtMultimediaTest
QT_END_NAMESPACE
#endif // RHI_SUPPORT_P_H