From 82759d4095dc95a0d10aefe87072385dce9a4bf1 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Wed, 8 Oct 2025 22:25:55 +0200 Subject: buffer: move texture creation to commit time (#11964) * buffer: move texture creation to commit time move creating texture away from buffer attach into commitstate in an attempt to postpone gpu work until its really needed. best case scenario gpu clocks have ramped up before because we are actively doing things causing surface states and a commit to happend meaning less visible lag. * buffer: simplify texture creation make createTexture return a shared ptr directly, remove not needed member variables as m_success and m_texture. --- src/protocols/SinglePixel.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/protocols/SinglePixel.cpp') diff --git a/src/protocols/SinglePixel.cpp b/src/protocols/SinglePixel.cpp index 6ca48a35..9abde68a 100644 --- a/src/protocols/SinglePixel.cpp +++ b/src/protocols/SinglePixel.cpp @@ -12,16 +12,9 @@ CSinglePixelBuffer::CSinglePixelBuffer(uint32_t id, wl_client* client, CHyprColo m_opaque = col_.a >= 1.F; - m_texture = makeShared(DRM_FORMAT_ARGB8888, rc(&m_color), 4, Vector2D{1, 1}); - m_resource = CWLBufferResource::create(makeShared(client, 1, id)); - m_success = m_texture->m_texID; - size = {1, 1}; - - if (!m_success) - Debug::log(ERR, "Failed creating a single pixel texture: null texture id"); } CSinglePixelBuffer::~CSinglePixelBuffer() { @@ -57,6 +50,17 @@ void CSinglePixelBuffer::endDataPtr() { ; } +SP CSinglePixelBuffer::createTexture() { + auto tex = makeShared(DRM_FORMAT_ARGB8888, rc(&m_color), 4, Vector2D{1, 1}); + + if (!tex->m_texID) { + Debug::log(ERR, "Failed creating a single pixel texture: null texture id"); + return nullptr; + } + + return tex; +} + bool CSinglePixelBuffer::good() { return m_resource->good(); } -- cgit v1.2.3