summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-01-26 02:26:10 +0000
committerVaxry <vaxry@vaxry.net>2024-01-26 02:26:10 +0000
commit72987dee88a0359d42af9f3064a62b934dcd7be0 (patch)
tree21a94076c4bc8a3d9251eecf361f7eba733058e8 /src/render/OpenGL.cpp
parent754eaf5b8b65c9764abe67ec2d599036cd51e381 (diff)
opengl: rassert false on lost context
we do not have infra to deal with this. It will cause hyprland to freeze rendering, we might as well die.
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r--src/render/OpenGL.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index 55a48a46..1c2ef26b 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -189,6 +189,23 @@ bool CHyprOpenGLImpl::passRequiresIntrospection(CMonitor* pMonitor) {
void CHyprOpenGLImpl::begin(CMonitor* pMonitor, CRegion* pDamage, CFramebuffer* fb) {
m_RenderData.pMonitor = pMonitor;
+#ifndef GLES2
+
+ const GLenum RESETSTATUS = glGetGraphicsResetStatus();
+ if (RESETSTATUS != GL_NO_ERROR) {
+ std::string errStr = "";
+ switch (RESETSTATUS) {
+ case GL_GUILTY_CONTEXT_RESET: errStr = "GL_GUILTY_CONTEXT_RESET"; break;
+ case GL_INNOCENT_CONTEXT_RESET: errStr = "GL_INNOCENT_CONTEXT_RESET"; break;
+ case GL_UNKNOWN_CONTEXT_RESET: errStr = "GL_UNKNOWN_CONTEXT_RESET"; break;
+ default: errStr = "UNKNOWN??"; break;
+ }
+ RASSERT(false, "Aborting, glGetGraphicsResetStatus returned {}. Cannot continue until proper GPU reset handling is implemented.", errStr);
+ return;
+ }
+
+#endif
+
TRACY_GPU_ZONE("RenderBegin");
glViewport(0, 0, pMonitor->vecPixelSize.x, pMonitor->vecPixelSize.y);
@@ -312,6 +329,12 @@ void CHyprOpenGLImpl::end() {
m_RenderData.mouseZoomFactor = 1.f;
m_RenderData.mouseZoomUseMouse = true;
m_RenderData.forceIntrospection = false;
+
+ // check for gl errors
+ const GLenum ERR = glGetError();
+
+ if (ERR == GL_CONTEXT_LOST) /* We don't have infra to recover from this */
+ RASSERT(false, "glGetError at Opengl::end() returned GL_CONTEXT_LOST. Cannot continue until proper GPU reset handling is implemented.");
}
void CHyprOpenGLImpl::initShaders() {