diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2018-02-23 09:09:03 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2018-02-28 10:46:24 +0000 |
commit | 6ea64e9ba9c17302c50648e4c3836a7563679f6a (patch) | |
tree | a2e5979fb59e2c49c0e90fb14b04784c71b9e449 /src/render/backend | |
parent | 3dff7c204da1d834629544b54b9f6efaafe165e2 (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/backend')
-rw-r--r-- | src/render/backend/renderer.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index 2dda73679..bdc024308 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -1221,10 +1221,12 @@ void Renderer::updateTexture(Texture *texture) !glTextureManager->setParameters(glTexture, texture->parameters())) qWarning() << "[Qt3DRender::TextureNode] updateTexture: TextureImpl.setParameters failed, should be non-shared"; + // Will make the texture requestUpload if (dirtyFlags.testFlag(Texture::DirtyImageGenerators) && !glTextureManager->setImages(glTexture, texture->textureImages())) qWarning() << "[Qt3DRender::TextureNode] updateTexture: TextureImpl.setGenerators failed, should be non-shared"; + // Will make the texture requestUpload if (dirtyFlags.testFlag(Texture::DirtyDataGenerator) && !glTextureManager->setGenerator(glTexture, texture->dataGenerator())) qWarning() << "[Qt3DRender::TextureNode] updateTexture: TextureImpl.setGenerator failed, should be non-shared"; @@ -1379,7 +1381,7 @@ Renderer::ViewSubmissionResultData Renderer::submitRenderViews(const QVector<Ren if (!executeCommandsSubmission(renderView)) m_lastFrameCorrect.store(0); // something went wrong; make sure to render the next frame! - // executeCommands takes care of restoring the stateset to the value + // executeCommandsSubmission takes care of restoring the stateset to the value // of gc->currentContext() at the moment it was called (either // renderViewStateSet or m_defaultRenderStateSet) if (!renderView->renderCaptureNodeId().isNull()) { @@ -1836,8 +1838,12 @@ bool Renderer::executeCommandsSubmission(const RenderView *rv) { Profiling::GLTimeRecorder recorder(Profiling::UniformUpdate); //// Update program uniforms - if (!m_graphicsContext->setParameters(command->m_parameterPack)) + if (!m_graphicsContext->setParameters(command->m_parameterPack)) { allCommandsIssued = false; + // If we have failed to set uniform (e.g unable to bind a texture) + // we won't perform the draw call which could show invalid content + continue; + } } //// OpenGL State |