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>
This commit is contained in:
parent
8cd4c288b5
commit
c9cffe6129
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue