8#include <QtQuick/private/qquickitem_p.h>
9#include <QtQuick/private/qquickwindow_p.h>
11#include <QtGui/qwindow.h>
14#include <QtGui/private/qvulkandefaultinstance_p.h>
17#include <QOperatingSystemVersion>
20#include <QStandardPaths>
24#include <QOffscreenSurface>
27#include <dxgiformat.h>
34QSGRhiSupport::QSGRhiSupport()
38void QSGRhiSupport::applySettings()
42 m_settingsApplied =
true;
50 if (m_requested.valid) {
52 switch (m_requested.api) {
72 Q_ASSERT_X(
false,
"QSGRhiSupport",
"Internal error: unhandled GraphicsApi type");
95 qWarning(
"Unknown key \"%s\" for QSG_RHI_BACKEND, falling back to default backend.",
100#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
102#elif QT_CONFIG(opengl)
110 adjustToPlatformQuirks();
121void QSGRhiSupport::adjustToPlatformQuirks()
123#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
131 qCDebug(QSG_LOG_INFO,
"Metal does not seem to be supported. Falling back to OpenGL.");
147#define GL_BGRA 0x80E1
167#define GL_RG16 0x822C
175#define GL_RGBA8 0x8058
179#define GL_RGBA32F 0x8814
183#define GL_RGBA16F 0x881A
187#define GL_R16F 0x822D
191#define GL_R32F 0x822E
194#ifndef GL_DEPTH_COMPONENT16
195#define GL_DEPTH_COMPONENT16 0x81A5
198#ifndef GL_DEPTH_COMPONENT24
199#define GL_DEPTH_COMPONENT24 0x81A6
202#ifndef GL_DEPTH_COMPONENT32F
203#define GL_DEPTH_COMPONENT32F 0x8CAC
206#ifndef GL_DEPTH24_STENCIL8
207#define GL_DEPTH24_STENCIL8 0x88F0
210#ifndef GL_DEPTH_STENCIL
211#define GL_DEPTH_STENCIL 0x84F9
215#define GL_RGB10_A2 0x8059
265 case GL_DEPTH_COMPONENT:
295 case VK_FORMAT_R8G8B8A8_SRGB:
298 case VK_FORMAT_R8G8B8A8_UNORM:
299 case VK_FORMAT_UNDEFINED:
302 case VK_FORMAT_B8G8R8A8_SRGB:
305 case VK_FORMAT_B8G8R8A8_UNORM:
308 case VK_FORMAT_R8_SRGB:
311 case VK_FORMAT_R8_UNORM:
314 case VK_FORMAT_R8G8_SRGB:
317 case VK_FORMAT_R8G8_UNORM:
320 case VK_FORMAT_R16_UNORM:
323 case VK_FORMAT_R16G16_UNORM:
326 case VK_FORMAT_R16G16B16A16_SFLOAT:
329 case VK_FORMAT_R32G32B32A32_SFLOAT:
332 case VK_FORMAT_R16_SFLOAT:
335 case VK_FORMAT_R32_SFLOAT:
338 case VK_FORMAT_A2B10G10R10_UNORM_PACK32:
340 case VK_FORMAT_A2R10G10B10_UNORM_PACK32:
343 case VK_FORMAT_D16_UNORM:
346 case VK_FORMAT_X8_D24_UNORM_PACK32:
349 case VK_FORMAT_D24_UNORM_S8_UINT:
352 case VK_FORMAT_D32_SFLOAT:
355 case VK_FORMAT_BC1_RGB_SRGB_BLOCK:
358 case VK_FORMAT_BC1_RGB_UNORM_BLOCK:
361 case VK_FORMAT_BC2_SRGB_BLOCK:
364 case VK_FORMAT_BC2_UNORM_BLOCK:
367 case VK_FORMAT_BC3_SRGB_BLOCK:
370 case VK_FORMAT_BC3_UNORM_BLOCK:
373 case VK_FORMAT_BC4_UNORM_BLOCK:
376 case VK_FORMAT_BC5_UNORM_BLOCK:
379 case VK_FORMAT_BC6H_UFLOAT_BLOCK:
382 case VK_FORMAT_BC7_SRGB_BLOCK:
385 case VK_FORMAT_BC7_UNORM_BLOCK:
388 case VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:
391 case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
394 case VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:
397 case VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:
400 case VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:
403 case VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:
406 case VK_FORMAT_ASTC_4x4_SRGB_BLOCK:
409 case VK_FORMAT_ASTC_4x4_UNORM_BLOCK:
412 case VK_FORMAT_ASTC_5x4_SRGB_BLOCK:
415 case VK_FORMAT_ASTC_5x4_UNORM_BLOCK:
418 case VK_FORMAT_ASTC_5x5_SRGB_BLOCK:
421 case VK_FORMAT_ASTC_5x5_UNORM_BLOCK:
424 case VK_FORMAT_ASTC_6x5_SRGB_BLOCK:
427 case VK_FORMAT_ASTC_6x5_UNORM_BLOCK:
430 case VK_FORMAT_ASTC_6x6_SRGB_BLOCK:
433 case VK_FORMAT_ASTC_6x6_UNORM_BLOCK:
436 case VK_FORMAT_ASTC_8x5_SRGB_BLOCK:
439 case VK_FORMAT_ASTC_8x5_UNORM_BLOCK:
442 case VK_FORMAT_ASTC_8x6_SRGB_BLOCK:
445 case VK_FORMAT_ASTC_8x6_UNORM_BLOCK:
448 case VK_FORMAT_ASTC_8x8_SRGB_BLOCK:
451 case VK_FORMAT_ASTC_8x8_UNORM_BLOCK:
454 case VK_FORMAT_ASTC_10x5_SRGB_BLOCK:
457 case VK_FORMAT_ASTC_10x5_UNORM_BLOCK:
460 case VK_FORMAT_ASTC_10x6_SRGB_BLOCK:
463 case VK_FORMAT_ASTC_10x6_UNORM_BLOCK:
466 case VK_FORMAT_ASTC_10x8_SRGB_BLOCK:
469 case VK_FORMAT_ASTC_10x8_UNORM_BLOCK:
472 case VK_FORMAT_ASTC_10x10_SRGB_BLOCK:
475 case VK_FORMAT_ASTC_10x10_UNORM_BLOCK:
478 case VK_FORMAT_ASTC_12x10_SRGB_BLOCK:
481 case VK_FORMAT_ASTC_12x10_UNORM_BLOCK:
484 case VK_FORMAT_ASTC_12x12_SRGB_BLOCK:
487 case VK_FORMAT_ASTC_12x12_UNORM_BLOCK:
506 case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
509 case DXGI_FORMAT_R8G8B8A8_UNORM:
510 case DXGI_FORMAT_UNKNOWN:
513 case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
516 case DXGI_FORMAT_B8G8R8A8_UNORM:
519 case DXGI_FORMAT_R8_UNORM:
522 case DXGI_FORMAT_R8G8_UNORM:
525 case DXGI_FORMAT_R16_UNORM:
528 case DXGI_FORMAT_R16G16_UNORM:
531 case DXGI_FORMAT_R16G16B16A16_FLOAT:
534 case DXGI_FORMAT_R32G32B32A32_FLOAT:
537 case DXGI_FORMAT_R16_FLOAT:
540 case DXGI_FORMAT_R32_FLOAT:
543 case DXGI_FORMAT_R10G10B10A2_UNORM:
546 case DXGI_FORMAT_R16_TYPELESS:
549 case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
552 case DXGI_FORMAT_D24_UNORM_S8_UINT:
555 case DXGI_FORMAT_R32_TYPELESS:
558 case DXGI_FORMAT_BC1_UNORM_SRGB:
561 case DXGI_FORMAT_BC1_UNORM:
564 case DXGI_FORMAT_BC2_UNORM_SRGB:
567 case DXGI_FORMAT_BC2_UNORM:
570 case DXGI_FORMAT_BC3_UNORM_SRGB:
573 case DXGI_FORMAT_BC3_UNORM:
576 case DXGI_FORMAT_BC4_UNORM:
579 case DXGI_FORMAT_BC5_UNORM:
582 case DXGI_FORMAT_BC6H_UF16:
585 case DXGI_FORMAT_BC7_UNORM_SRGB:
588 case DXGI_FORMAT_BC7_UNORM:
601#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
615 m_requested.valid =
false;
619 m_requested.valid =
true;
620 m_requested.api =
api;
634 if (!inst->m_settingsApplied)
635 inst->applySettings();
646 switch (m_rhiBackend) {
666 switch (m_rhiBackend) {
697 return &vknat->gfxQueue;
700 return &maybeVkCbNat->commandBuffer;
704 return &vknat->physDev;
707 return &maybeVkRpNat->renderPass;
711 return &vknat->gfxQueueFamilyIdx;
713 return &vknat->gfxQueueIdx;
726 return glnat->context;
741 return d3dnat->context;
749 const QRhiD3D12NativeHandles *d3dnat =
static_cast<const QRhiD3D12NativeHandles *
>(nat);
754 return d3dnat->commandQueue;
761#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
773 return mtlnat->cmdQueue;
776 return maybeMtlCbNat->commandBuffer;
781 return maybeMtlCbNat->encoder;
817 switch (m_rhiBackend) {
823 return qsgrhi_vk_rifResource(
res, nat,
824 cb ?
cb->nativeHandles() :
nullptr,
830 return qsgrhi_gl_rifResource(
res, nat);
834 return qsgrhi_d3d11_rifResource(
res, nat);
836 return qsgrhi_d3d12_rifResource(
res, nat);
838#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
842 return qsgrhi_mtl_rifResource(
res, nat,
cb ?
cb->nativeHandles() :
nullptr);
855 msaaSampleCount =
qMax(1, msaaSampleCount);
856 if (msaaSampleCount > 1) {
858 if (!supportedSampleCounts.
contains(msaaSampleCount)) {
859 int reducedSampleCount = 1;
860 for (
int i = supportedSampleCounts.
size() - 1;
i >= 0; --
i) {
861 if (supportedSampleCounts[
i] <= msaaSampleCount) {
862 reducedSampleCount = supportedSampleCounts[
i];
866 qWarning() <<
"Requested MSAA sample count" << msaaSampleCount
867 <<
"but supported sample counts are" << supportedSampleCounts
868 <<
", using sample count" << reducedSampleCount <<
"instead";
869 msaaSampleCount = reducedSampleCount;
872 return msaaSampleCount;
887 offscreenSurface = QRhiGles2InitParams::newFallbackSurface(
format);
892 return offscreenSurface;
910 qCDebug(QSG_LOG_INFO) <<
"Got Vulkan instance from QVulkanDefaultInstance, requested api version was" << vkinst->apiVersion();
912 qCDebug(QSG_LOG_INFO) <<
"No Vulkan instance from QVulkanDefaultInstance, expect problems";
913 window->setVulkanInstance(vkinst);
929 static bool checked =
false;
930 static QString currentCacheDir;
931 static bool cacheWritable =
false;
934 return cacheWritable ? currentCacheDir :
QString();
947 currentCacheDir = cachePath +
subPath;
951 return cacheWritable ? currentCacheDir :
QString();
985 bool isAutomatic =
false;
993 if (pipelineCacheLoad.
isEmpty())
998 qWarning(
"Could not create pipeline cache lock file '%s'",
1003 QFile f(pipelineCacheLoad);
1006 qWarning(
"Could not open pipeline cache source file '%s'",
1013 if (!
buf.isEmpty()) {
1014 qCDebug(QSG_LOG_INFO,
"Attempting to seed pipeline cache for QRhi %p from '%s'",
1023 qCDebug(QSG_LOG_INFO,
"Total time spent on pipeline creation during the lifetime of the QRhi %p was %lld ms",
1028 bool isAutomatic =
false;
1029 if (pipelineCacheSave.
isEmpty() &&
config.isAutomaticPipelineCacheEnabled()) {
1034 if (pipelineCacheSave.
isEmpty())
1041 if (
buf.isEmpty()) {
1056 qWarning(
"Could not create pipeline cache lock file '%s'",
1061#if QT_CONFIG(temporaryfile)
1064 QFile f(pipelineCacheSave);
1068 const QString msg =
f.errorString();
1069 qWarning(
"Could not open pipeline cache output file '%s': %s",
1075 qCDebug(QSG_LOG_INFO,
"Writing pipeline cache contents (%d bytes) for QRhi %p to '%s'",
1078 if (
f.write(
buf) !=
buf.size()
1085 const QString msg =
f.errorString();
1095 QRhi *rhi =
nullptr;
1098 if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::Rhi) {
1099 rhi = customDevD->
u.
rhi;
1101 preparePipelineCache(rhi,
window);
1102 return { rhi,
false };
1116 "Creating QRhi with backend %s for window %p (wflags 0x%X)\n"
1117 " Graphics API debug/validation layers: %d\n"
1118 " Debug markers: %d\n"
1120 " Prefer software device: %d\n"
1121 " Shader/pipeline cache collection: %d",
1123 debugMarkers, timestamps, preferSoftware, pipelineCacheSave);
1132 if (pipelineCacheSave)
1140#if QT_CONFIG(opengl)
1144 rhiParams.format =
format;
1145 rhiParams.fallbackSurface = offscreenSurface;
1146 rhiParams.window =
window;
1147 if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::OpenGLContext) {
1149 importDev.context = customDevD->
u.
context;
1150 qCDebug(QSG_LOG_INFO,
"Using existing QOpenGLContext %p", importDev.context);
1159 qWarning(
"OpenGL was requested for Qt Quick, but this build of Qt has no OpenGL support.");
1161#if QT_CONFIG(vulkan)
1164 QVulkanDefaultInstance::setFlag(QVulkanDefaultInstance::EnableValidation,
true);
1167 rhiParams.inst =
window->vulkanInstance();
1168 if (!rhiParams.inst)
1169 qWarning(
"No QVulkanInstance set for QQuickWindow, this is wrong.");
1171 rhiParams.window =
window;
1173 if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::DeviceObjects) {
1179 qCDebug(QSG_LOG_INFO,
"Using existing native Vulkan physical device %p device %p graphics queue family index %d",
1180 importDev.physDev, importDev.dev, importDev.gfxQueueFamilyIdx);
1182 }
else if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::PhysicalDevice) {
1185 qCDebug(QSG_LOG_INFO,
"Using existing native Vulkan physical device %p", importDev.physDev);
1193 qWarning(
"Vulkan was requested for Qt Quick, but this build of Qt has no Vulkan support.");
1198 rhiParams.enableDebugLayer = debugLayer;
1199 if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::DeviceAndContext) {
1203 qCDebug(QSG_LOG_INFO,
"Using existing native D3D11 device %p and context %p",
1204 importDev.dev, importDev.context);
1206 }
else if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::Adapter) {
1211 qCDebug(QSG_LOG_INFO,
"Using D3D11 adapter LUID %u, %d and feature level %d",
1212 importDev.adapterLuidLow, importDev.adapterLuidHigh, importDev.featureLevel);
1217 qCDebug(QSG_LOG_INFO,
"Failed to create a D3D device with default settings; "
1218 "attempting to get a software rasterizer backed device instead");
1224 QRhiD3D12InitParams rhiParams;
1225 rhiParams.enableDebugLayer = debugLayer;
1226 if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::DeviceAndContext) {
1227 QRhiD3D12NativeHandles importDev;
1229 qCDebug(QSG_LOG_INFO,
"Using existing native D3D12 device %p", importDev.dev);
1231 }
else if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::Adapter) {
1232 QRhiD3D12NativeHandles importDev;
1236 qCDebug(QSG_LOG_INFO,
"Using D3D12 adapter LUID %u, %d and minimum feature level %d",
1237 importDev.adapterLuidLow, importDev.adapterLuidHigh, importDev.minimumFeatureLevel);
1242 qCDebug(QSG_LOG_INFO,
"Failed to create a D3D device with default settings; "
1243 "attempting to get a software rasterizer backed device instead");
1250#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
1253 if (customDevD->
type == QQuickGraphicsDevicePrivate::Type::DeviceAndCommandQueue) {
1257 qCDebug(QSG_LOG_INFO,
"Using existing native Metal device %p and command queue %p",
1258 importDev.dev, importDev.cmdQueue);
1267 qCDebug(QSG_LOG_INFO,
"Created QRhi %p for window %p", rhi,
window);
1268 preparePipelineCache(rhi,
window);
1270 qWarning(
"Failed to create RHI (backend %d)", backend);
1273 return { rhi,
true };
1282 finalizePipelineCache(rhi,
config);
1296 cb->resourceUpdate(resourceUpdates);
1302#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
1316 return img.mirrored();
1335 if (!rhiResult.
rhi) {
1336 qWarning(
"Failed to initialize QRhi for offscreen readback");
1339 std::unique_ptr<QRhi> rhiOwner(rhiResult.
rhi);
1340 QRhi *rhi = rhiResult.
own ? rhiOwner.get() : rhiOwner.release();
1346 qWarning(
"Failed to build texture for offscreen readback");
1350 if (!depthStencil->create()) {
1351 qWarning(
"Failed to create depth/stencil buffer for offscreen readback");
1358 rt->setRenderPassDescriptor(rpDesc.
data());
1359 if (!rt->create()) {
1360 qWarning(
"Failed to build render target for offscreen readback");
1369 params.initialSurfacePixelSize = pixelSize;
1379 qWarning(
"Failed to start recording the frame for offscreen readback");
1392 image.setDevicePixelRatio(
window->devicePixelRatio());
1423 offscreenWindow->setFormat(surfaceFormat);
1428 if (!rhiResult.rhi) {
1429 qWarning(
"Failed to initialize QRhi for offscreen readback");
1433 QRhi *rhi = rhiResult.own ? rhiOwner.data() : rhiOwner.take();
1439 qWarning(
"Failed to build texture for offscreen readback");
1443 if (!depthStencil->create()) {
1444 qWarning(
"Failed to create depth/stencil buffer for offscreen readback");
1448 rtDesc.setDepthStencilBuffer(depthStencil.data());
1451 rt->setRenderPassDescriptor(rpDesc.data());
1452 if (!rt->create()) {
1453 qWarning(
"Failed to build render target for offscreen readback");
1464 params.initialSurfacePixelSize = pixelSize;
1476 qWarning(
"Failed to start recording the frame for offscreen readback");
1489 image.setDevicePixelRatio(
window->devicePixelRatio());
1501 window->setRenderTarget(currentRenderTarget);
1502 wd->
rhi = currentRhi;
1517 if (
window->graphicsConfiguration().isHdrEnabled()) {
1520 swapChainFormat = autoFormat;
1525 hdrRequest = hdrRequest.
toLower();
1532 const char *fmtStr =
"unknown";
1533 switch (swapChainFormat) {
1549 qCDebug(QSG_LOG_INFO,
"Requested a %s swapchain but it is reported to be unsupported with the current display(s). "
1550 "In multi-screen configurations make sure the window is located on a HDR-enabled screen. "
1551 "Request ignored, using SDR swapchain.", fmtStr);
1556 scWithWindowSet->
setFormat(swapChainFormat);
1559 qCDebug(QSG_LOG_INFO,
"Creating %s swapchain", fmtStr);
1560 qCDebug(QSG_LOG_INFO) <<
"HDR output info:" << scWithWindowSet->
hdrInfo();
1566 switch (m_rhiBackend) {
1567#if QT_CONFIG(vulkan)
1569 return toRhiTextureFormatFromVulkan(nativeFormat,
flags);
1571#if QT_CONFIG(opengl)
1574 return toRhiTextureFormatFromGL(nativeFormat);
1579 return toRhiTextureFormatFromDXGI(nativeFormat,
flags);
1581#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
1583 return toRhiTextureFormatFromMetal(nativeFormat,
flags);
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
QByteArray toLower() const &
bool remove(const QString &fileName)
Removes the file, fileName.
static QDir root()
Returns the root directory.
bool mkpath(const QString &dirPath) const
Creates the directory path dirPath.
\inmodule QtCore \reentrant
bool isWritable() const
Returns true if the user can write to the file; otherwise returns false.
Format
The following image formats are available in Qt.
@ Format_RGBA8888_Premultiplied
@ Format_ARGB32_Premultiplied
qsizetype size() const noexcept
QQuickGraphicsConfiguration controls lower level graphics settings for the QQuickWindow.
QString pipelineCacheLoadFile() const
bool isTimestampsEnabled() const
QString pipelineCacheSaveFile() const
bool isDebugLayerEnabled() const
bool isAutomaticPipelineCacheEnabled() const
bool isDebugMarkersEnabled() const
bool prefersSoftwareDevice() const
QByteArrayList deviceExtensions() const
static QQuickGraphicsDevicePrivate * get(QQuickGraphicsDevice *p)
PhysicalDevice physicalDevice
union QQuickGraphicsDevicePrivate::@684 u
DeviceAndCommandQueue deviceAndCommandQueue
DeviceObjects deviceObjects
DeviceAndContext deviceAndContext
The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a ...
static QQuickRenderTarget fromRhiRenderTarget(QRhiRenderTarget *renderTarget)
QQuickGraphicsConfiguration graphicsConfig
static QQuickWindowPrivate * get(QQuickWindow *c)
QSGRenderContext * context
QQuickRenderControl * renderControl
void cleanupNodesOnShutdown()
void setCustomCommandBuffer(QRhiCommandBuffer *cb)
QRhiSwapChain * swapchain
QQuickGraphicsDevice customDeviceObjects
struct QQuickWindowPrivate::Redirect redirect
QRhiRenderTarget * renderTarget
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\variable QRhiD3D11InitParams::enableDebugLayer
\variable QRhiGles2InitParams::format
virtual const QRhiNativeHandles * nativeHandles()
void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
Enqueues a texture-to-host copy operation as described by rb.
Format
Describes the swapchain format.
virtual bool isFormatSupported(Format f)=0
void setFormat(Format f)
Sets the format f.
virtual QRhiSwapChainHdrInfo hdrInfo()
\variable QRhiSwapChainHdrInfo::isHardCodedDefaults
void setDepthStencilBuffer(QRhiRenderBuffer *renderBuffer)
Sets the renderBuffer for depth-stencil.
Format
Specifies the texture format.
\variable QRhiVulkanNativeHandles::physDev
\variable QRhiVulkanInitParams::inst
\variable QRhiVulkanCommandBufferNativeHandles::commandBuffer
FrameOpResult endOffscreenFrame(EndFrameFlags flags={})
Ends, submits, and waits for the offscreen frame.
QRhiStats statistics() const
Gathers and returns statistics about the timings and allocations of graphics resources.
bool isYUpInFramebuffer() const
QList< int > supportedSampleCounts() const
QRhiRenderBuffer * newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount=1, QRhiRenderBuffer::Flags flags={}, QRhiTexture::Format backingFormatHint=QRhiTexture::UnknownFormat)
Implementation
Describes which graphics API-specific backend gets used by a QRhi instance.
QRhi::FrameOpResult finish()
Waits for any work on the graphics queue (where applicable) to complete, then executes all deferred o...
FrameOpResult beginOffscreenFrame(QRhiCommandBuffer **cb, BeginFrameFlags flags={})
Starts a new offscreen frame.
QRhiTextureRenderTarget * newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags={})
bool isRecordingFrame() const
const char * backendName() const
static bool probe(Implementation impl, QRhiInitParams *params)
static QRhi * create(Implementation impl, QRhiInitParams *params, Flags flags={}, QRhiNativeHandles *importDevice=nullptr)
QByteArray pipelineCacheData()
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
void setPipelineCacheData(const QByteArray &data)
Loads data into the pipeline cache, when applicable.
const QRhiNativeHandles * nativeHandles()
QRhiResourceUpdateBatch * nextResourceUpdateBatch()
bool isDeviceLost() const
@ EnablePipelineCacheDataSave
QRhiRenderPassDescriptor * currentFrameRenderPass() const
QRhi * rhi() const override
QRhiCommandBuffer * currentFrameCommandBuffer() const
virtual void initialize(const InitParams *params)
virtual void invalidate()
Resource
\value DeviceResource The resource is a pointer to the graphics device, when applicable.
@ RhiRedirectCommandBuffer
@ GraphicsQueueIndexResource
@ RhiRedirectRenderTarget
@ GraphicsQueueFamilyIndexResource
static bool isApiRhiBased(GraphicsApi api)
GraphicsApi
\value Unknown An unknown graphics API is in use \value Software The Qt Quick 2D Renderer is in use \...
QRhiTexture::Format toRhiTextureFormat(uint nativeFormat, QRhiTexture::Flags *flags) const
QOffscreenSurface * maybeCreateOffscreenSurface(QWindow *window)
void applySwapChainFormat(QRhiSwapChain *scWithWindowSet, QQuickWindow *window)
static QSGRhiSupport * instance_internal()
static void checkEnvQSgInfo()
const void * rifResource(QSGRendererInterface::Resource res, const QSGDefaultRenderContext *rc, const QQuickWindow *w)
static int chooseSampleCountForWindowWithRhi(QWindow *window, QRhi *rhi)
QSGRendererInterface::GraphicsApi graphicsApi() const
QSGRendererInterface::GraphicsApi api
void prepareWindowForRhi(QQuickWindow *window)
static int chooseSampleCount(int samples, QRhi *rhi)
static QImage grabAndBlockInCurrentFrame(QRhi *rhi, QRhiCommandBuffer *cb, QRhiTexture *src=nullptr)
void configure(QSGRendererInterface::GraphicsApi api)
QRhi::Implementation rhiBackend() const
QImage grabOffscreen(QQuickWindow *window)
void destroyRhi(QRhi *rhi, const QQuickGraphicsConfiguration &config)
QString rhiBackendName() const
static QSGRhiSupport * instance()
RhiCreateResult createRhi(QQuickWindow *window, QSurface *offscreenSurface)
QSurface::SurfaceType windowSurfaceType() const
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
static QString writableLocation(StandardLocation type)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString toLower() const &
SurfaceType
The SurfaceType enum describes what type of surface this is.
static QString buildAbi()
The QVulkanInstance class represents a native Vulkan instance, enabling Vulkan rendering onto a QSurf...
QRhiTexture::Format toRhiTextureFormatFromMetal(uint format, QRhiTexture::Flags *flags)
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
static const QPainterPath::ElementType * subPath(const QPainterPath::ElementType *t, const QPainterPath::ElementType *end, const qreal *points, bool *closed)
#define qCDebug(category,...)
constexpr const T & qMax(const T &a, const T &b)
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
#define GL_DEPTH_COMPONENT32F
#define GL_DEPTH24_STENCIL8
#define GL_DEPTH_COMPONENT16
#define GL_DEPTH_COMPONENT24
#define Q_ASSERT_X(cond, x, msg)
static QString pipelineCacheLockFileName(const QString &name)
static bool isAutomaticPipelineCacheLoadSkippedForWindow(Qt::WindowFlags wflags)
static QString automaticPipelineCacheDir()
static bool ensureWritableDir(const QString &name)
static QString automaticPipelineCacheFileName(QRhi *rhi)
static bool isAutomaticPipelineCacheSaveSkippedForWindow(Qt::WindowFlags wflags)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define qPrintable(string)
QLatin1StringView QLatin1String
#define QT_CONFIG(feature)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
\inmodule QtCore \reentrant
bool contains(const AT &t) const noexcept
QRhiCommandBuffer * commandBuffer
QQuickWindowRenderTarget rt
\variable QRhiReadbackResult::completed
qint64 totalPipelineCreationTime