diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-05-19 07:29:14 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2020-05-25 13:39:32 +0200 |
commit | 5d4d598354c85de7bf33412b42a5693b4ac27d78 (patch) | |
tree | 96e892cf15c6720db0c9aaf7060bde18ed8b44ca /src/quick/scenegraph | |
parent | de41077a57313f67e330de5a60281be81b414a1d (diff) |
Adapt to changes in NativeTexture in qtbase
To make the API less error prone, we have changed the
void pointer to the texture handle to a 64-bit in
instead, since all handles are maximum 64-bit.
Task-number: QTBUG-78638
Change-Id: I9d995d6a883b3377f57d7c5b19d4bc4e15aa347b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgtexture.cpp | 12 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgtexture.h | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgplaintexture.cpp | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgplaintexture_p.h | 2 |
4 files changed, 8 insertions, 12 deletions
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) { |