diff options
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/shadereffectitem.cpp | 19 | ||||
-rw-r--r-- | src/effects/shadereffectitem.h | 2 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/effects/shadereffectitem.cpp b/src/effects/shadereffectitem.cpp index 0826b8a..ed8ff93 100644 --- a/src/effects/shadereffectitem.cpp +++ b/src/effects/shadereffectitem.cpp @@ -261,11 +261,9 @@ void ShaderEffectSource::setMipmap(FilterMode mode) Q_ASSERT(m_sourceItem); delete m_fbo; m_fbo = 0; - } else if (m_texture) { + } else if (!m_texture.isNull()) { Q_ASSERT(!m_sourceImage.isEmpty()); if (!m_texture->hasMipmaps()) { - delete m_texture; - m_texture = 0; updateSizeAndTexture(); } } @@ -356,7 +354,7 @@ void ShaderEffectSource::bind() const #endif if (m_fbo) { glBindTexture(GL_TEXTURE_2D, m_fbo->texture()); - } else if (m_texture) { + } else if (!m_texture.isNull()) { glBindTexture(GL_TEXTURE_2D, m_texture->textureId()); } else { glBindTexture(GL_TEXTURE_2D, 0); @@ -523,11 +521,14 @@ void ShaderEffectSource::updateSizeAndTexture() m_size.setHeight(image.height()); emit heightChanged(); } - TextureManager *tm = m_context->textureManager(); - TextureManager::UploadHints hints = TextureManager::SynchronousUploadHint; - if (m_mipmap != None) - hints |= TextureManager::GenerateMipmapUploadHint; - m_texture = tm->requestUploadedTexture(image.mirrored(), hints); + QSGTextureManager *tm = m_context->textureManager(); + m_texture = tm->upload(image.mirrored()); + + if (m_mipmap) { + glBindTexture(GL_TEXTURE_2D, m_texture->textureId()); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, 0); + } } else { if (m_size.width() != 0) { diff --git a/src/effects/shadereffectitem.h b/src/effects/shadereffectitem.h index bcdf220..a1db89a 100644 --- a/src/effects/shadereffectitem.h +++ b/src/effects/shadereffectitem.h @@ -166,7 +166,7 @@ private: QSize m_size; bool m_static; - const TextureReference *m_texture; + QSGTextureRef m_texture; QGLFramebufferObject *m_fbo; QGLFramebufferObject *m_multisampledFbo; Renderer *m_renderer; |