summaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-29 16:09:46 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-08-03 16:32:30 +0200
commitfb96109bbc2ec5d83171a70d6c164d79695d2ddd (patch)
treeba31b5ab614cd57695b43860ddae3eae6e508a54 /examples/quick
parent6826b2decc21cbf390076efa3a0d6c412563f94a (diff)
Add type safe native texture accessors
Following the pattern from QtGui. Task-number: QTBUG-85239 Change-Id: I07b4456028d0f45223ad10e55ce65f423bab6a9b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm5
-rw-r--r--examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp9
2 files changed, 6 insertions, 8 deletions
diff --git a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
index e676ff2e5e..fa55a95ffd 100644
--- a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
+++ b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
@@ -263,10 +263,7 @@ void CustomTextureNode::sync()
m_texture = [m_device newTextureWithDescriptor: desc];
[desc release];
- QSGTexture *wrapper = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
- quint64(m_texture),
- 0,
- m_size);
+ QSGTexture *wrapper = QPlatformInterface::QSGMetalTexture::fromNative((MTLTexture *) 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 72833df7f5..cb56f3aabf 100644
--- a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
+++ b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
@@ -716,11 +716,12 @@ void CustomTextureNode::sync()
delete texture();
freeTexture();
buildTexture(m_size);
- QSGTexture *wrapper = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
- quint64(m_texture),
- VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
- m_size);
+ QSGTexture *wrapper = QPlatformInterface::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);
}
m_t = float(static_cast<CustomTextureItem *>(m_item)->t());