From 411c2e9f783272624918a3a72ef61a2266bd7618 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 13 Aug 2018 15:34:48 +0200 Subject: [PATCH] Texture property update: notify frontend only when properties have changed Change-Id: Ic69b25c92ff45f349715a47b19c3f3c1c40eabea Reviewed-by: Mike Krus --- src/render/renderers/opengl/renderer/renderer.cpp | 3 ++- src/render/renderers/opengl/textures/gltexture.cpp | 1 + src/render/renderers/opengl/textures/gltexture_p.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/render/renderers/opengl/renderer/renderer.cpp b/src/render/renderers/opengl/renderer/renderer.cpp index fd4e7bed4..7319fd0e5 100644 --- a/src/render/renderers/opengl/renderer/renderer.cpp +++ b/src/render/renderers/opengl/renderer/renderer.cpp @@ -1271,7 +1271,8 @@ void Renderer::updateGLResources() // Gather these information and store them to be distributed by a change next frame const QNodeIdVector referenceTextureIds = glTextureManager->referencedTextureIds(glTexture); // Store properties and referenceTextureIds - m_updatedTextureProperties.push_back({info.properties, referenceTextureIds}); + if (info.wasUpdated) + m_updatedTextureProperties.push_back({info.properties, referenceTextureIds}); } } } diff --git a/src/render/renderers/opengl/textures/gltexture.cpp b/src/render/renderers/opengl/textures/gltexture.cpp index bff0eafee..b61d06a80 100644 --- a/src/render/renderers/opengl/textures/gltexture.cpp +++ b/src/render/renderers/opengl/textures/gltexture.cpp @@ -211,6 +211,7 @@ GLTexture::TextureUpdateInfo GLTexture::createOrUpdateGLTexture() if (testDirtyFlag(Properties)) { delete m_gl; m_gl = nullptr; + textureInfo.wasUpdated = true; } diff --git a/src/render/renderers/opengl/textures/gltexture_p.h b/src/render/renderers/opengl/textures/gltexture_p.h index 8f9d335df..dd0e05e36 100644 --- a/src/render/renderers/opengl/textures/gltexture_p.h +++ b/src/render/renderers/opengl/textures/gltexture_p.h @@ -143,6 +143,7 @@ public: struct TextureUpdateInfo { QOpenGLTexture *texture = nullptr; + bool wasUpdated = false; TextureProperties properties; };