diff options
author | Kim Motoyoshi Kalland <[email protected]> | 2012-03-26 10:36:25 +0200 |
---|---|---|
committer | Qt by Nokia <[email protected]> | 2012-03-27 08:23:43 +0200 |
commit | ce9c98c15bc4f84583bb7e07739dbca9e633d1c8 (patch) | |
tree | 4a7002e0d7be52be61621dd4dc4775a924f143ef /src/quick/items/qquickshadereffectsource.cpp | |
parent | ec7deb3d123bb44b5d57590615a60ed48b1d2860 (diff) |
Release FBOs held by the shader effect source sooner.
Change-Id: I2bdb4a9e4da50afff6752c2c0fd7e60041ede14f
Reviewed-by: Gunnar Sletta <[email protected]>
Diffstat (limited to 'src/quick/items/qquickshadereffectsource.cpp')
-rw-r--r-- | src/quick/items/qquickshadereffectsource.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index c55b1ca7f5..fffa4d9521 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -210,6 +210,14 @@ void QQuickShaderEffectTexture::setItem(QSGNode *item) if (item == m_item) return; m_item = item; + + if (m_live && !m_item) { + delete m_fbo; + delete m_secondaryFbo; + m_fbo = m_secondaryFbo = 0; + m_depthStencilBuffer.clear(); + } + markDirtyTexture(); } @@ -226,6 +234,14 @@ void QQuickShaderEffectTexture::setSize(const QSize &size) if (size == m_size) return; m_size = size; + + if (m_live && m_size.isNull()) { + delete m_fbo; + delete m_secondaryFbo; + m_fbo = m_secondaryFbo = 0; + m_depthStencilBuffer.clear(); + } + markDirtyTexture(); } @@ -242,6 +258,14 @@ void QQuickShaderEffectTexture::setLive(bool live) if (live == m_live) return; m_live = live; + + if (m_live && (!m_item || m_size.isNull())) { + delete m_fbo; + delete m_secondaryFbo; + m_fbo = m_secondaryFbo = 0; + m_depthStencilBuffer.clear(); + } + markDirtyTexture(); } @@ -613,6 +637,8 @@ void QQuickShaderEffectSource::setWrapMode(WrapMode mode) \qmlproperty Item ShaderEffectSource::sourceItem This property holds the element to be rendered into the texture. + Setting this to null while \l live is true, will release the texture + resources. */ QQuickItem *QQuickShaderEffectSource::sourceItem() const @@ -750,8 +776,8 @@ void QQuickShaderEffectSource::setFormat(QQuickShaderEffectSource::Format format \qmlproperty bool ShaderEffectSource::live If this property is true, the texture is updated whenever the - \l sourceItem changes. Otherwise, it will be a frozen image of the - \l sourceItem. The property is true by default. + \l sourceItem updates. Otherwise, it will be a frozen image, even if + \l sourceItem is assigned a new element. The property is true by default. */ bool QQuickShaderEffectSource::live() const |