aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2024-03-18 21:57:47 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2024-03-25 19:03:08 +0100
commit655ff8592be71b726f39d3b1a178c3ca57944715 (patch)
tree1627403b98e24632e7345b67d8efd87bb740ef48 /src/quick
parent7ff6ebb7bdf0f8ceaad50948ceda50e728b5b9cd (diff)
Use new Qt configure feature for Metal
Change-Id: I603018d3f4c6a49c39f7daed25101c24edbbfc02 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/CMakeLists.txt2
-rw-r--r--src/quick/items/qquickgraphicsdevice.cpp2
-rw-r--r--src/quick/items/qquickgraphicsdevice.h4
-rw-r--r--src/quick/items/qquickrendertarget.cpp2
-rw-r--r--src/quick/items/qquickrendertarget.h4
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture_p.h4
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture_platform.h4
-rw-r--r--src/quick/scenegraph/qsgrhisupport.cpp14
-rw-r--r--src/quick/scenegraph/qsgrhisupport_p.h2
10 files changed, 21 insertions, 21 deletions
diff --git a/src/quick/CMakeLists.txt b/src/quick/CMakeLists.txt
index 74ae42ad4c..86edb893c2 100644
--- a/src/quick/CMakeLists.txt
+++ b/src/quick/CMakeLists.txt
@@ -553,7 +553,7 @@ qt_internal_extend_target(Quick CONDITION QT_FEATURE_opengl OR QT_FEATURE_opengl
util/qquickopenglutils.cpp util/qquickopenglutils.h
)
-qt_internal_extend_target(Quick CONDITION IOS OR MACOS
+qt_internal_extend_target(Quick CONDITION QT_FEATURE_metal
SOURCES
scenegraph/coreapi/qsgtexture_mac.mm
scenegraph/qsgrhisupport_mac.mm
diff --git a/src/quick/items/qquickgraphicsdevice.cpp b/src/quick/items/qquickgraphicsdevice.cpp
index 650c72e221..84eeb3e69e 100644
--- a/src/quick/items/qquickgraphicsdevice.cpp
+++ b/src/quick/items/qquickgraphicsdevice.cpp
@@ -153,7 +153,7 @@ QQuickGraphicsDevice QQuickGraphicsDevice::fromDeviceAndContext(void *device, vo
that the native resource exists as long as necessary.
*/
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
QQuickGraphicsDevice QQuickGraphicsDevice::fromDeviceAndCommandQueue(MTLDevice *device,
MTLCommandQueue *commandQueue)
{
diff --git a/src/quick/items/qquickgraphicsdevice.h b/src/quick/items/qquickgraphicsdevice.h
index 40c8020a2d..d668f5e576 100644
--- a/src/quick/items/qquickgraphicsdevice.h
+++ b/src/quick/items/qquickgraphicsdevice.h
@@ -10,7 +10,7 @@
#include <QtGui/qvulkaninstance.h>
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(MTLDevice);
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
#endif
@@ -40,7 +40,7 @@ public:
static QQuickGraphicsDevice fromDeviceAndContext(void *device, void *context);
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
static QQuickGraphicsDevice fromDeviceAndCommandQueue(MTLDevice *device, MTLCommandQueue *commandQueue);
#endif
diff --git a/src/quick/items/qquickrendertarget.cpp b/src/quick/items/qquickrendertarget.cpp
index b8f9000d8a..54c83803b3 100644
--- a/src/quick/items/qquickrendertarget.cpp
+++ b/src/quick/items/qquickrendertarget.cpp
@@ -719,7 +719,7 @@ QQuickRenderTarget QQuickRenderTarget::fromD3D12Texture(void *texture,
\sa QQuickWindow::setRenderTarget(), QQuickRenderControl
*/
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, uint format,
const QSize &pixelSize, int sampleCount)
{
diff --git a/src/quick/items/qquickrendertarget.h b/src/quick/items/qquickrendertarget.h
index f604b91412..995eb553ec 100644
--- a/src/quick/items/qquickrendertarget.h
+++ b/src/quick/items/qquickrendertarget.h
@@ -11,7 +11,7 @@
#include <QtGui/qvulkaninstance.h>
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
Q_FORWARD_DECLARE_OBJC_CLASS(MTLTexture);
#endif
@@ -59,7 +59,7 @@ public:
static QQuickRenderTarget fromD3D12Texture(void *texture, int resourceState, uint format, uint viewFormat, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags);
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount = 1);
static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, uint viewFormat, const QSize &pixelSize, int sampleCount, int arraySize, Flags flags);
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp
index c5acb2e462..57111e9e5f 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.cpp
+++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp
@@ -87,7 +87,7 @@ QSGTexturePrivate::QSGTexturePrivate(QSGTexture *t)
, m_d3d11TextureAccessor(t)
, m_d3d12TextureAccessor(t)
#endif
-#if defined(Q_OS_APPLE)
+#if QT_CONFIG(metal)
, m_metalTextureAccessor(t)
#endif
#if QT_CONFIG(vulkan)
@@ -1047,7 +1047,7 @@ void *QSGTexture::resolveInterface(const char *name, int revision) const
#if QT_CONFIG(vulkan)
QT_NATIVE_INTERFACE_RETURN_IF(QSGVulkanTexture, &dd->m_vulkanTextureAccessor);
#endif
-#if defined(Q_OS_APPLE)
+#if QT_CONFIG(metal)
QT_NATIVE_INTERFACE_RETURN_IF(QSGMetalTexture, &dd->m_metalTextureAccessor);
#endif
#if defined(Q_OS_WIN)
diff --git a/src/quick/scenegraph/coreapi/qsgtexture_p.h b/src/quick/scenegraph/coreapi/qsgtexture_p.h
index d6e943b392..178bd23265 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture_p.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture_p.h
@@ -69,7 +69,7 @@ public:
};
#endif
-#if defined(Q_OS_APPLE)
+#if QT_CONFIG(metal)
class Q_QUICK_EXPORT QSGTexturePlatformMetal : public QNativeInterface::QSGMetalTexture
{
public:
@@ -121,7 +121,7 @@ public:
QSGTexturePlatformD3D11 m_d3d11TextureAccessor;
QSGTexturePlatformD3D12 m_d3d12TextureAccessor;
#endif
-#if defined(Q_OS_APPLE)
+#if QT_CONFIG(metal)
QSGTexturePlatformMetal m_metalTextureAccessor;
#endif
#if QT_CONFIG(vulkan)
diff --git a/src/quick/scenegraph/coreapi/qsgtexture_platform.h b/src/quick/scenegraph/coreapi/qsgtexture_platform.h
index 29e3a41302..63c35c381d 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture_platform.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture_platform.h
@@ -15,7 +15,7 @@
#include <QtGui/qvulkaninstance.h>
#endif
-#if defined(Q_OS_APPLE) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
# if defined(__OBJC__) || defined(Q_QDOC)
@protocol MTLTexture;
# define QT_OBJC_PROTOCOL(protocol) id<protocol>
@@ -68,7 +68,7 @@ struct Q_QUICK_EXPORT QSGD3D12Texture
};
#endif
-#if defined(Q_OS_APPLE) || defined(Q_QDOC)
+#if QT_CONFIG(metal) || defined(Q_QDOC)
struct Q_QUICK_EXPORT QSGMetalTexture
{
QT_DECLARE_NATIVE_INTERFACE(QSGMetalTexture, 1, QSGTexture)
diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp
index 4f7ca6b338..a24a3e6160 100644
--- a/src/quick/scenegraph/qsgrhisupport.cpp
+++ b/src/quick/scenegraph/qsgrhisupport.cpp
@@ -97,7 +97,7 @@ void QSGRhiSupport::applySettings()
}
#if defined(Q_OS_WIN)
m_rhiBackend = QRhi::D3D11;
-#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#elif QT_CONFIG(metal)
m_rhiBackend = QRhi::Metal;
#elif QT_CONFIG(opengl)
m_rhiBackend = QRhi::OpenGLES2;
@@ -120,7 +120,7 @@ void QSGRhiSupport::applySettings()
void QSGRhiSupport::adjustToPlatformQuirks()
{
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
// A macOS VM may not have Metal support at all. We have to decide at this
// point, it will be too late afterwards, and the only way is to see if
// MTLCreateSystemDefaultDevice succeeds.
@@ -612,7 +612,7 @@ QRhiTexture::Format QSGRhiSupport::toRhiTextureFormatFromDXGI(uint format, QRhiT
}
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
namespace QSGRhiSupportMac {
QRhiTexture::Format toRhiTextureFormatFromMetal(uint format, QRhiTexture::Flags *flags);
}
@@ -772,7 +772,7 @@ static const void *qsgrhi_d3d12_rifResource(QSGRendererInterface::Resource res,
}
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
static const void *qsgrhi_mtl_rifResource(QSGRendererInterface::Resource res, const QRhiNativeHandles *nat,
const QRhiNativeHandles *cbNat)
{
@@ -849,7 +849,7 @@ const void *QSGRhiSupport::rifResource(QSGRendererInterface::Resource res,
case QRhi::D3D12:
return qsgrhi_d3d12_rifResource(res, nat);
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
case QRhi::Metal:
{
QRhiCommandBuffer *cb = rc->currentFrameCommandBuffer();
@@ -1262,7 +1262,7 @@ QSGRhiSupport::RhiCreateResult QSGRhiSupport::createRhi(QQuickWindow *window, QS
}
}
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
if (backend == QRhi::Metal) {
QRhiMetalInitParams rhiParams;
if (customDevD->type == QQuickGraphicsDevicePrivate::Type::DeviceAndCommandQueue) {
@@ -1595,7 +1595,7 @@ QRhiTexture::Format QSGRhiSupport::toRhiTextureFormat(uint nativeFormat, QRhiTex
case QRhi::D3D12:
return toRhiTextureFormatFromDXGI(nativeFormat, flags);
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
case QRhi::Metal:
return toRhiTextureFormatFromMetal(nativeFormat, flags);
#endif
diff --git a/src/quick/scenegraph/qsgrhisupport_p.h b/src/quick/scenegraph/qsgrhisupport_p.h
index b832f55676..535317d48c 100644
--- a/src/quick/scenegraph/qsgrhisupport_p.h
+++ b/src/quick/scenegraph/qsgrhisupport_p.h
@@ -56,7 +56,7 @@ public:
static QRhiTexture::Format toRhiTextureFormatFromDXGI(uint format, QRhiTexture::Flags *flags);
#endif
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if QT_CONFIG(metal)
static QRhiTexture::Format toRhiTextureFormatFromMetal(uint format, QRhiTexture::Flags *flags);
#endif