diff options
| author | Vaxry <vaxry@vaxry.net> | 2023-12-01 17:20:56 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2023-12-01 17:20:56 +0000 |
| commit | 9c09f2a847a1372c73cf67dc9e7e9ebe309b142e (patch) | |
| tree | 5f8b5ed8b1bd9c1cf23155ffbfded231983cd21e /src/render | |
| parent | 8440a30231ea41a6b1dacc60a28837b265a6efec (diff) | |
screencopy: fix shm exports with 10-bit
fixes #4019
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/Framebuffer.cpp | 8 | ||||
| -rw-r--r-- | src/render/OpenGL.cpp | 13 | ||||
| -rw-r--r-- | src/render/OpenGL.hpp | 2 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp index 94b3f64a..eed23699 100644 --- a/src/render/Framebuffer.cpp +++ b/src/render/Framebuffer.cpp @@ -6,13 +6,7 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) { RASSERT((w > 1 && h > 1), "cannot alloc a FB with negative / zero size! (attempted {}x{})", w, h); uint32_t glFormat = drmFormatToGL(drmFormat); - uint32_t glType = glFormat != GL_RGBA ? -#ifdef GLES2 - GL_UNSIGNED_INT_2_10_10_10_REV_EXT : -#else - GL_UNSIGNED_INT_2_10_10_10_REV : -#endif - GL_UNSIGNED_BYTE; + uint32_t glType = glFormatToType(glFormat); if (m_iFb == (uint32_t)-1) { firstAlloc = true; diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index dbdabdad..4eb45d8f 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -2064,3 +2064,16 @@ void CHyprOpenGLImpl::bindBackOnMain() { void CHyprOpenGLImpl::setMonitorTransformEnabled(bool enabled) { m_bEndFrame = !enabled; } + +uint32_t CHyprOpenGLImpl::getPreferredReadFormat(CMonitor* pMonitor) { + if (g_pHyprRenderer->isNvidia()) + return DRM_FORMAT_XRGB8888; + + if (pMonitor->drmFormat == DRM_FORMAT_XRGB8888) + return DRM_FORMAT_XRGB8888; + if (pMonitor->drmFormat == DRM_FORMAT_XBGR8888) + return DRM_FORMAT_XBGR8888; + if (pMonitor->drmFormat == DRM_FORMAT_XRGB2101010 || pMonitor->drmFormat == DRM_FORMAT_XBGR2101010) + return DRM_FORMAT_XBGR2101010; + return DRM_FORMAT_INVALID; +} diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index f4661e1a..2830870b 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -158,6 +158,8 @@ class CHyprOpenGLImpl { void renderOffToMain(CFramebuffer* off); void bindBackOnMain(); + uint32_t getPreferredReadFormat(CMonitor* pMonitor); + SCurrentRenderData m_RenderData; GLint m_iCurrentOutputFb = 0; |
