summaryrefslogtreecommitdiffstats
path: root/src/render/graphicshelpers/graphicscontext.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-02-23 09:09:03 +0100
committerPaul Lemire <paul.lemire@kdab.com>2018-02-28 10:46:24 +0000
commit6ea64e9ba9c17302c50648e4c3836a7563679f6a (patch)
treea2e5979fb59e2c49c0e90fb14b04784c71b9e449 /src/render/graphicshelpers/graphicscontext.cpp
parent3dff7c204da1d834629544b54b9f6efaafe165e2 (diff)
Load textures in a single frame
Because of texture sharing, Qt3D compares functor before executing them. Instead of blindly loading a TextureImage functor which could turn out to not be used, Qt3D required 2 frames to fully update a texture. This behavior has been removed, now when a texture image functor is updated, it updates the texture in one frame. It is assumed that the user is responsible for declaring only TextureImage that he is actually going to use. Any scene that uses OnDemand rendering and frequently changes a texture image functor can be used to test this. (ex-painted-cube is a good example for KDAB) or paintedtexture-cpp in manual tests Change-Id: I8c2f13876244a862633e10e472e2b49cbd6e126b Task-number: QTBUG-63561 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/graphicshelpers/graphicscontext.cpp')
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index d742865c4..7fa112b12 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -1205,7 +1205,6 @@ bool GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
{
// Activate textures and update TextureUniform in the pack
// with the correct textureUnit
- bool allValid = true;
// Set the pinned texture of the previous material texture
// to pinable so that we should easily find an available texture unit
@@ -1225,10 +1224,8 @@ bool GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
Q_ASSERT(texUniform.valueType() == UniformValue::TextureValue);
const int texUnit = activateTexture(TextureScopeMaterial, t);
texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit;
- // if the texture data from generators may not be available yet,
- // make sure that the next frame is rendered
if (texUnit == -1)
- allValid = false;
+ return false;
}
}
}
@@ -1283,7 +1280,7 @@ bool GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
applyUniform(uniform, v);
}
// if not all data is valid, the next frame will be rendered immediately
- return allValid;
+ return true;
}
void GraphicsContext::readBuffer(GLenum mode)