Add configure feature for Metal
Simplifies maintenance of code paths that rely on Metal. Change-Id: I1d1f705fffc14dbafde346eeb555b43be6d5be54 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
e8e029e2a5
commit
14ec2ab89f
@ -14,7 +14,7 @@ int main(int argc, char **argv)
|
|||||||
// Use platform-specific defaults when no command-line arguments given.
|
// Use platform-specific defaults when no command-line arguments given.
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = QRhi::D3D11;
|
graphicsApi = QRhi::D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = QRhi::Metal;
|
graphicsApi = QRhi::Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = QRhi::Vulkan;
|
graphicsApi = QRhi::Vulkan;
|
||||||
|
@ -146,7 +146,7 @@ void RhiWindow::init()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (m_graphicsApi == QRhi::Metal) {
|
if (m_graphicsApi == QRhi::Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
m_rhi.reset(QRhi::create(QRhi::Metal, ¶ms));
|
m_rhi.reset(QRhi::create(QRhi::Metal, ¶ms));
|
||||||
|
@ -1006,7 +1006,7 @@ qt_internal_extend_target(Gui CONDITION QT_FEATURE_xkbcommon AND UNIX
|
|||||||
XKB::XKB
|
XKB::XKB
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_internal_extend_target(Gui CONDITION IOS OR MACOS
|
qt_internal_extend_target(Gui CONDITION QT_FEATURE_metal
|
||||||
SOURCES
|
SOURCES
|
||||||
rhi/qrhimetal.mm rhi/qrhimetal_p.h
|
rhi/qrhimetal.mm rhi/qrhimetal_p.h
|
||||||
PUBLIC_LIBRARIES
|
PUBLIC_LIBRARIES
|
||||||
|
@ -811,6 +811,10 @@ qt_feature("vulkan" PUBLIC
|
|||||||
LABEL "Vulkan"
|
LABEL "Vulkan"
|
||||||
CONDITION QT_FEATURE_library AND QT_FEATURE_vkgen AND WrapVulkanHeaders_FOUND
|
CONDITION QT_FEATURE_library AND QT_FEATURE_vkgen AND WrapVulkanHeaders_FOUND
|
||||||
)
|
)
|
||||||
|
qt_feature("metal" PUBLIC
|
||||||
|
LABEL "Metal"
|
||||||
|
CONDITION MACOS OR IOS
|
||||||
|
)
|
||||||
qt_feature("vkkhrdisplay" PRIVATE
|
qt_feature("vkkhrdisplay" PRIVATE
|
||||||
SECTION "Platform plugins"
|
SECTION "Platform plugins"
|
||||||
LABEL "VK_KHR_display"
|
LABEL "VK_KHR_display"
|
||||||
@ -1288,6 +1292,7 @@ qt_configure_add_summary_entry(ARGS "opengles31")
|
|||||||
qt_configure_add_summary_entry(ARGS "opengles32")
|
qt_configure_add_summary_entry(ARGS "opengles32")
|
||||||
qt_configure_end_summary_section() # end of "OpenGL" section
|
qt_configure_end_summary_section() # end of "OpenGL" section
|
||||||
qt_configure_add_summary_entry(ARGS "vulkan")
|
qt_configure_add_summary_entry(ARGS "vulkan")
|
||||||
|
qt_configure_add_summary_entry(ARGS "metal")
|
||||||
qt_configure_add_summary_entry(ARGS "graphicsframecapture")
|
qt_configure_add_summary_entry(ARGS "graphicsframecapture")
|
||||||
qt_configure_add_summary_entry(ARGS "sessionmanager")
|
qt_configure_add_summary_entry(ARGS "sessionmanager")
|
||||||
qt_configure_end_summary_section() # end of "Qt Gui" section
|
qt_configure_end_summary_section() # end of "Qt Gui" section
|
||||||
|
@ -18,7 +18,7 @@ int main(int argc, char **argv)
|
|||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
QRhiD3D12InitParams params;
|
QRhiD3D12InitParams params;
|
||||||
rhi.reset(QRhi::create(QRhi::D3D12, ¶ms));
|
rhi.reset(QRhi::create(QRhi::D3D12, ¶ms));
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
rhi.reset(QRhi::create(QRhi::Metal, ¶ms));
|
rhi.reset(QRhi::create(QRhi::Metal, ¶ms));
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
|
@ -107,7 +107,7 @@ bool QBackingStoreRhiSupport::create()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (!rhi && m_config.api() == QPlatformBackingStoreRhiConfig::Metal) {
|
if (!rhi && m_config.api() == QPlatformBackingStoreRhiConfig::Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
// For parity with Qt Quick, fall back to OpenGL when there is no Metal (f.ex. in macOS virtual machines).
|
// For parity with Qt Quick, fall back to OpenGL when there is no Metal (f.ex. in macOS virtual machines).
|
||||||
@ -271,7 +271,7 @@ bool QBackingStoreRhiSupport::checkForceRhi(QPlatformBackingStoreRhiConfig *outC
|
|||||||
if (config.isEnabled()) {
|
if (config.isEnabled()) {
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
config.setApi(QPlatformBackingStoreRhiConfig::D3D11);
|
config.setApi(QPlatformBackingStoreRhiConfig::D3D11);
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
config.setApi(QPlatformBackingStoreRhiConfig::Metal);
|
config.setApi(QPlatformBackingStoreRhiConfig::Metal);
|
||||||
#elif QT_CONFIG(opengl)
|
#elif QT_CONFIG(opengl)
|
||||||
config.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
|
config.setApi(QPlatformBackingStoreRhiConfig::OpenGL);
|
||||||
@ -291,7 +291,7 @@ bool QBackingStoreRhiSupport::checkForceRhi(QPlatformBackingStoreRhiConfig *outC
|
|||||||
if (backend == QStringLiteral("d3d12"))
|
if (backend == QStringLiteral("d3d12"))
|
||||||
config.setApi(QPlatformBackingStoreRhiConfig::D3D12);
|
config.setApi(QPlatformBackingStoreRhiConfig::D3D12);
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (backend == QStringLiteral("metal"))
|
if (backend == QStringLiteral("metal"))
|
||||||
config.setApi(QPlatformBackingStoreRhiConfig::Metal);
|
config.setApi(QPlatformBackingStoreRhiConfig::Metal);
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include "qrhid3d11_p.h"
|
#include "qrhid3d11_p.h"
|
||||||
#include "qrhid3d12_p.h"
|
#include "qrhid3d12_p.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
#include "qrhimetal_p.h"
|
#include "qrhimetal_p.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -8477,7 +8477,7 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case Metal:
|
case Metal:
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
|
r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
|
||||||
static_cast<QRhiMetalNativeHandles *>(importDevice));
|
static_cast<QRhiMetalNativeHandles *>(importDevice));
|
||||||
break;
|
break;
|
||||||
@ -8536,7 +8536,7 @@ bool QRhi::probe(QRhi::Implementation impl, QRhiInitParams *params)
|
|||||||
// create() and then drop the result.
|
// create() and then drop the result.
|
||||||
|
|
||||||
if (impl == Metal) {
|
if (impl == Metal) {
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
ok = QRhiMetal::probe(static_cast<QRhiMetalInitParams *>(params));
|
ok = QRhiMetal::probe(static_cast<QRhiMetalInitParams *>(params));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -8587,7 +8587,7 @@ bool QRhi::probe(QRhi::Implementation impl, QRhiInitParams *params)
|
|||||||
*/
|
*/
|
||||||
QRhiSwapChainProxyData QRhi::updateSwapChainProxyData(QRhi::Implementation impl, QWindow *window)
|
QRhiSwapChainProxyData QRhi::updateSwapChainProxyData(QRhi::Implementation impl, QWindow *window)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (impl == Metal)
|
if (impl == Metal)
|
||||||
return QRhiMetal::updateSwapChainProxyData(window);
|
return QRhiMetal::updateSwapChainProxyData(window);
|
||||||
#else
|
#else
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <QtGui/qvulkaninstance.h>
|
#include <QtGui/qvulkaninstance.h>
|
||||||
#endif
|
#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(MTLDevice);
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
|
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandQueue);
|
||||||
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandBuffer);
|
Q_FORWARD_DECLARE_OBJC_CLASS(MTLCommandBuffer);
|
||||||
@ -150,7 +150,7 @@ struct Q_GUI_EXPORT QRhiD3D12CommandBufferNativeHandles : public QRhiNativeHandl
|
|||||||
|
|
||||||
#endif // WIN/QDOC
|
#endif // WIN/QDOC
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_QDOC)
|
#if QT_CONFIG(metal) || defined(Q_QDOC)
|
||||||
|
|
||||||
struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
|
struct Q_GUI_EXPORT QRhiMetalInitParams : public QRhiInitParams
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "qgraphicsframecapture_p.h"
|
#include "qgraphicsframecapture_p.h"
|
||||||
#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
|
#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
|
||||||
#include "qgraphicsframecapturerenderdoc_p_p.h"
|
#include "qgraphicsframecapturerenderdoc_p_p.h"
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
#include "qgraphicsframecapturemetal_p_p.h"
|
#include "qgraphicsframecapturemetal_p_p.h"
|
||||||
#else
|
#else
|
||||||
#include "qgraphicsframecapture_p_p.h"
|
#include "qgraphicsframecapture_p_p.h"
|
||||||
@ -28,7 +28,7 @@ QGraphicsFrameCapture::QGraphicsFrameCapture()
|
|||||||
{
|
{
|
||||||
#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
|
#if (defined (Q_OS_WIN) || defined(Q_OS_LINUX)) && QT_CONFIG(library)
|
||||||
d.reset(new QGraphicsFrameCaptureRenderDoc);
|
d.reset(new QGraphicsFrameCaptureRenderDoc);
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
d.reset(new QGraphicsFrameCaptureMetal);
|
d.reset(new QGraphicsFrameCaptureMetal);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ static void *glNativeContext(QOpenGLContext *context) {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
nctx = context->nativeInterface<QNativeInterface::QCocoaGLContext>()->nativeContext();
|
nctx = context->nativeInterface<QNativeInterface::QCocoaGLContext>()->nativeContext();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
# define TST_D3D12
|
# define TST_D3D12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
# define TST_MTL
|
# define TST_MTL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void tst_QRhiWidget::testData()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
QRhiMetalInitParams metalInitParams;
|
QRhiMetalInitParams metalInitParams;
|
||||||
if (QRhi::probe(QRhi::Metal, &metalInitParams))
|
if (QRhi::probe(QRhi::Metal, &metalInitParams))
|
||||||
QTest::newRow("Metal") << QRhiWidget::Api::Metal;
|
QTest::newRow("Metal") << QRhiWidget::Api::Metal;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS) || defined(Q_OS_WIN) || QT_CONFIG(xcb) || defined(ANDROID)
|
#if QT_CONFIG(metal) || defined(Q_OS_WIN) || QT_CONFIG(xcb) || defined(ANDROID)
|
||||||
#include "../../shared/nativewindow.h"
|
#include "../../shared/nativewindow.h"
|
||||||
#define HAVE_NATIVE_WINDOW
|
#define HAVE_NATIVE_WINDOW
|
||||||
#endif
|
#endif
|
||||||
|
@ -84,7 +84,7 @@ QRhi::Implementation graphicsApiFromCmd(const QGuiApplication &app) {
|
|||||||
QRhi::Implementation graphicsApi;
|
QRhi::Implementation graphicsApi;
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = QRhi::D3D11;
|
graphicsApi = QRhi::D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = QRhi::Metal;
|
graphicsApi = QRhi::Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = QRhi::Vulkan;
|
graphicsApi = QRhi::Vulkan;
|
||||||
|
@ -9,7 +9,7 @@ Window::Window(QRhi::Implementation graphicsApi)
|
|||||||
: m_graphicsApi(graphicsApi)
|
: m_graphicsApi(graphicsApi)
|
||||||
{
|
{
|
||||||
m_capturer.reset(new QGraphicsFrameCapture);
|
m_capturer.reset(new QGraphicsFrameCapture);
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
qDebug("This example uses Metal Capture Manager In App API to capture frames. Press F9 to capture a frame and F10 to open it for analysis");
|
qDebug("This example uses Metal Capture Manager In App API to capture frames. Press F9 to capture a frame and F10 to open it for analysis");
|
||||||
#else
|
#else
|
||||||
qDebug("This example uses RenderDoc In App API to capture frames. Press F9 to capture a frame and F10 to open it for analysis");
|
qDebug("This example uses RenderDoc In App API to capture frames. Press F9 to capture a frame and F10 to open it for analysis");
|
||||||
@ -142,7 +142,7 @@ void Window::init()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (m_graphicsApi == QRhi::Metal) {
|
if (m_graphicsApi == QRhi::Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
m_rhi.reset(QRhi::create(QRhi::Metal, ¶ms, rhiFlags));
|
m_rhi.reset(QRhi::create(QRhi::Metal, ¶ms, rhiFlags));
|
||||||
|
@ -37,7 +37,7 @@ int main(int argc, char **argv)
|
|||||||
QRhi::Implementation graphicsApi;
|
QRhi::Implementation graphicsApi;
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = QRhi::D3D11;
|
graphicsApi = QRhi::D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = QRhi::Metal;
|
graphicsApi = QRhi::Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = QRhi::Vulkan;
|
graphicsApi = QRhi::Vulkan;
|
||||||
|
@ -120,7 +120,7 @@ void Window::init()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (m_graphicsApi == QRhi::Metal) {
|
if (m_graphicsApi == QRhi::Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
m_rhi.reset(QRhi::create(QRhi::Metal, ¶ms, rhiFlags));
|
m_rhi.reset(QRhi::create(QRhi::Metal, ¶ms, rhiFlags));
|
||||||
|
@ -91,7 +91,7 @@ void createRhi()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (graphicsApi == Metal) {
|
if (graphicsApi == Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
r.r = QRhi::create(QRhi::Metal, ¶ms);
|
r.r = QRhi::create(QRhi::Metal, ¶ms);
|
||||||
@ -469,7 +469,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = D3D11;
|
graphicsApi = D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = Metal;
|
graphicsApi = Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = Vulkan;
|
graphicsApi = Vulkan;
|
||||||
|
@ -321,7 +321,7 @@ void Renderer::createRhi()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (graphicsApi == Metal) {
|
if (graphicsApi == Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
r = QRhi::create(QRhi::Metal, ¶ms, rhiFlags);
|
r = QRhi::create(QRhi::Metal, ¶ms, rhiFlags);
|
||||||
@ -654,7 +654,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = D3D11;
|
graphicsApi = D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = Metal;
|
graphicsApi = Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = Vulkan;
|
graphicsApi = Vulkan;
|
||||||
|
@ -68,7 +68,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = D3D11;
|
graphicsApi = D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = Metal;
|
graphicsApi = Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = Vulkan;
|
graphicsApi = Vulkan;
|
||||||
@ -154,7 +154,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (graphicsApi == Metal) {
|
if (graphicsApi == Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
r = QRhi::create(QRhi::Metal, ¶ms, rhiFlags);
|
r = QRhi::create(QRhi::Metal, ¶ms, rhiFlags);
|
||||||
|
@ -261,7 +261,7 @@ void Window::init()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (graphicsApi == Metal) {
|
if (graphicsApi == Metal) {
|
||||||
QRhiMetalInitParams params;
|
QRhiMetalInitParams params;
|
||||||
m_r = QRhi::create(QRhi::Metal, ¶ms, rhiFlags);
|
m_r = QRhi::create(QRhi::Metal, ¶ms, rhiFlags);
|
||||||
@ -426,7 +426,7 @@ int main(int argc, char **argv)
|
|||||||
// Defaults.
|
// Defaults.
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
graphicsApi = D3D11;
|
graphicsApi = D3D11;
|
||||||
#elif defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#elif QT_CONFIG(metal)
|
||||||
graphicsApi = Metal;
|
graphicsApi = Metal;
|
||||||
#elif QT_CONFIG(vulkan)
|
#elif QT_CONFIG(vulkan)
|
||||||
graphicsApi = Vulkan;
|
graphicsApi = Vulkan;
|
||||||
|
@ -192,7 +192,7 @@ void Window::customRender()
|
|||||||
if (d.testStage == 6) {
|
if (d.testStage == 6) {
|
||||||
const QRhiTexture::NativeTexture nativeTexture = d.tex->nativeTexture();
|
const QRhiTexture::NativeTexture nativeTexture = d.tex->nativeTexture();
|
||||||
if (nativeTexture.object) {
|
if (nativeTexture.object) {
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
if (graphicsApi == Metal) {
|
if (graphicsApi == Metal) {
|
||||||
qDebug() << "Metal texture: " << nativeTexture.object;
|
qDebug() << "Metal texture: " << nativeTexture.object;
|
||||||
// Now could cast to id<MTLTexture> and do something with
|
// Now could cast to id<MTLTexture> and do something with
|
||||||
|
@ -53,7 +53,7 @@ private:
|
|||||||
Handle m_handle = {};
|
Handle m_handle = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
|
#if QT_CONFIG(metal)
|
||||||
|
|
||||||
@interface View : VIEW_BASE
|
@interface View : VIEW_BASE
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user