diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp index b361c6c8..ed24baae 100644 --- a/src/protocols/types/DMABuffer.cpp +++ b/src/protocols/types/DMABuffer.cpp @@ -60,6 +60,9 @@ void CDMABuffer::endDataPtr() { } SP CDMABuffer::createTexture() { + if (m_texture) // dmabuffers only get one texture per buffer. + return m_texture; + g_pHyprRenderer->makeEGLCurrent(); auto eglImage = g_pHyprOpenGL->createEGLImage(m_attrs); @@ -73,14 +76,14 @@ SP CDMABuffer::createTexture() { } } - auto tex = makeShared(m_attrs, eglImage); // texture takes ownership of the eglImage + m_texture = makeShared(m_attrs, eglImage); // texture takes ownership of the eglImage - if UNLIKELY (!tex->m_texID) { + if UNLIKELY (!m_texture->m_texID) { Debug::log(ERR, "Failed to create a dmabuf: texture is null"); return nullptr; } - return tex; + return m_texture; } bool CDMABuffer::good() { diff --git a/src/protocols/types/DMABuffer.hpp b/src/protocols/types/DMABuffer.hpp index 14c1eb75..8b838252 100644 --- a/src/protocols/types/DMABuffer.hpp +++ b/src/protocols/types/DMABuffer.hpp @@ -22,6 +22,7 @@ class CDMABuffer : public IHLBuffer { private: Aquamarine::SDMABUFAttrs m_attrs; + SP m_texture; struct { CHyprSignalListener resourceDestroy;