aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-10-07 12:32:04 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2020-10-09 09:03:20 +0200
commit43dbc7cbd14686d7a27e78b0a6c902be429d0f9a (patch)
treef1d8b46bd269a5d8bb4b68a070e263a6d9620d62
parent352c1a3d4b0536dd04440512cd2502c3a55e8c0c (diff)
Adapt to platform API rename
Change-Id: I1f2171e18ec3df71f7eaec1be0e0e0d1442a3860 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm2
-rw-r--r--examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp4
-rw-r--r--src/quick/items/qquickframebufferobject.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp4
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.cpp74
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture_mac.mm4
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture_p.h8
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture_platform.h4
9 files changed, 52 insertions, 52 deletions
diff --git a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
index a9b609f49f..9698b16f0b 100644
--- a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
+++ b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
@@ -263,7 +263,7 @@ void CustomTextureNode::sync()
m_texture = [m_device newTextureWithDescriptor: desc];
[desc release];
- QSGTexture *wrapper = QPlatformInterface::QSGMetalTexture::fromNative(m_texture, m_window, m_size);
+ QSGTexture *wrapper = QNativeInterface::QSGMetalTexture::fromNative(m_texture, m_window, m_size);
qDebug() << "Got QSGTexture wrapper" << wrapper << "for an MTLTexture of size" << m_size;
diff --git a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
index cb56f3aabf..26b75d54bb 100644
--- a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
+++ b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
@@ -716,12 +716,12 @@ void CustomTextureNode::sync()
delete texture();
freeTexture();
buildTexture(m_size);
- QSGTexture *wrapper = QPlatformInterface::QSGVulkanTexture::fromNative(m_texture,
+ QSGTexture *wrapper = QNativeInterface::QSGVulkanTexture::fromNative(m_texture,
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
m_window,
m_size);
setTexture(wrapper);
- Q_ASSERT(wrapper->platformInterface<QPlatformInterface::QSGVulkanTexture>()->nativeImage() == m_texture);
+ Q_ASSERT(wrapper->nativeInterface<QNativeInterface::QSGVulkanTexture>()->nativeImage() == m_texture);
}
m_t = float(static_cast<CustomTextureItem *>(m_item)->t());
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index b2bd8dfc6b..4647531e7e 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -346,7 +346,7 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
displayTexture = n->msDisplayFbo->texture();
}
- QSGTexture *wrapper = QPlatformInterface::QSGOpenGLTexture::fromNative(displayTexture,
+ QSGTexture *wrapper = QNativeInterface::QSGOpenGLTexture::fromNative(displayTexture,
window(),
n->fbo->size(),
QQuickWindow::TextureHasAlphaChannel);
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index c54df960cf..10a13cd134 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -1474,8 +1474,8 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
QQuickWindow by calling rendererInterface(). The enablers for this
integration are the beforeRendering(), beforeRenderPassRecording(),
afterRenderPassRecording(), and related signals. These allow rendering
- underlays or overlays. Alternatively, QPlatformInterface::QSGOpenGLTexture,
- QPlatformInterface::QSGVulkanTexture, and other similar classes allow
+ underlays or overlays. Alternatively, QNativeInterface::QSGOpenGLTexture,
+ QNativeInterface::QSGVulkanTexture, and other similar classes allow
wrapping an existing native texture or image object in a QSGTexture that
can then be used with the scene graph.
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp
index 0f75e7e04b..4c1b812b16 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.cpp
+++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp
@@ -689,12 +689,12 @@ QSGDynamicTexture::QSGDynamicTexture(QSGTexturePrivate &dd)
}
/*!
- \fn template<typename T> T *QSGTexture::platformInterface<T>()
+ \fn template <typename NativeInterface> NativeInterface *QSGTexture::nativeInterface() const
- Returns a platform interface of type T for the texture.
+ Returns a native interface of type T for the texture.
This function provides access to platform specific functionality of
- QSGTexture, as defined in the QPlatformInterface namespace. This allows
+ QSGTexture, as defined in the QNativeInterface namespace. This allows
accessing the underlying native texture object, such as, the \c GLuint
texture ID with OpenGL, or the \c VkImage handle with Vulkan.
@@ -702,33 +702,33 @@ QSGDynamicTexture::QSGDynamicTexture(QSGTexturePrivate &dd)
*/
/*!
- \namespace QPlatformInterface
+ \namespace QNativeInterface
\inmodule QtQuick
\since 6.0
- \brief The QPlatformInterface namespace contains graphics API specific
+ \brief The QNativeInterface namespace contains graphics API specific
interfaces that allow accessing the underlying graphics resources and allow
creating QSGTexture instances that wrap an existing native resource.
The classes in this namespace can be passed to
- QSGTexture::platformInterface() to gain access to the appropriate graphics
+ QSGTexture::nativeInterface() to gain access to the appropriate graphics
API specific interface, as long as the scene graph has been initialized with
the graphics API in question.
- \sa QSGTexture::platformInterface()
+ \sa QSGTexture::nativeInterface()
*/
#if QT_CONFIG(opengl) || defined(Q_CLANG_QDOC)
-namespace QPlatformInterface {
+namespace QNativeInterface {
/*!
- \class QPlatformInterface::QSGOpenGLTexture
+ \class QNativeInterface::QSGOpenGLTexture
\inmodule QtQuick
\brief Provides access to and enables adopting OpenGL texture objects.
\since 6.0
*/
/*!
- \fn VkImage QPlatformInterface::QSGOpenGLTexture::nativeTexture() const
+ \fn VkImage QNativeInterface::QSGOpenGLTexture::nativeTexture() const
\return the OpenGL texture ID.
*/
@@ -771,7 +771,7 @@ QSGTexture *QSGOpenGLTexture::fromNative(GLuint textureId,
{
return QQuickWindowPrivate::get(window)->createTextureFromNativeTexture(quint64(textureId), 0, size, options);
}
-} // QPlatformInterface
+} // QNativeInterface
GLuint QSGTexturePlatformOpenGL::nativeTexture() const
{
@@ -781,24 +781,24 @@ GLuint QSGTexturePlatformOpenGL::nativeTexture() const
}
template<> Q_QUICK_EXPORT
-QPlatformInterface::QSGOpenGLTexture *QSGTexture::platformInterface<QPlatformInterface::QSGOpenGLTexture>()
+QNativeInterface::QSGOpenGLTexture *QSGTexture::nativeInterface<QNativeInterface::QSGOpenGLTexture>() const
{
- Q_D(QSGTexture);
- return &d->m_openglTextureAccessor;
+ Q_D(const QSGTexture);
+ return &const_cast<QSGTexturePrivate*>(d)->m_openglTextureAccessor;
}
#endif // opengl
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
-namespace QPlatformInterface {
+namespace QNativeInterface {
/*!
- \class QPlatformInterface::QSGD3D11Texture
+ \class QNativeInterface::QSGD3D11Texture
\inmodule QtQuick
\brief Provides access to and enables adopting Direct3D 11 texture objects.
\since 6.0
*/
/*!
- \fn void *QPlatformInterface::QSGD3D11Texture::nativeTexture() const
+ \fn void *QNativeInterface::QSGD3D11Texture::nativeTexture() const
\return the ID3D11Texture2D object.
*/
@@ -840,7 +840,7 @@ QSGTexture *QSGD3D11Texture::fromNative(void *texture,
{
return QQuickWindowPrivate::get(window)->createTextureFromNativeTexture(quint64(texture), 0, size, options);
}
-} // QPlatformInterface
+} // QNativeInterface
void *QSGTexturePlatformD3D11::nativeTexture() const
{
@@ -850,29 +850,29 @@ void *QSGTexturePlatformD3D11::nativeTexture() const
}
template<> Q_QUICK_EXPORT
-QPlatformInterface::QSGD3D11Texture *QSGTexture::platformInterface<QPlatformInterface::QSGD3D11Texture>()
+QNativeInterface::QSGD3D11Texture *QSGTexture::nativeInterface<QNativeInterface::QSGD3D11Texture>() const
{
- Q_D(QSGTexture);
- return &d->m_d3d11TextureAccessor;
+ Q_D(const QSGTexture);
+ return &const_cast<QSGTexturePrivate*>(d)->m_d3d11TextureAccessor;
}
#endif // win
#if defined(__OBJC__) || defined(Q_CLANG_QDOC)
-namespace QPlatformInterface {
+namespace QNativeInterface {
/*!
- \class QPlatformInterface::QSGMetalTexture
+ \class QNativeInterface::QSGMetalTexture
\inmodule QtQuick
\brief Provides access to and enables adopting Metal texture objects.
\since 6.0
*/
/*!
- \fn id<MTLTexture> QPlatformInterface::QSGMetalTexture::nativeTexture() const
+ \fn id<MTLTexture> QNativeInterface::QSGMetalTexture::nativeTexture() const
\return the Metal texture object.
*/
/*!
- \fn QSGTexture *QPlatformInterface::QSGMetalTexture::fromNative(id<MTLTexture> texture, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options)
+ \fn QSGTexture *QNativeInterface::QSGMetalTexture::fromNative(id<MTLTexture> texture, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options)
Creates a new QSGTexture wrapping an existing Metal \a texture object.
@@ -898,32 +898,32 @@ namespace QPlatformInterface {
\since 6.0
*/
-} // QPlatformInterface
+} // QNativeInterface
template<> Q_QUICK_EXPORT
-QPlatformInterface::QSGMetalTexture *QSGTexture::platformInterface<QPlatformInterface::QSGMetalTexture>()
+QNativeInterface::QSGMetalTexture *QSGTexture::nativeInterface<QNativeInterface::QSGMetalTexture>() const
{
- Q_D(QSGTexture);
- return &d->m_metalTextureAccessor;
+ Q_D(const QSGTexture);
+ return &const_cast<QSGTexturePrivate*>(d)->m_metalTextureAccessor;
}
#endif // win
#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
-namespace QPlatformInterface {
+namespace QNativeInterface {
/*!
- \class QPlatformInterface::QSGVulkanTexture
+ \class QNativeInterface::QSGVulkanTexture
\inmodule QtQuick
\brief Provides access to and enables adopting Vulkan image objects.
\since 6.0
*/
/*!
- \fn VkImage QPlatformInterface::QSGVulkanTexture::nativeImage() const
+ \fn VkImage QNativeInterface::QSGVulkanTexture::nativeImage() const
\return the VkImage handle.
*/
/*!
- \fn VkImageLayout QPlatformInterface::QSGVulkanTexture::nativeImageLayout() const
+ \fn VkImageLayout QNativeInterface::QSGVulkanTexture::nativeImageLayout() const
\return the image layout.
*/
@@ -968,7 +968,7 @@ QSGTexture *QSGVulkanTexture::fromNative(VkImage image,
{
return QQuickWindowPrivate::get(window)->createTextureFromNativeTexture(quint64(image), layout, size, options);
}
-} // QPlatformInterface
+} // QNativeInterface
VkImage QSGTexturePlatformVulkan::nativeImage() const
{
@@ -985,10 +985,10 @@ VkImageLayout QSGTexturePlatformVulkan::nativeImageLayout() const
}
template<> Q_QUICK_EXPORT
-QPlatformInterface::QSGVulkanTexture *QSGTexture::platformInterface<QPlatformInterface::QSGVulkanTexture>()
+QNativeInterface::QSGVulkanTexture *QSGTexture::nativeInterface<QNativeInterface::QSGVulkanTexture>() const
{
- Q_D(QSGTexture);
- return &d->m_vulkanTextureAccessor;
+ Q_D(const QSGTexture);
+ return &const_cast<QSGTexturePrivate*>(d)->m_vulkanTextureAccessor;
}
#endif // vulkan
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.h b/src/quick/scenegraph/coreapi/qsgtexture.h
index 978bdef057..5492b04e11 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture.h
@@ -112,7 +112,7 @@ public:
inline QRectF convertToNormalizedSourceRect(const QRectF &rect) const;
- template<typename T> T *platformInterface();
+ QT_DECLARE_NATIVE_INTERFACE_ACCESSOR
protected:
QSGTexture(QSGTexturePrivate &dd);
diff --git a/src/quick/scenegraph/coreapi/qsgtexture_mac.mm b/src/quick/scenegraph/coreapi/qsgtexture_mac.mm
index d4b565cbfe..55090d89df 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture_mac.mm
+++ b/src/quick/scenegraph/coreapi/qsgtexture_mac.mm
@@ -52,7 +52,7 @@ id<MTLTexture> QSGTexturePlatformMetal::nativeTexture() const
return 0;
}
-namespace QPlatformInterface {
+namespace QNativeInterface {
/*!
\internal
@@ -69,6 +69,6 @@ QSGTexture *QSGMetalTexture::fromNative(id<MTLTexture> texture,
return QQuickWindowPrivate::get(window)->createTextureFromNativeTexture(quint64(texture), 0, size, options);
}
-} // QPlatformInterface
+} // QNativeInterface
QT_END_NAMESPACE
diff --git a/src/quick/scenegraph/coreapi/qsgtexture_p.h b/src/quick/scenegraph/coreapi/qsgtexture_p.h
index 05e008978a..852ed1f501 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture_p.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture_p.h
@@ -75,7 +75,7 @@ bool operator!=(const QSGSamplerDescription &a, const QSGSamplerDescription &b)
size_t qHash(const QSGSamplerDescription &s, size_t seed = 0) Q_DECL_NOTHROW;
#if QT_CONFIG(opengl)
-class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformOpenGL : public QPlatformInterface::QSGOpenGLTexture
+class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformOpenGL : public QNativeInterface::QSGOpenGLTexture
{
public:
QSGTexturePlatformOpenGL(QSGTexture *t) : m_texture(t) { }
@@ -86,7 +86,7 @@ public:
#endif
#ifdef Q_OS_WIN
-class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformD3D11 : public QPlatformInterface::QSGD3D11Texture
+class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformD3D11 : public QNativeInterface::QSGD3D11Texture
{
public:
QSGTexturePlatformD3D11(QSGTexture *t) : m_texture(t) { }
@@ -97,7 +97,7 @@ public:
#endif
#if defined(__OBJC__)
-class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformMetal : public QPlatformInterface::QSGMetalTexture
+class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformMetal : public QNativeInterface::QSGMetalTexture
{
public:
QSGTexturePlatformMetal(QSGTexture *t) : m_texture(t) { }
@@ -108,7 +108,7 @@ public:
#endif
#if QT_CONFIG(vulkan)
-class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformVulkan : public QPlatformInterface::QSGVulkanTexture
+class Q_QUICK_PRIVATE_EXPORT QSGTexturePlatformVulkan : public QNativeInterface::QSGVulkanTexture
{
public:
QSGTexturePlatformVulkan(QSGTexture *t) : m_texture(t) { }
diff --git a/src/quick/scenegraph/coreapi/qsgtexture_platform.h b/src/quick/scenegraph/coreapi/qsgtexture_platform.h
index 234f050bfc..0947e820ff 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture_platform.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture_platform.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
-namespace QPlatformInterface {
+namespace QNativeInterface {
#if QT_CONFIG(opengl) || defined(Q_CLANG_QDOC)
class Q_QUICK_EXPORT QSGOpenGLTexture
@@ -112,7 +112,7 @@ public:
};
#endif
-} // QPlatformInterface
+} // QNativeInterface
QT_END_NAMESPACE