effects/blur: Generate noise texture on demand
It is relatively expensive and there is no need to do it unless there are actually windows that make use of the blur effect. Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
This commit is contained in:
parent
8b4ffd5cc9
commit
a0a472391e
1 changed files with 6 additions and 2 deletions
|
@ -195,8 +195,8 @@ void BlurEffect::updateTexture()
|
|||
// Copysample
|
||||
m_renderTargetStack.push(m_renderTargets[0]);
|
||||
|
||||
// Generate the noise helper texture
|
||||
generateNoiseTexture();
|
||||
// Invalidate noise texture
|
||||
m_noiseTexture.reset();
|
||||
}
|
||||
|
||||
void BlurEffect::initBlurStrengthValues()
|
||||
|
@ -799,6 +799,10 @@ void BlurEffect::upscaleRenderToScreen(GLVertexBuffer *vbo, int vboStart, int bl
|
|||
|
||||
void BlurEffect::applyNoise(GLVertexBuffer *vbo, int vboStart, int blurRectCount, const QMatrix4x4 &screenProjection, QPoint windowPosition)
|
||||
{
|
||||
if (!m_noiseTexture) {
|
||||
generateNoiseTexture();
|
||||
}
|
||||
|
||||
m_shader->bind(BlurShader::NoiseSampleType);
|
||||
m_shader->setTargetTextureSize(m_renderTextures[0]->size() * effects->renderTargetScale());
|
||||
m_shader->setNoiseTextureSize(m_noiseTexture->size() * effects->renderTargetScale());
|
||||
|
|
Loading…
Reference in a new issue