summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/backend/renderer.cpp3
-rw-r--r--src/render/graphicshelpers/graphicscontext.cpp9
-rw-r--r--src/render/graphicshelpers/graphicscontext_p.h2
3 files changed, 11 insertions, 3 deletions
diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp
index 889888945..19cc97dc5 100644
--- a/src/render/backend/renderer.cpp
+++ b/src/render/backend/renderer.cpp
@@ -1650,7 +1650,8 @@ bool Renderer::executeCommandsSubmission(const RenderView *rv)
{
Profiling::GLTimeRecorder recorder(Profiling::UniformUpdate);
//// Update program uniforms
- m_graphicsContext->setParameters(command->m_parameterPack);
+ if (!m_graphicsContext->setParameters(command->m_parameterPack))
+ allCommandsIssued = false;
}
//// OpenGL State
diff --git a/src/render/graphicshelpers/graphicscontext.cpp b/src/render/graphicshelpers/graphicscontext.cpp
index 7b09985a7..5ac83cac0 100644
--- a/src/render/graphicshelpers/graphicscontext.cpp
+++ b/src/render/graphicshelpers/graphicscontext.cpp
@@ -1161,10 +1161,11 @@ void GraphicsContext::setRenderer(Renderer *renderer)
// It will be easier if the QGraphicContext applies the QUniformPack
// than the other way around
-void GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
+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
@@ -1184,6 +1185,10 @@ void GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
Q_ASSERT(texUniform.valueType() == UniformValue::TextureValue);
const int texUnit = activateTexture(TextureScopeMaterial, t);
texUniform.data<UniformValue::Texture>()->textureId = 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;
}
}
}
@@ -1238,6 +1243,8 @@ void GraphicsContext::setParameters(ShaderParameterPack &parameterPack)
applyUniform(uniform, v);
}
+ // if not all data is valid, the next frame will be rendered immediately
+ return allValid;
}
void GraphicsContext::enableAttribute(const VAOVertexAttribute &attr)
diff --git a/src/render/graphicshelpers/graphicscontext_p.h b/src/render/graphicshelpers/graphicscontext_p.h
index 2e2d4584b..79089a31e 100644
--- a/src/render/graphicshelpers/graphicscontext_p.h
+++ b/src/render/graphicshelpers/graphicscontext_p.h
@@ -166,7 +166,7 @@ public:
void memoryBarrier(QMemoryBarrier::Operations barriers);
- void setParameters(ShaderParameterPack &parameterPack);
+ bool setParameters(ShaderParameterPack &parameterPack);
/**
* @brief glBufferFor - given a client-side (CPU) buffer, provide the