aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2023-12-02 14:51:35 +0000
committerVaxry <[email protected]>2023-12-02 14:51:45 +0000
commit80b9b21f9f24b6e8db2fc6f7705cd124f436ffba (patch)
treea153a69c65c4ea598067e6684e33e9e30baf952d
parent758cf90ea1066eea361a9d8c347e7fcf40f6636f (diff)
downloadHyprland-80b9b21f9f24b6e8db2fc6f7705cd124f436ffba.tar.gz
Hyprland-80b9b21f9f24b6e8db2fc6f7705cd124f436ffba.zip
opengl: fix nvidia read formats
fixes #4023
-rw-r--r--src/render/OpenGL.cpp8
-rw-r--r--src/render/OpenGL.hpp4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 30187862..cbfe56e8 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -35,6 +35,8 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
loadGLProc(&m_sProc.glEGLImageTargetRenderbufferStorageOES, "glEGLImageTargetRenderbufferStorageOES");
loadGLProc(&m_sProc.eglDestroyImageKHR, "eglDestroyImageKHR");
+ m_sExts.EXT_read_format_bgra = m_szExtensions.contains("GL_EXT_read_format_bgra");
+
#ifdef USE_TRACY_GPU
loadGLProc(&glQueryCounter, "glQueryCounterEXT");
@@ -2067,12 +2069,10 @@ void CHyprOpenGLImpl::setMonitorTransformEnabled(bool enabled) {
uint32_t CHyprOpenGLImpl::getPreferredReadFormat(CMonitor* pMonitor) {
if (g_pHyprRenderer->isNvidia())
- return DRM_FORMAT_XRGB8888;
+ return DRM_FORMAT_XBGR8888;
- if (pMonitor->drmFormat == DRM_FORMAT_XRGB8888)
+ if (pMonitor->drmFormat == DRM_FORMAT_XRGB8888 || pMonitor->drmFormat == DRM_FORMAT_XBGR8888)
return DRM_FORMAT_XBGR8888;
- if (pMonitor->drmFormat == DRM_FORMAT_XBGR8888)
- return DRM_FORMAT_XRGB8888;
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 2830870b..c3726575 100644
--- a/src/render/OpenGL.hpp
+++ b/src/render/OpenGL.hpp
@@ -179,6 +179,10 @@ class CHyprOpenGLImpl {
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR = nullptr;
} m_sProc;
+ struct {
+ bool EXT_read_format_bgra = false;
+ } m_sExts;
+
private:
std::list<GLuint> m_lBuffers;
std::list<GLuint> m_lTextures;