aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-25 10:33:01 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-31 12:42:08 +0000
commitc9cffe61291d265e05f05087275daa6625b1aea2 (patch)
treeed1ead97fdf7459b0a98c07d26f39eba169aa2b7
parent8cd4c288b5ab291a5415c6ecb0347f15e2adb5b2 (diff)
D3D12: Experiment with dropping QImage data once the upload is queued
But do not enable it yet. We would lose the ability to enable mipmapping later on which is annoying since property values can get set after the first bind() for some reason. Needs some more investigation later on. Change-Id: If4ffbc762f05dc2a3bbd811bccd6cffba0b66fc6 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
index ce0c0e53dd..0bb4138b01 100644
--- a/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
+++ b/src/plugins/scenegraph/d3d12/qsgd3d12texture.cpp
@@ -43,6 +43,8 @@
QT_BEGIN_NAMESPACE
+#define RETAIN_IMAGE
+
void QSGD3D12Texture::create(const QImage &image, uint flags)
{
// ### atlas?
@@ -97,10 +99,16 @@ void QSGD3D12Texture::bind()
// Called when the texture material updates the pipeline state.
if (!m_createPending && hasMipmaps() != m_createdWithMipMaps) {
+#ifdef RETAIN_IMAGE
m_engine->releaseTexture(m_id);
m_id = m_engine->genTexture();
Q_ASSERT(m_id);
m_createPending = true;
+#else
+ // ### this can be made working some day (something similar to
+ // queueTextureResize) but skip for now
+ qWarning("D3D12: mipmap property cannot be changed once the texture is created");
+#endif
}
if (m_createPending) {
@@ -116,6 +124,10 @@ void QSGD3D12Texture::bind()
m_engine->createTexture(m_id, m_image.size(), m_image.format(), createFlags);
m_engine->queueTextureUpload(m_id, m_image);
+
+#ifndef RETAIN_IMAGE
+ m_image = QImage();
+#endif
}
// Here we know that the texture is going to be used in the current frame