opengl: fix nvidia read formats

fixes #4023
This commit is contained in:
Vaxry 2023-12-02 14:51:35 +00:00
parent 758cf90ea1
commit 80b9b21f9f
2 changed files with 9 additions and 5 deletions

View file

@ -35,6 +35,8 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
loadGLProc(&m_sProc.glEGLImageTargetRenderbufferStorageOES, "glEGLImageTargetRenderbufferStorageOES"); loadGLProc(&m_sProc.glEGLImageTargetRenderbufferStorageOES, "glEGLImageTargetRenderbufferStorageOES");
loadGLProc(&m_sProc.eglDestroyImageKHR, "eglDestroyImageKHR"); loadGLProc(&m_sProc.eglDestroyImageKHR, "eglDestroyImageKHR");
m_sExts.EXT_read_format_bgra = m_szExtensions.contains("GL_EXT_read_format_bgra");
#ifdef USE_TRACY_GPU #ifdef USE_TRACY_GPU
loadGLProc(&glQueryCounter, "glQueryCounterEXT"); loadGLProc(&glQueryCounter, "glQueryCounterEXT");
@ -2067,12 +2069,10 @@ void CHyprOpenGLImpl::setMonitorTransformEnabled(bool enabled) {
uint32_t CHyprOpenGLImpl::getPreferredReadFormat(CMonitor* pMonitor) { uint32_t CHyprOpenGLImpl::getPreferredReadFormat(CMonitor* pMonitor) {
if (g_pHyprRenderer->isNvidia()) if (g_pHyprRenderer->isNvidia())
return DRM_FORMAT_XRGB8888;
if (pMonitor->drmFormat == DRM_FORMAT_XRGB8888)
return DRM_FORMAT_XBGR8888; return DRM_FORMAT_XBGR8888;
if (pMonitor->drmFormat == DRM_FORMAT_XBGR8888)
return DRM_FORMAT_XRGB8888; if (pMonitor->drmFormat == DRM_FORMAT_XRGB8888 || pMonitor->drmFormat == DRM_FORMAT_XBGR8888)
return DRM_FORMAT_XBGR8888;
if (pMonitor->drmFormat == DRM_FORMAT_XRGB2101010 || pMonitor->drmFormat == DRM_FORMAT_XBGR2101010) if (pMonitor->drmFormat == DRM_FORMAT_XRGB2101010 || pMonitor->drmFormat == DRM_FORMAT_XBGR2101010)
return DRM_FORMAT_XBGR2101010; return DRM_FORMAT_XBGR2101010;
return DRM_FORMAT_INVALID; return DRM_FORMAT_INVALID;

View file

@ -179,6 +179,10 @@ class CHyprOpenGLImpl {
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR = nullptr; PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR = nullptr;
} m_sProc; } m_sProc;
struct {
bool EXT_read_format_bgra = false;
} m_sExts;
private: private:
std::list<GLuint> m_lBuffers; std::list<GLuint> m_lBuffers;
std::list<GLuint> m_lTextures; std::list<GLuint> m_lTextures;