summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@qt.io>2019-12-17 15:15:24 +0100
committerPaul Olav Tvete <paul.tvete@qt.io>2020-01-06 18:13:01 +0100
commit844ef184e8021237280a45ead04a3ab39cefa657 (patch)
treea4d32d5af5a71f1fa58610e1622d293faec63b42 /src/gui/rhi
parent908df199d0782d161e83d75dd7a7d9aab29ff9e7 (diff)
RHI: Remove old native texture API
Task-number: QTBUG-78570 Change-Id: I8c4850828ac03319ac923a26c2e985883956c286 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r--src/gui/rhi/qrhi.cpp44
-rw-r--r--src/gui/rhi/qrhi_p.h2
-rw-r--r--src/gui/rhi/qrhid3d11.cpp43
-rw-r--r--src/gui/rhi/qrhid3d11_p.h5
-rw-r--r--src/gui/rhi/qrhid3d11_p_p.h3
-rw-r--r--src/gui/rhi/qrhigles2.cpp41
-rw-r--r--src/gui/rhi/qrhigles2_p.h5
-rw-r--r--src/gui/rhi/qrhigles2_p_p.h4
-rw-r--r--src/gui/rhi/qrhimetal.mm43
-rw-r--r--src/gui/rhi/qrhimetal_p.h5
-rw-r--r--src/gui/rhi/qrhimetal_p_p.h3
-rw-r--r--src/gui/rhi/qrhinull.cpp22
-rw-r--r--src/gui/rhi/qrhinull_p.h4
-rw-r--r--src/gui/rhi/qrhinull_p_p.h3
-rw-r--r--src/gui/rhi/qrhivulkan.cpp51
-rw-r--r--src/gui/rhi/qrhivulkan_p.h6
-rw-r--r--src/gui/rhi/qrhivulkan_p_p.h3
17 files changed, 7 insertions, 280 deletions
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
index 58f30deb41..00d4df53bd 100644
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -2215,20 +2215,6 @@ QRhiResource::Type QRhiTexture::resourceType() const
*/
/*!
- \return a pointer to a backend-specific QRhiNativeHandles subclass, such as
- QRhiVulkanTextureNativeHandles. The returned value is null when exposing
- the underlying native resources is not supported by the backend.
-
- \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
- QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
- */
-// TODO: remove this version once QtQuick has stopped using it
-const QRhiNativeHandles *QRhiTexture::nativeHandles()
-{
- return nullptr;
-}
-
-/*!
\return the underlying native resources for this texture. The returned value
will be empty if exposing the underlying native resources is not supported by
the backend.
@@ -2242,36 +2228,6 @@ QRhiTexture::NativeTexture QRhiTexture::nativeTexture()
/*!
Similar to build() except that no new native textures are created. Instead,
- the texture from \a src is used.
-
- This allows importing an existing native texture object (which must belong
- to the same device or sharing context, depending on the graphics API) from
- an external graphics engine.
-
- \note format(), pixelSize(), sampleCount(), and flags() must still be set
- correctly. Passing incorrect sizes and other values to QRhi::newTexture()
- and then following it with a buildFrom() expecting that the native texture
- object alone is sufficient to deduce such values is \b wrong and will lead
- to problems.
-
- \note QRhiTexture does not take ownership of the texture object. release()
- does not free the object or any associated memory.
-
- The opposite of this operation, exposing a QRhiTexture-created native
- texture object to a foreign engine, is possible via nativeHandles().
-
- \sa QRhiVulkanTextureNativeHandles, QRhiD3D11TextureNativeHandles,
- QRhiMetalTextureNativeHandles, QRhiGles2TextureNativeHandles
- */
-// TODO: remove this version once QtQuick has stopped using it
-bool QRhiTexture::buildFrom(const QRhiNativeHandles *src)
-{
- Q_UNUSED(src);
- return false;
-}
-
-/*!
- Similar to build() except that no new native textures are created. Instead,
the native texture resources specified by \a src is used.
This allows importing an existing native texture object (which must belong
diff --git a/src/gui/rhi/qrhi_p.h b/src/gui/rhi/qrhi_p.h
index 44118b2f10..a6c65aac5e 100644
--- a/src/gui/rhi/qrhi_p.h
+++ b/src/gui/rhi/qrhi_p.h
@@ -780,9 +780,7 @@ public:
void setSampleCount(int s) { m_sampleCount = s; }
virtual bool build() = 0;
- virtual const QRhiNativeHandles *nativeHandles();
virtual NativeTexture nativeTexture();
- virtual bool buildFrom(const QRhiNativeHandles *src);
virtual bool buildFrom(NativeTexture src);
protected:
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp
index ba2488bffb..c5923fe411 100644
--- a/src/gui/rhi/qrhid3d11.cpp
+++ b/src/gui/rhi/qrhid3d11.cpp
@@ -108,17 +108,6 @@ QT_BEGIN_NAMESPACE
\c{ID3D11Device *} and \c{ID3D11DeviceContext *}.
*/
-/*!
- \class QRhiD3D11TextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the D3D texture object that is backing a QRhiTexture instance.
-
- \note The class uses \c{void *} as the type since including the COM-based
- \c{d3d11.h} headers is not acceptable here. The actual type is
- \c{ID3D11Texture2D *}.
- */
-
// help mingw with its ancient sdk headers
#ifndef DXGI_ADAPTER_FLAG_SOFTWARE
#define DXGI_ADAPTER_FLAG_SOFTWARE 2
@@ -2674,8 +2663,6 @@ bool QD3D11Texture::finishBuild()
return false;
}
- nativeHandlesStruct.texture = tex;
-
generation += 1;
return true;
}
@@ -2741,29 +2728,6 @@ bool QD3D11Texture::build()
return true;
}
-bool QD3D11Texture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiD3D11TextureNativeHandles *h = static_cast<const QRhiD3D11TextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- tex = static_cast<ID3D11Texture2D *>(h->texture);
-
- if (!finishBuild())
- return false;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, int(sampleDesc.Count)));
-
- owns = false;
- QRHI_RES_RHI(QRhiD3D11);
- rhiD->registerResource(this);
- return true;
-}
-
bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
{
auto *srcTex = static_cast<ID3D11Texture2D * const *>(src.object);
@@ -2787,14 +2751,9 @@ bool QD3D11Texture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QD3D11Texture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QD3D11Texture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {&tex, 0};
}
ID3D11UnorderedAccessView *QD3D11Texture::unorderedAccessViewForLevel(int level)
diff --git a/src/gui/rhi/qrhid3d11_p.h b/src/gui/rhi/qrhid3d11_p.h
index 5df1843b1e..aba0f37ee7 100644
--- a/src/gui/rhi/qrhid3d11_p.h
+++ b/src/gui/rhi/qrhid3d11_p.h
@@ -69,11 +69,6 @@ struct Q_GUI_EXPORT QRhiD3D11NativeHandles : public QRhiNativeHandles
void *context = nullptr;
};
-struct Q_GUI_EXPORT QRhiD3D11TextureNativeHandles : public QRhiNativeHandles
-{
- void *texture = nullptr; // ID3D11Texture2D*
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhid3d11_p_p.h b/src/gui/rhi/qrhid3d11_p_p.h
index 8f02c4300b..9ddd2aa797 100644
--- a/src/gui/rhi/qrhid3d11_p_p.h
+++ b/src/gui/rhi/qrhid3d11_p_p.h
@@ -99,9 +99,7 @@ struct QD3D11Texture : public QRhiTexture
~QD3D11Texture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -114,7 +112,6 @@ struct QD3D11Texture : public QRhiTexture
DXGI_FORMAT dxgiFormat;
uint mipLevelCount = 0;
DXGI_SAMPLE_DESC sampleDesc;
- QRhiD3D11TextureNativeHandles nativeHandlesStruct;
ID3D11UnorderedAccessView *perLevelViews[QRhi::MAX_LEVELS];
uint generation = 0;
friend class QRhiD3D11;
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp
index ffaccbad71..e63ed11dd4 100644
--- a/src/gui/rhi/qrhigles2.cpp
+++ b/src/gui/rhi/qrhigles2.cpp
@@ -137,13 +137,6 @@ QT_BEGIN_NAMESPACE
\brief Holds the OpenGL context used by the QRhi.
*/
-/*!
- \class QRhiGles2TextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the OpenGL texture object that is backing a QRhiTexture instance.
- */
-
#ifndef GL_BGRA
#define GL_BGRA 0x80E1
#endif
@@ -3324,7 +3317,6 @@ void QGles2Texture::release()
texture = 0;
specified = false;
- nativeHandlesStruct.texture = 0;
QRHI_RES_RHI(QRhiGles2);
if (owns)
@@ -3483,31 +3475,6 @@ bool QGles2Texture::build()
QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, 1));
owns = true;
- nativeHandlesStruct.texture = texture;
-
- generation += 1;
- rhiD->registerResource(this);
- return true;
-}
-
-bool QGles2Texture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiGles2TextureNativeHandles *h = static_cast<const QRhiGles2TextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- texture = h->texture;
- specified = true;
-
- QRHI_RES_RHI(QRhiGles2);
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
-
- owns = false;
- nativeHandlesStruct.texture = texture;
generation += 1;
rhiD->registerResource(this);
@@ -3531,21 +3498,15 @@ bool QGles2Texture::buildFrom(QRhiTexture::NativeTexture src)
QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, 1));
owns = false;
- nativeHandlesStruct.texture = texture;
generation += 1;
rhiD->registerResource(this);
return true;
}
-const QRhiNativeHandles *QGles2Texture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QGles2Texture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {&texture, 0};
}
QGles2Sampler::QGles2Sampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
diff --git a/src/gui/rhi/qrhigles2_p.h b/src/gui/rhi/qrhigles2_p.h
index 7f7c8b4c40..8d8f0c7396 100644
--- a/src/gui/rhi/qrhigles2_p.h
+++ b/src/gui/rhi/qrhigles2_p.h
@@ -74,11 +74,6 @@ struct Q_GUI_EXPORT QRhiGles2NativeHandles : public QRhiNativeHandles
QOpenGLContext *context = nullptr;
};
-struct Q_GUI_EXPORT QRhiGles2TextureNativeHandles : public QRhiNativeHandles
-{
- uint texture = 0;
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h
index d4f1336c3e..a9b3022612 100644
--- a/src/gui/rhi/qrhigles2_p_p.h
+++ b/src/gui/rhi/qrhigles2_p_p.h
@@ -132,9 +132,7 @@ struct QGles2Texture : public QRhiTexture
~QGles2Texture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -149,7 +147,7 @@ struct QGles2Texture : public QRhiTexture
QGles2SamplerData samplerState;
bool specified = false;
int mipLevelCount = 0;
- QRhiGles2TextureNativeHandles nativeHandlesStruct;
+
enum Access {
AccessNone,
AccessSample,
diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm
index b6ca40e08b..222bf170dc 100644
--- a/src/gui/rhi/qrhimetal.mm
+++ b/src/gui/rhi/qrhimetal.mm
@@ -114,15 +114,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \class QRhiMetalTextureNativeHandles
- \inmodule QtRhi
- \brief Holds the Metal texture object that is backing a QRhiTexture instance.
-
- \note The class uses \c{void *} as the type since including the Objective C
- headers is not acceptable here. The actual type is \c{id<MTLTexture>}.
- */
-
-/*!
\class QRhiMetalCommandBufferNativeHandles
\inmodule QtRhi
\brief Holds the MTLCommandBuffer and MTLRenderCommandEncoder objects that are backing a QRhiCommandBuffer.
@@ -2296,7 +2287,6 @@ void QMetalTexture::release()
e.texture.texture = d->owns ? d->tex : nil;
d->tex = nil;
- nativeHandlesStruct.texture = nullptr;
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
e.texture.stagingBuffers[i] = d->stagingBuf[i];
@@ -2508,7 +2498,6 @@ bool QMetalTexture::build()
d->tex.label = [NSString stringWithUTF8String: m_objectName.constData()];
d->owns = true;
- nativeHandlesStruct.texture = d->tex;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, true, mipLevelCount, isCube ? 6 : 1, samples));
@@ -2519,30 +2508,6 @@ bool QMetalTexture::build()
return true;
}
-bool QMetalTexture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiMetalTextureNativeHandles *h = static_cast<const QRhiMetalTextureNativeHandles *>(src);
- if (!h || !h->texture)
- return false;
-
- if (!prepareBuild())
- return false;
-
- d->tex = (id<MTLTexture>) h->texture;
-
- d->owns = false;
- nativeHandlesStruct.texture = d->tex;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
-
- lastActiveFrameSlot = -1;
- generation += 1;
- QRHI_RES_RHI(QRhiMetal);
- rhiD->registerResource(this);
- return true;
-}
-
bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
{
void * const * tex = (void * const *) src.object;
@@ -2555,7 +2520,6 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
d->tex = (id<MTLTexture>) *tex;
d->owns = false;
- nativeHandlesStruct.texture = d->tex;
QRHI_PROF;
QRHI_PROF_F(newTexture(this, false, mipLevelCount, m_flags.testFlag(CubeMap) ? 6 : 1, samples));
@@ -2567,14 +2531,9 @@ bool QMetalTexture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QMetalTexture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QMetalTexture::nativeTexture()
{
- return {&nativeHandlesStruct.texture, 0};
+ return {&d->tex, 0};
}
id<MTLTexture> QMetalTextureData::viewForLevel(int level)
diff --git a/src/gui/rhi/qrhimetal_p.h b/src/gui/rhi/qrhimetal_p.h
index 094801c58c..17e28b2c0f 100644
--- a/src/gui/rhi/qrhimetal_p.h
+++ b/src/gui/rhi/qrhimetal_p.h
@@ -64,11 +64,6 @@ struct Q_GUI_EXPORT QRhiMetalNativeHandles : public QRhiNativeHandles
void *cmdQueue = nullptr; // id<MTLCommandQueue>
};
-struct Q_GUI_EXPORT QRhiMetalTextureNativeHandles : public QRhiNativeHandles
-{
- void *texture = nullptr; // id<MTLTexture>
-};
-
struct Q_GUI_EXPORT QRhiMetalCommandBufferNativeHandles : public QRhiNativeHandles
{
void *commandBuffer = nullptr; // id<MTLCommandBuffer>
diff --git a/src/gui/rhi/qrhimetal_p_p.h b/src/gui/rhi/qrhimetal_p_p.h
index 8e655fd98b..71d4325b1a 100644
--- a/src/gui/rhi/qrhimetal_p_p.h
+++ b/src/gui/rhi/qrhimetal_p_p.h
@@ -100,15 +100,12 @@ struct QMetalTexture : public QRhiTexture
~QMetalTexture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
QMetalTextureData *d;
- QRhiMetalTextureNativeHandles nativeHandlesStruct;
int mipLevelCount = 0;
int samples = 1;
uint generation = 0;
diff --git a/src/gui/rhi/qrhinull.cpp b/src/gui/rhi/qrhinull.cpp
index 80f004e049..ea67f80138 100644
--- a/src/gui/rhi/qrhinull.cpp
+++ b/src/gui/rhi/qrhinull.cpp
@@ -67,13 +67,6 @@ QT_BEGIN_NAMESPACE
\brief Empty.
*/
-/*!
- \class QRhiNullTextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Empty.
- */
-
QRhiNull::QRhiNull(QRhiNullInitParams *params)
: offscreenCommandBuffer(this)
{
@@ -638,9 +631,9 @@ bool QNullTexture::build()
return true;
}
-bool QNullTexture::buildFrom(const QRhiNativeHandles *src)
+bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
{
- Q_UNUSED(src);
+ Q_UNUSED(src)
QRHI_RES_RHI(QRhiNull);
const bool isCube = m_flags.testFlag(CubeMap);
const bool hasMipMaps = m_flags.testFlag(MipMapped);
@@ -651,17 +644,6 @@ bool QNullTexture::buildFrom(const QRhiNativeHandles *src)
return true;
}
-bool QNullTexture::buildFrom(QRhiTexture::NativeTexture src)
-{
- Q_UNUSED(src)
- return buildFrom(nullptr);
-}
-
-const QRhiNativeHandles *QNullTexture::nativeHandles()
-{
- return &nativeHandlesStruct;
-}
-
QNullSampler::QNullSampler(QRhiImplementation *rhi, Filter magFilter, Filter minFilter, Filter mipmapMode,
AddressMode u, AddressMode v)
: QRhiSampler(rhi, magFilter, minFilter, mipmapMode, u, v)
diff --git a/src/gui/rhi/qrhinull_p.h b/src/gui/rhi/qrhinull_p.h
index 7d3ce5dbf1..dbf385555d 100644
--- a/src/gui/rhi/qrhinull_p.h
+++ b/src/gui/rhi/qrhinull_p.h
@@ -60,10 +60,6 @@ struct Q_GUI_EXPORT QRhiNullNativeHandles : public QRhiNativeHandles
{
};
-struct Q_GUI_EXPORT QRhiNullTextureNativeHandles : public QRhiNativeHandles
-{
-};
-
QT_END_NAMESPACE
#endif
diff --git a/src/gui/rhi/qrhinull_p_p.h b/src/gui/rhi/qrhinull_p_p.h
index 57c3de0418..f541fd90b8 100644
--- a/src/gui/rhi/qrhinull_p_p.h
+++ b/src/gui/rhi/qrhinull_p_p.h
@@ -80,11 +80,8 @@ struct QNullTexture : public QRhiTexture
~QNullTexture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
- QRhiNullTextureNativeHandles nativeHandlesStruct;
QImage image[QRhi::MAX_LAYERS][QRhi::MAX_LEVELS];
};
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index c540e9fa85..c5719b54aa 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -177,21 +177,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \class QRhiVulkanTextureNativeHandles
- \internal
- \inmodule QtGui
- \brief Holds the Vulkan image object that is backing a QRhiTexture.
-
- Importing and exporting Vulkan image objects that back a QRhiTexture when
- running with the Vulkan backend is supported via this class. Ownership of
- the Vulkan object is never transferred.
-
- \note Memory allocation details are not exposed. This is intentional since
- memory is typically suballocated from a bigger chunk of VkDeviceMemory, and
- exposing the allocator details is not desirable for now.
- */
-
-/*!
\class QRhiVulkanCommandBufferNativeHandles
\internal
\inmodule QtGui
@@ -5198,7 +5183,6 @@ void QVkTexture::release()
image = VK_NULL_HANDLE;
imageView = VK_NULL_HANDLE;
imageAlloc = nullptr;
- nativeHandlesStruct.image = VK_NULL_HANDLE;
QRHI_RES_RHI(QRhiVulkan);
rhiD->releaseQueue.append(e);
@@ -5283,8 +5267,6 @@ bool QVkTexture::finishBuild()
return false;
}
- nativeHandlesStruct.image = image;
-
lastActiveFrameSlot = -1;
generation += 1;
@@ -5356,31 +5338,6 @@ bool QVkTexture::build()
return true;
}
-bool QVkTexture::buildFrom(const QRhiNativeHandles *src)
-{
- const QRhiVulkanTextureNativeHandles *h = static_cast<const QRhiVulkanTextureNativeHandles *>(src);
- if (!h || !h->image)
- return false;
-
- if (!prepareBuild())
- return false;
-
- image = h->image;
-
- if (!finishBuild())
- return false;
-
- QRHI_PROF;
- QRHI_PROF_F(newTexture(this, false, int(mipLevelCount), m_flags.testFlag(CubeMap) ? 6 : 1, samples));
-
- usageState.layout = h->layout;
-
- owns = false;
- QRHI_RES_RHI(QRhiVulkan);
- rhiD->registerResource(this);
- return true;
-}
-
bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
{
auto *img = static_cast<const VkImage*>(src.object);
@@ -5406,15 +5363,9 @@ bool QVkTexture::buildFrom(QRhiTexture::NativeTexture src)
return true;
}
-const QRhiNativeHandles *QVkTexture::nativeHandles()
-{
- nativeHandlesStruct.layout = usageState.layout;
- return &nativeHandlesStruct;
-}
-
QRhiTexture::NativeTexture QVkTexture::nativeTexture()
{
- return {&nativeHandlesStruct.image, usageState.layout};
+ return {&image, usageState.layout};
}
VkImageView QVkTexture::imageViewForLevel(int level)
diff --git a/src/gui/rhi/qrhivulkan_p.h b/src/gui/rhi/qrhivulkan_p.h
index ff19c7a54e..d495919671 100644
--- a/src/gui/rhi/qrhivulkan_p.h
+++ b/src/gui/rhi/qrhivulkan_p.h
@@ -69,12 +69,6 @@ struct Q_GUI_EXPORT QRhiVulkanNativeHandles : public QRhiNativeHandles
void *vmemAllocator = nullptr;
};
-struct Q_GUI_EXPORT QRhiVulkanTextureNativeHandles : public QRhiNativeHandles
-{
- VkImage image = VK_NULL_HANDLE;
- VkImageLayout layout = VK_IMAGE_LAYOUT_GENERAL;
-};
-
struct Q_GUI_EXPORT QRhiVulkanCommandBufferNativeHandles : public QRhiNativeHandles
{
VkCommandBuffer commandBuffer = VK_NULL_HANDLE;
diff --git a/src/gui/rhi/qrhivulkan_p_p.h b/src/gui/rhi/qrhivulkan_p_p.h
index d1b77870a1..9f18d0bf5e 100644
--- a/src/gui/rhi/qrhivulkan_p_p.h
+++ b/src/gui/rhi/qrhivulkan_p_p.h
@@ -120,9 +120,7 @@ struct QVkTexture : public QRhiTexture
~QVkTexture();
void release() override;
bool build() override;
- bool buildFrom(const QRhiNativeHandles *src) override;
bool buildFrom(NativeTexture src) override;
- const QRhiNativeHandles *nativeHandles() override;
NativeTexture nativeTexture() override;
bool prepareBuild(QSize *adjustedSize = nullptr);
@@ -136,7 +134,6 @@ struct QVkTexture : public QRhiTexture
QVkAlloc stagingAllocations[QVK_FRAMES_IN_FLIGHT];
VkImageView perLevelImageViews[QRhi::MAX_LEVELS];
bool owns = true;
- QRhiVulkanTextureNativeHandles nativeHandlesStruct;
struct UsageState {
// no tracking of subresource layouts (some operations can keep
// subresources in different layouts for some time, but that does not