Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgtexture_mac.mm
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
4#include "qsgtexture_p.h"
6#include <private/qquickitem_p.h>
7#include <private/qquickwindow_p.h>
8#include <QtCore/private/qnativeinterface_p.h>
9#include <rhi/qrhi.h>
10
12
13id<MTLTexture> QSGTexturePlatformMetal::nativeTexture() const
14{
15 if (auto *tex = m_texture->rhiTexture())
16 return (id<MTLTexture>) quintptr(tex->nativeTexture().object);
17 return 0;
18}
19
20namespace QNativeInterface {
21
23
24QSGTexture *QSGMetalTexture::fromNative(id<MTLTexture> texture,
25 QQuickWindow *window,
26 const QSize &size,
27 QQuickWindow::CreateTextureOptions options)
28{
29 return QQuickWindowPrivate::get(window)->createTextureFromNativeTexture(quint64(texture), 0, size, options);
30}
31
32} // QNativeInterface
33
34QT_END_NAMESPACE
QT_DEFINE_NATIVE_INTERFACE(QSGMetalTexture)
Combined button and popup list for selecting options.