aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quick/rendercontrol/rendercontrol_d3d11/window.cpp6
-rw-r--r--examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp2
-rw-r--r--examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm2
-rw-r--r--examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp4
-rw-r--r--examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp2
-rw-r--r--src/quick/items/qquickframebufferobject.cpp2
-rw-r--r--src/quick/items/qquickrendercontrol.cpp2
-rw-r--r--src/quick/items/qquickwindow.cpp23
-rw-r--r--src/quick/items/qquickwindow.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.cpp12
-rw-r--r--src/quick/scenegraph/coreapi/qsgtexture.h2
-rw-r--r--src/quick/scenegraph/util/qsgplaintexture.cpp4
-rw-r--r--src/quick/scenegraph/util/qsgplaintexture_p.h2
-rw-r--r--tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp2
14 files changed, 28 insertions, 39 deletions
diff --git a/examples/quick/rendercontrol/rendercontrol_d3d11/window.cpp b/examples/quick/rendercontrol/rendercontrol_d3d11/window.cpp
index cb84371fed..ccbac5cbed 100644
--- a/examples/quick/rendercontrol/rendercontrol_d3d11/window.cpp
+++ b/examples/quick/rendercontrol/rendercontrol_d3d11/window.cpp
@@ -367,10 +367,8 @@ void Window::updateQuick()
if (!m_renderControl->initialize())
qWarning("Failed to initialize redirected Qt Quick rendering");
- // Redirect Qt Quick's output. (note that the QSGTexture::NativeTexture
- // struct is expected to contain a pointer to the native object, even
- // if the native object type is a pointer, such as ID3D11Texture2D*)
- m_quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ &m_res.texture, 0 },
+ // Redirect Qt Quick's output.
+ m_quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ quint64(m_res.texture), 0 },
QSize(QML_WIDTH, QML_HEIGHT),
SAMPLE_COUNT));
diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp
index fb3c0b4f4f..dc9d310ff2 100644
--- a/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp
+++ b/examples/quick/rendercontrol/rendercontrol_opengl/window_singlethreaded.cpp
@@ -182,7 +182,7 @@ void WindowSingleThreaded::createTexture()
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
f->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_textureSize.width(), m_textureSize.height(), 0,
GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
- m_quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ &m_textureId, 0 }, m_textureSize));
+ m_quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ quint64(m_textureId), 0 }, m_textureSize));
}
void WindowSingleThreaded::destroyTexture()
diff --git a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
index 61f5e7f8e1..e676ff2e5e 100644
--- a/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
+++ b/examples/quick/scenegraph/metaltextureimport/metaltextureimport.mm
@@ -264,7 +264,7 @@ void CustomTextureNode::sync()
[desc release];
QSGTexture *wrapper = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
- &m_texture,
+ quint64(m_texture),
0,
m_size);
diff --git a/examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp b/examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp
index 8c07785926..6f6ec467dc 100644
--- a/examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp
+++ b/examples/quick/scenegraph/opengltextureinthread/threadrenderer.cpp
@@ -161,7 +161,7 @@ public:
{
// Our texture node must have a texture, so use the default 0 texture.
GLuint id = 0;
- m_texture = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &id, 0, QSize(1, 1));
+ m_texture = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, id, 0, QSize(1, 1));
setTexture(m_texture);
setFiltering(QSGTexture::Linear);
}
@@ -202,7 +202,7 @@ public slots:
delete m_texture;
// note: include QQuickWindow::TextureHasAlphaChannel if the rendered content
// has alpha.
- m_texture = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, &newId, 0, QSize(1, 1));
+ m_texture = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture, newId, 0, QSize(1, 1));
setTexture(m_texture);
markDirty(DirtyMaterial);
diff --git a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
index 964984085e..72833df7f5 100644
--- a/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
+++ b/examples/quick/scenegraph/vulkantextureimport/vulkantextureimport.cpp
@@ -717,7 +717,7 @@ void CustomTextureNode::sync()
freeTexture();
buildTexture(m_size);
QSGTexture *wrapper = m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
- &m_texture,
+ quint64(m_texture),
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
m_size);
setTexture(wrapper);
diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp
index 41a56788fa..3ff6f857ab 100644
--- a/src/quick/items/qquickframebufferobject.cpp
+++ b/src/quick/items/qquickframebufferobject.cpp
@@ -349,7 +349,7 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode
}
QSGTexture *wrapper = window()->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
- &displayTexture, 0,
+ displayTexture, 0,
n->fbo->size(),
QQuickWindow::TextureHasAlphaChannel);
n->setTexture(wrapper);
diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp
index b42a3ea6aa..79cf8b73bc 100644
--- a/src/quick/items/qquickrendercontrol.cpp
+++ b/src/quick/items/qquickrendercontrol.cpp
@@ -636,7 +636,7 @@ QQuickWindow *QQuickRenderControl::window() const
if (!m_renderControl->initialize())
qWarning("Failed to initialize redirected Qt Quick rendering");
- m_quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ &m_res.texture, 0 },
+ m_quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ quint64(m_res.texture), 0 },
QSize(QML_WIDTH, QML_HEIGHT),
SAMPLE_COUNT));
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 05819c430f..28edf1eede 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -4314,7 +4314,7 @@ QOpenGLFramebufferObject *QQuickWindow::renderTarget() const
however.
\badcode
- QQuickRenderTarget rt = QQuickRenderTarget::fromNativeTexture({ &vulkanImage, VK_IMAGE_LAYOUT_PREINITIALIZED }, pixelSize);
+ QQuickRenderTarget rt = QQuickRenderTarget::fromNativeTexture({ vulkanImage, VK_IMAGE_LAYOUT_PREINITIALIZED }, pixelSize);
quickWindow->setRenderTarget(rt);
\endcode
@@ -5059,15 +5059,10 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
\a size specifies the size in pixels.
- \a nativeObjectPtr is a pointer to the native object handle. With OpenGL,
- the native handle is a GLuint value, so \a nativeObjectPtr is then a
- pointer to a GLuint. With Vulkan, the native handle is a VkImage, so \a
- nativeObjectPtr is a pointer to a VkImage. With Direct3D 11 and Metal \a
- nativeObjectPtr is a pointer to a ID3D11Texture2D or MTLTexture pointer.
-
- \note Pay attention to the fact that \a nativeObjectPtr is always a pointer
- to the native texture handle type, even if the native type itself is a
- pointer.
+ \a nativeObjectHandle is a 64-bit container for the native object handle. With
+ OpenGL, the native handle is a GLuint value, so \a nativeObjectHandle then
+ contains a GLuint. With Vulkan, \a nativeObjectHandle contains a VkImage, and
+ with Direct3D 11 and Metal it contains a ID3D11Texture2D or MTLTexture pointer.
\a nativeLayout is only used for APIs like Vulkan. When applicable, it must
specify the current image layout, such as, a VkImageLayout value.
@@ -5077,7 +5072,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
\since 5.14
*/
QSGTexture *QQuickWindow::createTextureFromNativeObject(NativeObjectType type,
- const void *nativeObjectPtr,
+ quint64 nativeObjectHandle,
int nativeLayout,
const QSize &size,
CreateTextureOptions options) const
@@ -5091,7 +5086,7 @@ QSGTexture *QQuickWindow::createTextureFromNativeObject(NativeObjectType type,
Q_D(const QQuickWindow);
if (d->rhi) {
QSGPlainTexture *texture = new QSGPlainTexture;
- texture->setTextureFromNativeObject(d->rhi, type, nativeObjectPtr, nativeLayout,
+ texture->setTextureFromNativeObject(d->rhi, type, nativeObjectHandle, nativeLayout,
size, options.testFlag(TextureHasMipmaps));
texture->setHasAlphaChannel(options & TextureHasAlphaChannel);
// note that the QRhiTexture does not (and cannot) own the native object
@@ -5100,7 +5095,7 @@ QSGTexture *QQuickWindow::createTextureFromNativeObject(NativeObjectType type,
return texture;
} else if (openglContext()) {
QSGPlainTexture *texture = new QSGPlainTexture;
- texture->setTextureId(*reinterpret_cast<const uint *>(nativeObjectPtr));
+ texture->setTextureId(uint(nativeObjectHandle));
texture->setHasAlphaChannel(options & TextureHasAlphaChannel);
texture->setOwnsTexture(options & TextureOwnsGLTexture);
texture->setTextureSize(size);
@@ -6067,7 +6062,7 @@ QString QQuickWindow::sceneGraphBackend()
...
window->setGraphicsDevice(QQuickGraphicsDevice::fromDeviceAndContext(device, context));
renderControl->initialize();
- window->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ &texture, 0 }, textureSize);
+ window->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ quint64(texture), 0 }, textureSize);
...
\endcode
diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h
index ea3f787d12..820b53cce9 100644
--- a/src/quick/items/qquickwindow.h
+++ b/src/quick/items/qquickwindow.h
@@ -170,7 +170,7 @@ public:
#endif
QSGTexture *createTextureFromNativeObject(NativeObjectType type,
- const void *nativeObjectPtr,
+ quint64 nativeObjectHandle,
int nativeLayout,
const QSize &size,
CreateTextureOptions options = CreateTextureOption()) const;
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.cpp b/src/quick/scenegraph/coreapi/qsgtexture.cpp
index 25e02d8058..2cf60f317e 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.cpp
+++ b/src/quick/scenegraph/coreapi/qsgtexture.cpp
@@ -325,15 +325,11 @@ static void qt_debug_remove_texture(QSGTexture* texture)
/*!
\variable QSGTexture::NativeTexture::object
- \brief a pointer to the native object handle.
+ \brief a 64-bit container of the native object handle.
- With OpenGL, the native handle is a GLuint value, so \c object is then a
- pointer to a GLuint. With Vulkan, the native handle is a VkImage, so \c
- object is a pointer to a VkImage. With Direct3D 11 and Metal \c
- object is a pointer to a ID3D11Texture2D or MTLTexture pointer, respectively.
-
- \note Pay attention to the fact that \a object is always a pointer
- to the native texture handle type, even if the native type itself is a
+ With OpenGL, the native handle is a GLuint value, so \c object then
+ contains a GLuint. With Vulkan, \c object contains a VkImage, and
+ with Direct3D 11 and Metal it contains a ID3D11Texture2D or MTLTexture
pointer.
*/
diff --git a/src/quick/scenegraph/coreapi/qsgtexture.h b/src/quick/scenegraph/coreapi/qsgtexture.h
index b0f01b1933..d9176f58f1 100644
--- a/src/quick/scenegraph/coreapi/qsgtexture.h
+++ b/src/quick/scenegraph/coreapi/qsgtexture.h
@@ -81,7 +81,7 @@ public:
};
struct NativeTexture {
- const void *object;
+ quint64 object;
int layout;
};
diff --git a/src/quick/scenegraph/util/qsgplaintexture.cpp b/src/quick/scenegraph/util/qsgplaintexture.cpp
index 037cf8c254..93448d7738 100644
--- a/src/quick/scenegraph/util/qsgplaintexture.cpp
+++ b/src/quick/scenegraph/util/qsgplaintexture.cpp
@@ -287,7 +287,7 @@ void QSGPlainTexture::setTexture(QRhiTexture *texture) // RHI only
}
void QSGPlainTexture::setTextureFromNativeObject(QRhi *rhi, QQuickWindow::NativeObjectType type,
- const void *nativeObjectPtr, int nativeLayout,
+ quint64 nativeObjectHandle, int nativeLayout,
const QSize &size, bool mipmap)
{
Q_UNUSED(type);
@@ -299,7 +299,7 @@ void QSGPlainTexture::setTextureFromNativeObject(QRhi *rhi, QQuickWindow::Native
QRhiTexture *t = rhi->newTexture(QRhiTexture::RGBA8, size, 1, flags);
// ownership of the native object is never taken
- t->buildFrom({nativeObjectPtr, nativeLayout});
+ t->buildFrom({nativeObjectHandle, nativeLayout});
setTexture(t);
}
diff --git a/src/quick/scenegraph/util/qsgplaintexture_p.h b/src/quick/scenegraph/util/qsgplaintexture_p.h
index 4bde505ec4..fed464a0b4 100644
--- a/src/quick/scenegraph/util/qsgplaintexture_p.h
+++ b/src/quick/scenegraph/util/qsgplaintexture_p.h
@@ -92,7 +92,7 @@ public:
void setTexture(QRhiTexture *texture);
void setTextureFromNativeObject(QRhi *rhi, QQuickWindow::NativeObjectType type,
- const void *nativeObjectPtr, int nativeLayout,
+ quint64 nativeObjectHandle, int nativeLayout,
const QSize &size, bool mipmap);
static QSGPlainTexture *fromImage(const QImage &image) {
diff --git a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp
index b0dd2d0c94..ed0818fd7d 100644
--- a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp
+++ b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp
@@ -487,7 +487,7 @@ void tst_RenderControl::renderAndReadBackWithVulkanNative()
QCOMPARE(err, VK_SUCCESS);
// Tell Qt Quick to target our VkImage.
- quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ &img, VK_IMAGE_LAYOUT_PREINITIALIZED },
+ quickWindow->setRenderTarget(QQuickRenderTarget::fromNativeTexture({ quint64(img), VK_IMAGE_LAYOUT_PREINITIALIZED },
rootItem->size().toSize()));
// Create a readback buffer.