Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickrendertarget.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <rhi/qrhi.h>
6#include <QtQuick/private/qquickitem_p.h>
7#include <QtQuick/private/qquickwindow_p.h>
8#include <QtQuick/private/qsgrhisupport_p.h>
9
11
27
29 : ref(1),
31 pixelSize(other.pixelSize),
32 devicePixelRatio(other.devicePixelRatio),
33 sampleCount(other.sampleCount),
34 u(other.u),
35 customDepthTexture(other.customDepthTexture),
36 mirrorVertically(other.mirrorVertically),
37 multisampleResolve(other.multisampleResolve)
38{
39}
40
49
53void QQuickRenderTarget::detach()
54{
56}
57
66
75
80{
81 if (!d->ref.deref())
82 delete d;
83}
84
90{
91 return d->type == QQuickRenderTargetPrivate::Type::Null;
92}
93
108
122{
123 if (d->devicePixelRatio == ratio)
124 return;
125
126 detach();
127 d->devicePixelRatio = ratio;
128}
129
140{
141 return d->mirrorVertically;
142}
143
144
157{
158 if (d->mirrorVertically == enable)
159 return;
160
161 detach();
163}
164
176
217{
218 if (d->customDepthTexture == texture)
219 return;
220
221 detach();
223}
224
274#if QT_CONFIG(opengl) || defined(Q_QDOC)
275QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, uint format,
276 const QSize &pixelSize, int sampleCount)
277{
280
281 if (!textureId) {
282 qWarning("QQuickRenderTarget: textureId is invalid");
283 return rt;
284 }
285
286 if (pixelSize.isEmpty()) {
287 qWarning("QQuickRenderTarget: Cannot create with empty size");
288 return rt;
289 }
290
291 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
292 d->pixelSize = pixelSize;
293 d->sampleCount = qMax(1, sampleCount);
294
295 QRhiTexture::Flags formatFlags;
296 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromGL(format, &formatFlags);
297 d->u.nativeTexture = { textureId, 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
298
299 return rt;
300}
301
330QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount)
331{
332 return fromOpenGLTexture(textureId, 0, pixelSize, sampleCount);
333}
334
386QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags)
387{
390
391 if (!textureId) {
392 qWarning("QQuickRenderTarget: textureId is invalid");
393 return rt;
394 }
395
396 if (pixelSize.isEmpty()) {
397 qWarning("QQuickRenderTarget: Cannot create with empty size");
398 return rt;
399 }
400
401 QRhiTexture::Flags formatFlags;
402 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromGL(format, &formatFlags);
403
404 d->pixelSize = pixelSize;
405 d->sampleCount = qMax(1, sampleCount);
406 d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
407
408 if (arraySize <= 1) {
409 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
410 d->u.nativeTexture = { textureId, 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
411 } else {
412 d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
413 d->u.nativeTextureArray = { textureId, 0, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
414 }
415
416 return rt;
417}
418
445QQuickRenderTarget QQuickRenderTarget::fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount)
446{
449
450 if (!renderbufferId) {
451 qWarning("QQuickRenderTarget: renderbufferId is invalid");
452 return rt;
453 }
454
455 if (pixelSize.isEmpty()) {
456 qWarning("QQuickRenderTarget: Cannot create with empty size");
457 return rt;
458 }
459
460 d->type = QQuickRenderTargetPrivate::Type::NativeRenderbuffer;
461 d->pixelSize = pixelSize;
462 d->sampleCount = qMax(1, sampleCount);
463 d->u.nativeRenderbufferObject = renderbufferId;
464
465 return rt;
466}
467#endif
468
496#if defined(Q_OS_WIN) || defined(Q_QDOC)
497QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, uint format,
498 const QSize &pixelSize, int sampleCount)
499{
502
503 if (!texture) {
504 qWarning("QQuickRenderTarget: texture is null");
505 return rt;
506 }
507
508 if (pixelSize.isEmpty()) {
509 qWarning("QQuickRenderTarget: Cannot create with empty size");
510 return rt;
511 }
512
513 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
514 d->pixelSize = pixelSize;
515 d->sampleCount = qMax(1, sampleCount);
516
517 QRhiTexture::Flags formatFlags;
518 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &formatFlags);
519 d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
520
521 return rt;
522}
523
549QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount)
550{
551 return fromD3D11Texture(texture, 0 /* DXGI_FORMAT_UNKNOWN */, pixelSize, sampleCount);
552}
553
590QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, uint format, const QSize &pixelSize, int sampleCount, Flags flags)
591{
592 QQuickRenderTarget rt = fromD3D11Texture(texture, format, pixelSize, sampleCount);
593 QQuickRenderTargetPrivate::get(&rt)->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
594 return rt;
595}
596
627QQuickRenderTarget QQuickRenderTarget::fromD3D12Texture(void *texture,
628 int resourceState,
629 uint format,
630 const QSize &pixelSize,
631 int sampleCount)
632{
635
636 if (!texture) {
637 qWarning("QQuickRenderTarget: texture is null");
638 return rt;
639 }
640
641 if (pixelSize.isEmpty()) {
642 qWarning("QQuickRenderTarget: Cannot create with empty size");
643 return rt;
644 }
645
646 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
647 d->pixelSize = pixelSize;
648 d->sampleCount = qMax(1, sampleCount);
649
650 QRhiTexture::Flags formatFlags;
651 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &formatFlags);
652 d->u.nativeTexture = { quint64(texture), resourceState, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
653
654 return rt;
655}
656
712QQuickRenderTarget QQuickRenderTarget::fromD3D12Texture(void *texture,
713 int resourceState,
714 uint format,
715 uint viewFormat,
716 const QSize &pixelSize,
717 int sampleCount,
718 int arraySize,
719 Flags flags)
720{
723
724 if (!texture) {
725 qWarning("QQuickRenderTarget: texture is null");
726 return rt;
727 }
728
729 if (pixelSize.isEmpty()) {
730 qWarning("QQuickRenderTarget: Cannot create with empty size");
731 return rt;
732 }
733
734 QRhiTexture::Flags formatFlags;
735 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(format, &formatFlags);
736 QRhiTexture::Flags viewFormatFlags;
737 QRhiTexture::Format rhiViewFormat = QSGRhiSupport::toRhiTextureFormatFromDXGI(viewFormat, &viewFormatFlags);
738
739 d->pixelSize = pixelSize;
740 d->sampleCount = qMax(1, sampleCount);
741 d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
742
743 if (arraySize <= 1) {
744 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
745 d->u.nativeTexture = { quint64(texture), resourceState, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
746 } else {
747 d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
748 d->u.nativeTextureArray = { quint64(texture), resourceState, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
749 }
750
751 return rt;
752}
753
754#endif // Q_OS_WIN
755
783#if QT_CONFIG(metal) || defined(Q_QDOC)
784QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, uint format,
785 const QSize &pixelSize, int sampleCount)
786{
789
790 if (!texture) {
791 qWarning("QQuickRenderTarget: texture is null");
792 return rt;
793 }
794
795 if (pixelSize.isEmpty()) {
796 qWarning("QQuickRenderTarget: Cannot create with empty size");
797 return rt;
798 }
799
800 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
801 d->pixelSize = pixelSize;
802 d->sampleCount = qMax(1, sampleCount);
803
804 QRhiTexture::Flags formatFlags;
805 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(format, &formatFlags);
806 d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
807
808 return rt;
809}
810
836QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount)
837{
838 return fromMetalTexture(texture, 0 /* MTLPixelFormatInvalid */, pixelSize, sampleCount);
839}
840
892QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, uint format, uint viewFormat,
893 const QSize &pixelSize, int sampleCount, int arraySize, Flags flags)
894{
897
898 if (!texture) {
899 qWarning("QQuickRenderTarget: texture is null");
900 return rt;
901 }
902
903 if (pixelSize.isEmpty()) {
904 qWarning("QQuickRenderTarget: Cannot create with empty size");
905 return rt;
906 }
907
908 QRhiTexture::Flags formatFlags;
909 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(format, &formatFlags);
910 QRhiTexture::Flags viewFormatFlags;
911 QRhiTexture::Format rhiViewFormat = QSGRhiSupport::toRhiTextureFormatFromMetal(viewFormat, &viewFormatFlags);
912
913 d->pixelSize = pixelSize;
914 d->sampleCount = qMax(1, sampleCount);
915 d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
916
917 if (arraySize <= 1) {
918 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
919 d->u.nativeTexture = { quint64(texture), 0, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
920 } else {
921 d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
922 d->u.nativeTextureArray = { quint64(texture), 0, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
923 }
924
925 return rt;
926}
927
928#endif
929
958#if QT_CONFIG(vulkan) || defined(Q_QDOC)
959QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount)
960{
963
964 if (image == VK_NULL_HANDLE) {
965 qWarning("QQuickRenderTarget: image is invalid");
966 return rt;
967 }
968
969 if (pixelSize.isEmpty()) {
970 qWarning("QQuickRenderTarget: Cannot create with empty size");
971 return rt;
972 }
973
974 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
975 d->pixelSize = pixelSize;
976 d->sampleCount = qMax(1, sampleCount);
977
978 QRhiTexture::Flags formatFlags;
979 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(format, &formatFlags);
980 d->u.nativeTexture = { quint64(image), layout, uint(rhiFormat), uint(formatFlags), uint(rhiFormat), uint(formatFlags) };
981
982 return rt;
983}
984
1010QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount)
1011{
1012 return fromVulkanImage(image, layout, VK_FORMAT_UNDEFINED, pixelSize, sampleCount);
1013}
1014
1067QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, VkFormat viewFormat,
1068 const QSize &pixelSize, int sampleCount, int arraySize, Flags flags)
1069{
1072
1073 if (image == VK_NULL_HANDLE) {
1074 qWarning("QQuickRenderTarget: image is invalid");
1075 return rt;
1076 }
1077
1078 if (pixelSize.isEmpty()) {
1079 qWarning("QQuickRenderTarget: Cannot create with empty size");
1080 return rt;
1081 }
1082
1083 QRhiTexture::Flags formatFlags;
1084 QRhiTexture::Format rhiFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(format, &formatFlags);
1085 QRhiTexture::Flags viewFormatFlags;
1086 QRhiTexture::Format rhiViewFormat = QSGRhiSupport::toRhiTextureFormatFromVulkan(viewFormat, &viewFormatFlags);
1087
1088 d->pixelSize = pixelSize;
1089 d->sampleCount = qMax(1, sampleCount);
1090 d->multisampleResolve = flags.testFlag(Flag::MultisampleResolve);
1091
1092 if (arraySize <= 1) {
1093 d->type = QQuickRenderTargetPrivate::Type::NativeTexture;
1094 d->u.nativeTexture = { quint64(image), layout, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
1095 } else {
1096 d->type = QQuickRenderTargetPrivate::Type::NativeTextureArray;
1097 d->u.nativeTextureArray = { quint64(image), layout, arraySize, uint(rhiFormat), uint(formatFlags), uint(rhiViewFormat), uint(viewFormatFlags) };
1098 }
1099
1100 return rt;
1101}
1102
1103#endif // Vulkan
1104
1122{
1125
1126 if (!renderTarget) {
1127 qWarning("QQuickRenderTarget: Needs a valid QRhiRenderTarget");
1128 return rt;
1129 }
1130
1131 d->type = QQuickRenderTargetPrivate::Type::RhiRenderTarget;
1132 d->pixelSize = renderTarget->pixelSize();
1133 d->sampleCount = renderTarget->sampleCount();
1134 d->u.rhiRt = renderTarget;
1135
1136 return rt;
1137}
1138
1154{
1157
1158 d->type = QQuickRenderTargetPrivate::Type::PaintDevice;
1159 d->pixelSize = QSize(device->width(), device->height());
1160 d->u.paintDevice = device;
1161
1162 return rt;
1163}
1164
1180bool QQuickRenderTarget::isEqual(const QQuickRenderTarget &other) const noexcept
1181{
1182 if (d->type != other.d->type
1183 || d->pixelSize != other.d->pixelSize
1184 || d->devicePixelRatio != other.d->devicePixelRatio
1185 || d->sampleCount != other.d->sampleCount
1186 || d->mirrorVertically != other.d->mirrorVertically
1187 || d->multisampleResolve != other.d->multisampleResolve)
1188 {
1189 return false;
1190 }
1191
1192 switch (d->type) {
1193 case QQuickRenderTargetPrivate::Type::Null:
1194 break;
1195 case QQuickRenderTargetPrivate::Type::NativeTexture:
1196 if (d->u.nativeTexture.object != other.d->u.nativeTexture.object
1197 || d->u.nativeTexture.layoutOrState != other.d->u.nativeTexture.layoutOrState
1198 || d->u.nativeTexture.rhiFormat != other.d->u.nativeTexture.rhiFormat
1199 || d->u.nativeTexture.rhiFormatFlags != other.d->u.nativeTexture.rhiFormatFlags
1200 || d->u.nativeTexture.rhiViewFormat != other.d->u.nativeTexture.rhiViewFormat
1201 || d->u.nativeTexture.rhiViewFormatFlags != other.d->u.nativeTexture.rhiViewFormatFlags)
1202 return false;
1203 break;
1204 case QQuickRenderTargetPrivate::Type::NativeTextureArray:
1205 if (d->u.nativeTextureArray.object != other.d->u.nativeTextureArray.object
1206 || d->u.nativeTextureArray.layoutOrState != other.d->u.nativeTextureArray.layoutOrState
1207 || d->u.nativeTextureArray.arraySize != other.d->u.nativeTextureArray.arraySize
1208 || d->u.nativeTextureArray.rhiFormat != other.d->u.nativeTextureArray.rhiFormat
1209 || d->u.nativeTextureArray.rhiFormatFlags != other.d->u.nativeTextureArray.rhiFormatFlags
1210 || d->u.nativeTextureArray.rhiViewFormat != other.d->u.nativeTextureArray.rhiViewFormat
1211 || d->u.nativeTextureArray.rhiViewFormatFlags != other.d->u.nativeTextureArray.rhiViewFormatFlags)
1212 return false;
1213 break;
1214 case QQuickRenderTargetPrivate::Type::NativeRenderbuffer:
1215 if (d->u.nativeRenderbufferObject != other.d->u.nativeRenderbufferObject)
1216 return false;
1217 break;
1218 case QQuickRenderTargetPrivate::Type::RhiRenderTarget:
1219 if (d->u.rhiRt != other.d->u.rhiRt)
1220 return false;
1221 break;
1222 case QQuickRenderTargetPrivate::Type::PaintDevice:
1223 if (d->u.paintDevice != other.d->u.paintDevice)
1224 return false;
1225 break;
1226 default:
1227 break;
1228 }
1229
1230 return true;
1231}
1232
1234 const QSize &pixelSize,
1235 int sampleCount,
1236 QRhi *rhi,
1238{
1239 sampleCount = QSGRhiSupport::chooseSampleCount(sampleCount, rhi);
1240
1241 std::unique_ptr<QRhiRenderBuffer> depthStencil;
1242 if (dst->implicitBuffers.depthStencil) {
1243 if (dst->implicitBuffers.depthStencil->pixelSize() == pixelSize
1244 && dst->implicitBuffers.depthStencil->sampleCount() == sampleCount)
1245 {
1246 depthStencil.reset(dst->implicitBuffers.depthStencil);
1247 dst->implicitBuffers.depthStencil = nullptr;
1248 }
1249 }
1250 dst->implicitBuffers.reset(rhi);
1251
1252 if (!depthStencil) {
1253 depthStencil.reset(rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, pixelSize, sampleCount));
1254 depthStencil->setName(QByteArrayLiteral("Depth-stencil buffer for QQuickRenderTarget"));
1255 if (!depthStencil->create()) {
1256 qWarning("Failed to build depth-stencil buffer for QQuickRenderTarget");
1257 return false;
1258 }
1259 }
1260
1261 QRhiColorAttachment colorAttachment(renderBuffer);
1262 QRhiTextureRenderTargetDescription rtDesc(colorAttachment);
1263 rtDesc.setDepthStencilBuffer(depthStencil.get());
1264 std::unique_ptr<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget(rtDesc));
1265 rt->setName(QByteArrayLiteral("RT for QQuickRenderTarget with renderbuffer"));
1266 std::unique_ptr<QRhiRenderPassDescriptor> rp(rt->newCompatibleRenderPassDescriptor());
1267 rt->setRenderPassDescriptor(rp.get());
1268
1269 if (!rt->create()) {
1270 qWarning("Failed to build renderbuffer-based render target for QQuickRenderTarget");
1271 return false;
1272 }
1273
1274 dst->rt.renderTarget = rt.release();
1275 dst->rt.owns = true;
1276 dst->res.rpDesc = rp.release();
1277 dst->implicitBuffers.depthStencil = depthStencil.release();
1278
1279 return true;
1280}
1281
1283 const QSize &pixelSize,
1284 int sampleCount,
1285 bool multisampleResolve,
1286 QRhi *rhi,
1288{
1289 // Simple path: no user-supplied depth texture. So create our own
1290 // depth-stencil buffer, using renderbuffers (so this is still GLES 2.0
1291 // compatible), with MSAA support being GLES 3.0 compatible.
1292
1293 sampleCount = QSGRhiSupport::chooseSampleCount(sampleCount, rhi);
1294 if (sampleCount <= 1)
1295 multisampleResolve = false;
1296
1297 std::unique_ptr<QRhiRenderBuffer> depthStencil;
1298 if (dst->implicitBuffers.depthStencil) {
1299 if (dst->implicitBuffers.depthStencil->pixelSize() == pixelSize
1300 && dst->implicitBuffers.depthStencil->sampleCount() == sampleCount)
1301 {
1302 depthStencil.reset(dst->implicitBuffers.depthStencil);
1303 dst->implicitBuffers.depthStencil = nullptr;
1304 }
1305 }
1306
1307 std::unique_ptr<QRhiTexture> colorBuffer;
1308 QRhiTexture::Flags multisampleTextureFlags;
1309 QRhiTexture::Format multisampleTextureFormat = texture->format();
1310 if (multisampleResolve) {
1311 multisampleTextureFlags = QRhiTexture::RenderTarget;
1312 if (texture->flags().testFlag(QRhiTexture::sRGB))
1313 multisampleTextureFlags |= QRhiTexture::sRGB;
1314
1315 if (dst->implicitBuffers.multisampleTexture) {
1316 if (dst->implicitBuffers.multisampleTexture->pixelSize() == pixelSize
1317 && dst->implicitBuffers.multisampleTexture->format() == multisampleTextureFormat
1318 && dst->implicitBuffers.multisampleTexture->sampleCount() == sampleCount
1319 && dst->implicitBuffers.multisampleTexture->flags().testFlags(multisampleTextureFlags))
1320 {
1321 colorBuffer.reset(dst->implicitBuffers.multisampleTexture);
1322 dst->implicitBuffers.multisampleTexture = nullptr;
1323 }
1324 }
1325 }
1326
1327 dst->implicitBuffers.reset(rhi);
1328
1329 if (!depthStencil) {
1330 depthStencil.reset(rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, pixelSize, sampleCount));
1331 depthStencil->setName(QByteArrayLiteral("Depth-stencil buffer for QQuickRenderTarget"));
1332 if (!depthStencil->create()) {
1333 qWarning("Failed to build depth-stencil buffer for QQuickRenderTarget");
1334 return false;
1335 }
1336 }
1337
1338 if (multisampleResolve && !colorBuffer) {
1339 colorBuffer.reset(rhi->newTexture(multisampleTextureFormat, pixelSize, sampleCount, multisampleTextureFlags));
1340 colorBuffer->setName(QByteArrayLiteral("Multisample color buffer for QQuickRenderTarget"));
1341 colorBuffer->setWriteViewFormat(texture->writeViewFormat());
1342 if (!colorBuffer->create()) {
1343 qWarning("Failed to build multisample color buffer for QQuickRenderTarget");
1344 return false;
1345 }
1346 }
1347
1348 QRhiColorAttachment colorAttachment;
1349 if (multisampleResolve) {
1350 colorAttachment.setTexture(colorBuffer.get());
1351 colorAttachment.setResolveTexture(texture);
1352 } else {
1353 colorAttachment.setTexture(texture);
1354 }
1355 QRhiTextureRenderTargetDescription rtDesc(colorAttachment);
1356 rtDesc.setDepthStencilBuffer(depthStencil.get());
1357 std::unique_ptr<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget(rtDesc));
1358 rt->setName(QByteArrayLiteral("RT for QQuickRenderTarget"));
1359 std::unique_ptr<QRhiRenderPassDescriptor> rp(rt->newCompatibleRenderPassDescriptor());
1360 rt->setRenderPassDescriptor(rp.get());
1361
1362 if (!rt->create()) {
1363 qWarning("Failed to build texture render target for QQuickRenderTarget");
1364 return false;
1365 }
1366
1367 dst->rt.renderTarget = rt.release();
1368 dst->rt.owns = true;
1369 dst->res.rpDesc = rp.release();
1370 dst->implicitBuffers.depthStencil = depthStencil.release();
1371 if (multisampleResolve)
1372 dst->implicitBuffers.multisampleTexture = colorBuffer.release();
1373
1374 return true;
1375}
1376
1378 QRhiTexture *depthTexture,
1379 const QSize &pixelSize,
1380 int sampleCount,
1381 bool multisampleResolve,
1382 QRhi *rhi,
1384{
1385 // This version takes a user-supplied depthTexture. That texture is always
1386 // non-multisample. If sample count is > 1, we still need our own
1387 // multisample depth-stencil buffer, and the depth(stencil) data is expected
1388 // to be resolved (and written out) to depthTexture, _if_ the underlying API
1389 // supports it (see QRhi's ResolveDepthStencil feature). The intermediate,
1390 // multisample depth-stencil buffer must be a texture here (not
1391 // renderbuffer), specifically for OpenGL ES and its related multisample
1392 // extensions.
1393
1394 sampleCount = QSGRhiSupport::chooseSampleCount(sampleCount, rhi);
1395 if (sampleCount <= 1)
1396 multisampleResolve = false;
1397
1398 std::unique_ptr<QRhiTexture> depthStencil;
1399 if (dst->implicitBuffers.depthStencilTexture) {
1400 if (dst->implicitBuffers.depthStencilTexture->pixelSize() == pixelSize
1401 && dst->implicitBuffers.depthStencilTexture->sampleCount() == sampleCount)
1402 {
1403 depthStencil.reset(dst->implicitBuffers.depthStencilTexture);
1404 dst->implicitBuffers.depthStencilTexture = nullptr;
1405 }
1406 }
1407
1408 std::unique_ptr<QRhiTexture> colorBuffer;
1409 QRhiTexture::Flags multisampleTextureFlags;
1410 QRhiTexture::Format multisampleTextureFormat = texture->format();
1411 if (multisampleResolve) {
1412 multisampleTextureFlags = QRhiTexture::RenderTarget;
1413 if (texture->flags().testFlag(QRhiTexture::sRGB))
1414 multisampleTextureFlags |= QRhiTexture::sRGB;
1415
1416 if (dst->implicitBuffers.multisampleTexture) {
1417 if (dst->implicitBuffers.multisampleTexture->pixelSize() == pixelSize
1418 && dst->implicitBuffers.multisampleTexture->format() == multisampleTextureFormat
1419 && dst->implicitBuffers.multisampleTexture->sampleCount() == sampleCount
1420 && dst->implicitBuffers.multisampleTexture->flags().testFlags(multisampleTextureFlags))
1421 {
1422 colorBuffer.reset(dst->implicitBuffers.multisampleTexture);
1423 dst->implicitBuffers.multisampleTexture = nullptr;
1424 }
1425 }
1426 }
1427
1428 dst->implicitBuffers.reset(rhi);
1429
1430 bool needsDepthStencilBuffer = true;
1431 if (sampleCount <= 1) {
1432 depthStencil.reset();
1433 needsDepthStencilBuffer = false;
1434 }
1435 if (depthTexture->pixelSize() != pixelSize) {
1436 qWarning("Custom depth texture size (%dx%d) does not match the QQuickRenderTarget (%dx%d)",
1437 depthTexture->pixelSize().width(),
1438 depthTexture->pixelSize().height(),
1439 pixelSize.width(),
1440 pixelSize.height());
1441 return false;
1442 }
1443 if (depthTexture->sampleCount() > 1) {
1444 qWarning("Custom depth texture cannot be multisample");
1445 return false;
1446 }
1447 if (needsDepthStencilBuffer && !depthStencil) {
1448 depthStencil.reset(rhi->newTexture(QRhiTexture::D24S8, pixelSize, sampleCount, QRhiTexture::RenderTarget));
1449 depthStencil->setName(QByteArrayLiteral("Depth-stencil texture for QQuickRenderTarget"));
1450 if (!depthStencil->create()) {
1451 qWarning("Failed to build depth-stencil buffer for QQuickRenderTarget");
1452 return false;
1453 }
1454 }
1455
1456 if (multisampleResolve && !colorBuffer) {
1457 colorBuffer.reset(rhi->newTexture(multisampleTextureFormat, pixelSize, sampleCount, multisampleTextureFlags));
1458 colorBuffer->setName(QByteArrayLiteral("Multisample color buffer for QQuickRenderTarget"));
1459 colorBuffer->setWriteViewFormat(texture->writeViewFormat());
1460 if (!colorBuffer->create()) {
1461 qWarning("Failed to build multisample color buffer for QQuickRenderTarget");
1462 return false;
1463 }
1464 }
1465
1466 QRhiColorAttachment colorAttachment;
1467 if (multisampleResolve) {
1468 colorAttachment.setTexture(colorBuffer.get());
1469 colorAttachment.setResolveTexture(texture);
1470 } else {
1471 colorAttachment.setTexture(texture);
1472 }
1473
1474 QRhiTextureRenderTargetDescription rtDesc(colorAttachment);
1475 if (sampleCount > 1) {
1476 rtDesc.setDepthTexture(depthStencil.get());
1478 rtDesc.setDepthResolveTexture(depthTexture);
1479 else
1480 qWarning("Depth-stencil resolve is not supported by the underlying 3D API, depth contents will not be resolved");
1481 } else {
1482 rtDesc.setDepthTexture(depthTexture);
1483 }
1484
1485 std::unique_ptr<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget(rtDesc));
1486 rt->setName(QByteArrayLiteral("RT for QQuickRenderTarget"));
1487 std::unique_ptr<QRhiRenderPassDescriptor> rp(rt->newCompatibleRenderPassDescriptor());
1488 rt->setRenderPassDescriptor(rp.get());
1489
1490 if (!rt->create()) {
1491 qWarning("Failed to build texture render target for QQuickRenderTarget");
1492 return false;
1493 }
1494
1495 dst->rt.renderTarget = rt.release();
1496 dst->rt.owns = true;
1497 dst->res.rpDesc = rp.release();
1498 if (depthStencil)
1499 dst->implicitBuffers.depthStencilTexture = depthStencil.release();
1500 if (multisampleResolve)
1501 dst->implicitBuffers.multisampleTexture = colorBuffer.release();
1502
1503 return true;
1504}
1505
1507 QRhiTexture *maybeCustomDepthTexture,
1508 const QSize &pixelSize,
1509 int arraySize,
1510 int sampleCount,
1511 bool multisampleResolve,
1512 QRhi *rhi,
1514{
1515 // Multiview path, working with texture arrays. Optionally with a
1516 // user-supplied, non-multisample depth texture (array). (same semantics
1517 // then as with createRhiRenderTargetWithDepthTexture, but everything is a
1518 // 2D texture array here)
1519
1520 sampleCount = QSGRhiSupport::chooseSampleCount(sampleCount, rhi);
1521 if (sampleCount <= 1)
1522 multisampleResolve = false;
1523
1524 std::unique_ptr<QRhiTexture> depthStencil;
1525 if (dst->implicitBuffers.depthStencilTexture) {
1526 if (dst->implicitBuffers.depthStencilTexture->pixelSize() == pixelSize
1527 && dst->implicitBuffers.depthStencilTexture->sampleCount() == sampleCount
1528 && dst->implicitBuffers.depthStencilTexture->arraySize() == arraySize)
1529 {
1530 depthStencil.reset(dst->implicitBuffers.depthStencilTexture);
1531 dst->implicitBuffers.depthStencilTexture = nullptr;
1532 }
1533 }
1534
1535 std::unique_ptr<QRhiTexture> colorBuffer;
1536 QRhiTexture::Flags multisampleTextureFlags;
1537 QRhiTexture::Format multisampleTextureFormat = texture->format();
1538 if (multisampleResolve) {
1539 multisampleTextureFlags = QRhiTexture::RenderTarget;
1540 if (texture->flags().testFlag(QRhiTexture::sRGB))
1541 multisampleTextureFlags |= QRhiTexture::sRGB;
1542
1543 if (dst->implicitBuffers.multisampleTexture) {
1544 if (dst->implicitBuffers.multisampleTexture->pixelSize() == pixelSize
1545 && dst->implicitBuffers.multisampleTexture->format() == multisampleTextureFormat
1546 && dst->implicitBuffers.multisampleTexture->sampleCount() == sampleCount
1547 && dst->implicitBuffers.multisampleTexture->arraySize() == arraySize
1548 && dst->implicitBuffers.multisampleTexture->flags().testFlags(multisampleTextureFlags))
1549 {
1550 colorBuffer.reset(dst->implicitBuffers.multisampleTexture);
1551 dst->implicitBuffers.multisampleTexture = nullptr;
1552 }
1553 }
1554 }
1555
1556 dst->implicitBuffers.reset(rhi);
1557
1558 bool needsDepthStencilBuffer = true;
1559 if (maybeCustomDepthTexture) {
1560 if (sampleCount <= 1) {
1561 depthStencil.reset();
1562 needsDepthStencilBuffer = false;
1563 }
1564 if (maybeCustomDepthTexture->arraySize() != arraySize) {
1565 qWarning("Custom depth texture array size (%d) does not match QQuickRenderTarget (%d)",
1566 maybeCustomDepthTexture->arraySize(), arraySize);
1567 return false;
1568 }
1569 if (maybeCustomDepthTexture->pixelSize() != pixelSize) {
1570 qWarning("Custom depth texture size (%dx%d) does not match the QQuickRenderTarget (%dx%d)",
1571 maybeCustomDepthTexture->pixelSize().width(),
1572 maybeCustomDepthTexture->pixelSize().height(),
1573 pixelSize.width(),
1574 pixelSize.height());
1575 return false;
1576 }
1577 if (maybeCustomDepthTexture->sampleCount() > 1) {
1578 qWarning("Custom depth texture cannot be multisample");
1579 return false;
1580 }
1581 }
1582 if (needsDepthStencilBuffer && !depthStencil) {
1583 depthStencil.reset(rhi->newTextureArray(QRhiTexture::D24S8, arraySize, pixelSize, sampleCount, QRhiTexture::RenderTarget));
1584 depthStencil->setName(QByteArrayLiteral("Depth-stencil buffer (multiview) for QQuickRenderTarget"));
1585 if (!depthStencil->create()) {
1586 qWarning("Failed to build depth-stencil texture array for QQuickRenderTarget");
1587 return false;
1588 }
1589 }
1590
1591 if (multisampleResolve && !colorBuffer) {
1592 colorBuffer.reset(rhi->newTextureArray(multisampleTextureFormat, arraySize, pixelSize, sampleCount, multisampleTextureFlags));
1593 colorBuffer->setName(QByteArrayLiteral("Multisample color buffer (multiview) for QQuickRenderTarget"));
1594 colorBuffer->setWriteViewFormat(texture->writeViewFormat());
1595 if (!colorBuffer->create()) {
1596 qWarning("Failed to build multisample texture array for QQuickRenderTarget");
1597 return false;
1598 }
1599 }
1600
1601 QRhiColorAttachment colorAttachment;
1602 colorAttachment.setMultiViewCount(arraySize);
1603 if (multisampleResolve) {
1604 colorAttachment.setTexture(colorBuffer.get());
1605 colorAttachment.setResolveTexture(texture);
1606 } else {
1607 colorAttachment.setTexture(texture);
1608 }
1609
1610 QRhiTextureRenderTargetDescription rtDesc(colorAttachment);
1611 if (sampleCount > 1) {
1612 rtDesc.setDepthTexture(depthStencil.get());
1613 if (maybeCustomDepthTexture) {
1615 rtDesc.setDepthResolveTexture(maybeCustomDepthTexture);
1616 else
1617 qWarning("Depth-stencil resolve is not supported by the underlying 3D API, depth contents will not be resolved");
1618 }
1619 } else {
1620 if (depthStencil)
1621 rtDesc.setDepthTexture(depthStencil.get());
1622 else if (maybeCustomDepthTexture)
1623 rtDesc.setDepthTexture(maybeCustomDepthTexture);
1624 }
1625
1626 QRhiTextureRenderTarget::Flags rtFlags;
1627 if (!maybeCustomDepthTexture)
1629
1630 std::unique_ptr<QRhiTextureRenderTarget> rt(rhi->newTextureRenderTarget(rtDesc, rtFlags));
1631 rt->setName(QByteArrayLiteral("RT for multiview QQuickRenderTarget"));
1632 std::unique_ptr<QRhiRenderPassDescriptor> rp(rt->newCompatibleRenderPassDescriptor());
1633 rt->setRenderPassDescriptor(rp.get());
1634
1635 if (!rt->create()) {
1636 qWarning("Failed to build multiview texture render target for QQuickRenderTarget");
1637 return false;
1638 }
1639
1640 dst->rt.renderTarget = rt.release();
1641 dst->rt.owns = true;
1642 dst->res.rpDesc = rp.release();
1643 if (depthStencil)
1644 dst->implicitBuffers.depthStencilTexture = depthStencil.release();
1645 if (multisampleResolve)
1646 dst->implicitBuffers.multisampleTexture = colorBuffer.release();
1647
1648 dst->rt.multiViewCount = arraySize;
1649
1650 return true;
1651}
1652
1654{
1655 // dst->implicitBuffers may contain valid objects. If so, and their
1656 // properties are suitable, they are expected to be reused. Once taken what
1657 // we can reuse, it needs to be reset().
1658
1659 switch (type) {
1660 case Type::Null:
1661 dst->implicitBuffers.reset(rhi);
1662 return true;
1663
1664 case Type::NativeTexture:
1665 {
1667 : QRhiTexture::Format(u.nativeTexture.rhiFormat);
1668 QRhiTexture::Format viewFormat = u.nativeTexture.rhiViewFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
1669 : QRhiTexture::Format(u.nativeTexture.rhiViewFormat);
1670 const auto flags = QRhiTexture::RenderTarget | QRhiTexture::Flags(u.nativeTexture.rhiFormatFlags);
1671 std::unique_ptr<QRhiTexture> texture(rhi->newTexture(format, pixelSize, multisampleResolve ? 1 : sampleCount, flags));
1672 const bool textureIsSrgb = flags.testFlag(QRhiTexture::sRGB);
1673 const bool viewIsSrgb = QRhiTexture::Flags(u.nativeTexture.rhiViewFormatFlags).testFlag(QRhiTexture::sRGB);
1674 if (viewFormat != format || viewIsSrgb != textureIsSrgb)
1675 texture->setWriteViewFormat({ viewFormat, viewIsSrgb });
1676 if (!texture->createFrom({ u.nativeTexture.object, u.nativeTexture.layoutOrState })) {
1677 qWarning("Failed to build wrapper texture for QQuickRenderTarget");
1678 return false;
1679 }
1680 if (customDepthTexture) {
1682 return false;
1683 } else {
1685 return false;
1686 }
1687 dst->res.texture = texture.release();
1688 }
1689 return true;
1690
1691 case Type::NativeTextureArray:
1692 {
1694 : QRhiTexture::Format(u.nativeTextureArray.rhiFormat);
1695 QRhiTexture::Format viewFormat = u.nativeTextureArray.rhiViewFormat == QRhiTexture::UnknownFormat ? QRhiTexture::RGBA8
1696 : QRhiTexture::Format(u.nativeTextureArray.rhiViewFormat);
1697 const auto flags = QRhiTexture::RenderTarget | QRhiTexture::Flags(u.nativeTextureArray.rhiFormatFlags);
1698 const int arraySize = u.nativeTextureArray.arraySize;
1699 std::unique_ptr<QRhiTexture> texture(rhi->newTextureArray(format, arraySize, pixelSize, multisampleResolve ? 1 : sampleCount, flags));
1700 const bool textureIsSrgb = flags.testFlag(QRhiTexture::sRGB);
1701 const bool viewIsSrgb = QRhiTexture::Flags(u.nativeTextureArray.rhiViewFormatFlags).testFlag(QRhiTexture::sRGB);
1702 if (viewFormat != format || viewIsSrgb != textureIsSrgb)
1703 texture->setWriteViewFormat({ viewFormat, viewIsSrgb });
1704 if (!texture->createFrom({ u.nativeTextureArray.object, u.nativeTextureArray.layoutOrState })) {
1705 qWarning("Failed to build wrapper texture array for QQuickRenderTarget");
1706 return false;
1707 }
1709 return false;
1710 dst->res.texture = texture.release();
1711 }
1712 return true;
1713
1714 case Type::NativeRenderbuffer:
1715 {
1716 std::unique_ptr<QRhiRenderBuffer> renderbuffer(rhi->newRenderBuffer(QRhiRenderBuffer::Color, pixelSize, sampleCount));
1717 if (!renderbuffer->createFrom({ u.nativeRenderbufferObject })) {
1718 qWarning("Failed to build wrapper renderbuffer for QQuickRenderTarget");
1719 return false;
1720 }
1722 qWarning("Custom depth texture is not supported with renderbuffers in QQuickRenderTarget");
1724 return false;
1725 dst->res.renderBuffer = renderbuffer.release();
1726 }
1727 return true;
1728
1729 case Type::RhiRenderTarget:
1730 dst->implicitBuffers.reset(rhi);
1731 dst->rt.renderTarget = u.rhiRt;
1732 dst->rt.owns = false;
1733 if (dst->rt.renderTarget->resourceType() == QRhiResource::TextureRenderTarget) {
1734 auto texRt = static_cast<QRhiTextureRenderTarget *>(dst->rt.renderTarget);
1735 const QRhiTextureRenderTargetDescription desc = texRt->description();
1736 bool first = true;
1737 for (auto it = desc.cbeginColorAttachments(), end = desc.cendColorAttachments(); it != end; ++it) {
1738 if (it->multiViewCount() <= 1)
1739 continue;
1740 if (first || dst->rt.multiViewCount == it->multiViewCount()) {
1741 first = false;
1742 if (it->texture() && it->texture()->flags().testFlag(QRhiTexture::TextureArray)) {
1743 if (it->texture()->arraySize() >= it->layer() + it->multiViewCount()) {
1744 dst->rt.multiViewCount = it->multiViewCount();
1745 } else {
1746 qWarning("Invalid QQuickRenderTarget; needs at least %d elements in texture array, got %d",
1747 it->layer() + it->multiViewCount(),
1748 it->texture()->arraySize());
1749 return false;
1750 }
1751 } else {
1752 qWarning("Invalid QQuickRenderTarget; multiview requires a texture array");
1753 return false;
1754 }
1755 } else {
1756 qWarning("Inconsistent multiViewCount in QQuickRenderTarget (was %d, now found an attachment with %d)",
1757 dst->rt.multiViewCount, it->multiViewCount());
1758 return false;
1759 }
1760 }
1761 }
1763 qWarning("Custom depth texture is not supported with QRhiRenderTarget in QQuickRenderTarget");
1764 return true;
1765
1766 case Type::PaintDevice:
1767 dst->implicitBuffers.reset(rhi);
1768 dst->sw.paintDevice = u.paintDevice;
1769 dst->sw.owns = false;
1770 return true;
1771 }
1772
1773 Q_UNREACHABLE_RETURN(false);
1774}
1775
IOBluetoothDevice * device
bool ref() noexcept
bool deref() noexcept
static QQuickRenderTargetPrivate * get(QQuickRenderTarget *rt)
union QQuickRenderTargetPrivate::@695 u
bool resolve(QRhi *rhi, QQuickWindowRenderTarget *dst)
The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a ...
static QQuickRenderTarget fromPaintDevice(QPaintDevice *device)
void setMirrorVertically(bool enable)
Sets the size of the render target contents should be mirrored vertically to enable when drawing.
void setDepthTexture(QRhiTexture *texture)
Requests using the given texture as the depth or depth-stencil buffer.
~QQuickRenderTarget()
Destructor.
QQuickRenderTarget & operator=(const QQuickRenderTarget &other)
QRhiTexture * depthTexture() const
void setDevicePixelRatio(qreal ratio)
Sets the device pixel ratio for this render target to ratio.
QQuickRenderTarget()
Constructs a default QQuickRenderTarget that does not reference any native objects.
static QQuickRenderTarget fromRhiRenderTarget(QRhiRenderTarget *renderTarget)
\inmodule QtGui
Definition qrhi.h:576
void setTexture(QRhiTexture *tex)
Sets the texture tex.
Definition qrhi.h:583
void setMultiViewCount(int count)
Sets the view count.
Definition qrhi.h:604
\inmodule QtGui
Definition qrhi.h:1094
\inmodule QtGui
Definition qrhi.h:1158
virtual QSize pixelSize() const =0
virtual int sampleCount() const =0
@ TextureRenderTarget
Definition qrhi.h:813
\inmodule QtGui
Definition qrhi.h:1184
\inmodule QtGui
Definition qrhi.h:895
@ RenderTarget
Definition qrhi.h:898
@ TextureArray
Definition qrhi.h:909
int sampleCount() const
Definition qrhi.h:995
Format
Specifies the texture format.
Definition qrhi.h:914
@ UnknownFormat
Definition qrhi.h:915
QSize pixelSize() const
Definition qrhi.h:975
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
QRhiTexture * newTextureArray(QRhiTexture::Format format, int arraySize, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
Definition qrhi.cpp:10636
bool isFeatureSupported(QRhi::Feature feature) const
Definition qrhi.cpp:10110
QRhiRenderBuffer * newRenderBuffer(QRhiRenderBuffer::Type type, const QSize &pixelSize, int sampleCount=1, QRhiRenderBuffer::Flags flags={}, QRhiTexture::Format backingFormatHint=QRhiTexture::UnknownFormat)
Definition qrhi.cpp:10535
QRhiTextureRenderTarget * newTextureRenderTarget(const QRhiTextureRenderTargetDescription &desc, QRhiTextureRenderTarget::Flags flags={})
Definition qrhi.cpp:10682
QRhiTexture * newTexture(QRhiTexture::Format format, const QSize &pixelSize, int sampleCount=1, QRhiTexture::Flags flags={})
Definition qrhi.cpp:10562
@ ResolveDepthStencil
Definition qrhi.h:1874
static int chooseSampleCount(int samples, QRhi *rhi)
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
Definition qsize.h:124
QSet< QString >::iterator it
Combined button and popup list for selecting options.
Definition image.cpp:4
QT_WARNING_POP void qAtomicAssign(T *&d, T *x)
This is a helper for the assignment operators of implicitly shared classes.
Definition qatomic.h:180
void qAtomicDetach(T *&d)
This is a helper for the detach method of implicitly shared classes.
Definition qatomic.h:199
#define QByteArrayLiteral(str)
Definition qbytearray.h:52
Flags
#define qWarning
Definition qlogging.h:166
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLuint GLuint end
GLenum type
GLenum GLenum dst
GLbitfield flags
GLboolean enable
GLenum GLuint texture
GLint ref
GLint first
GLint GLsizei GLsizei GLenum format
GLuint renderbuffer
static bool createRhiRenderTargetWithRenderBuffer(QRhiRenderBuffer *renderBuffer, const QSize &pixelSize, int sampleCount, QRhi *rhi, QQuickWindowRenderTarget *dst)
static bool createRhiRenderTargetWithDepthTexture(QRhiTexture *texture, QRhiTexture *depthTexture, const QSize &pixelSize, int sampleCount, bool multisampleResolve, QRhi *rhi, QQuickWindowRenderTarget *dst)
static bool createRhiRenderTargetMultiView(QRhiTexture *texture, QRhiTexture *maybeCustomDepthTexture, const QSize &pixelSize, int arraySize, int sampleCount, bool multisampleResolve, QRhi *rhi, QQuickWindowRenderTarget *dst)
static bool createRhiRenderTarget(QRhiTexture *texture, const QSize &pixelSize, int sampleCount, bool multisampleResolve, QRhi *rhi, QQuickWindowRenderTarget *dst)
unsigned long long quint64
Definition qtypes.h:61
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187
QVBoxLayout * layout
QSharedPointer< T > other(t)
[5]