diff options
| author | fazzi <18248986+fxzzi@users.noreply.github.com> | 2026-04-26 19:20:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-26 19:20:18 +0100 |
| commit | d669ea7db20bad576f13f2b0f7aca038d95536e1 (patch) | |
| tree | 07143125f3d0b369d2f480ebd3125f35fbf776ba /src/render/gl | |
| parent | 2652e2aeab4868b0daf856df7ea1582f1ce51dfe (diff) | |
renderer: swizzle on shm screencopy (#14167)
in ds format (XBGR8888) the swizzle was pretty much being ignored. It
would cause screenshots taken within DS, or apps which use screencopy
like hyprpicker, wayfreeze, and still, to come out with the red and blue
channels flipped.
Diffstat (limited to 'src/render/gl')
| -rw-r--r-- | src/render/gl/GLFramebuffer.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/render/gl/GLFramebuffer.cpp b/src/render/gl/GLFramebuffer.cpp index 59c0c4e3..d8b198c3 100644 --- a/src/render/gl/GLFramebuffer.cpp +++ b/src/render/gl/GLFramebuffer.cpp @@ -127,21 +127,17 @@ bool CGLFramebuffer::readPixels(CHLBufferReference buffer, uint32_t offsetX, uin uint32_t packStride = minStride(PFORMAT, m_size.x); int glFormat = PFORMAT->glFormat; - if (glFormat == GL_RGBA) - glFormat = GL_BGRA_EXT; - - if (glFormat != GL_BGRA_EXT && glFormat != GL_RGB) { - if (PFORMAT->swizzle.has_value()) { - if (PFORMAT->swizzle == SWIZZLE_RGBA) - glFormat = GL_RGBA; - else if (PFORMAT->swizzle == SWIZZLE_BGRA) - glFormat = GL_BGRA_EXT; - else { - LOGM(Log::ERR, "Copied frame via shm might be broken or color flipped"); - glFormat = GL_RGBA; - } + if (PFORMAT->swizzle.has_value()) { + if (PFORMAT->swizzle == SWIZZLE_RGBA) + glFormat = GL_RGBA; + else if (PFORMAT->swizzle == SWIZZLE_BGRA) + glFormat = GL_BGRA_EXT; + else { + LOGM(Log::ERR, "Copied frame via shm might be broken or color flipped"); + glFormat = GL_RGBA; } - } + } else if (glFormat == GL_RGBA) + glFormat = GL_BGRA_EXT; // This could be optimized by using a pixel buffer object to make this async, // but really clients should just use a dma buffer anyways. |
