Skip to content

Commit 78630c8

Browse files
committed
BlurCache: revert back to unique_ptrs
Signed-off-by: Xarblu <xarblu@protonmail.com>
1 parent ac68682 commit 78630c8

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/blur.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ struct BlurRenderData
5454
{
5555
/// Temporary render targets needed for the Dual Kawase algorithm, the first texture
5656
/// contains not blurred background behind the window, it's cached.
57-
std::vector<std::shared_ptr<GLTexture>> textures;
58-
std::vector<std::shared_ptr<GLFramebuffer>> framebuffers;
57+
std::vector<std::unique_ptr<GLTexture>> textures;
58+
std::vector<std::unique_ptr<GLFramebuffer>> framebuffers;
5959

6060
BBDX::BlurCacheLRU cache;
6161
};

src/blur_cache.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,16 @@ void BBDX::BlurCache::prepareCache(BBDX::BlurCacheLRU &cache,
341341
// QUERY START
342342

343343
// textures + FBOs used in query
344-
auto cachedTextureFBO = std::pair{cacheEntry->blitTexture, cacheEntry->blitFramebuffer};
345-
auto newTextureFBO = std::pair{m_paintData.blitFramebuffer->colorAttachment(), m_paintData.blitFramebuffer};
346-
auto &[cachedTexture, cachedFramebuffer] = cachedTextureFBO;
347-
auto &[newTexture, newFramebuffer] = newTextureFBO;
344+
const auto cachedTexture = cacheEntry->blitTexture.get();
345+
const auto cachedFramebuffer = cacheEntry->blitFramebuffer.get();
346+
const auto newTexture = m_paintData.blitFramebuffer->colorAttachment();
348347

349348
// check if textures differ on the pixel level
350349
KWin::ShaderManager::instance()->pushShader(m_textureComparePass.shader.get());
351350

352351
// Use FBO of the cached blit; the query's draw will also
353352
// update this with pixels from the new blit (if it differs)
354-
KWin::GLFramebuffer::pushFramebuffer(cachedFramebuffer.get());
353+
KWin::GLFramebuffer::pushFramebuffer(cachedFramebuffer);
355354

356355
QMatrix4x4 projectionMatrix;
357356
projectionMatrix.ortho(QRectF(0.0, 0.0, newTexture->width(), newTexture->height()));

src/blur_cache.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ struct BlurCacheEntry {
3939

4040
// texture of the previous "raw" pixels (blit grabbed from scene)
4141
// used to create this cache entry
42-
// Uses shared pointers because the validation query also gets
43-
// a handle to these
44-
std::shared_ptr<KWin::GLTexture> blitTexture{nullptr};
45-
std::shared_ptr<KWin::GLFramebuffer> blitFramebuffer{nullptr};
42+
std::unique_ptr<KWin::GLTexture> blitTexture{nullptr};
43+
std::unique_ptr<KWin::GLFramebuffer> blitFramebuffer{nullptr};
4644

4745
// backgroundRect used to create this cache entry
4846
KWin::Rect backgroundRect{};

0 commit comments

Comments
 (0)