summaryrefslogtreecommitdiff
path: root/src/render/Framebuffer.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-11-01 15:52:03 +0000
committerVaxry <vaxry@vaxry.net>2024-11-01 15:52:09 +0000
commitd8b865366af9d5ed30d2ee0a437b9a3ed43c10bd (patch)
tree5d9ee0ea740c97dbcbdfddc2073a19ad7df17d25 /src/render/Framebuffer.cpp
parent3852418d2446555509738bf1486940042107afe7 (diff)
renderer: Add a missing texture asset and a user check
When an asset is missing, instead of a black screen, render an obnoxious, yet standard, missing texture. Additionally, warn the user assets failed to load. Shoutout to Arch for having their assets broken for months. Fix your shit. I am tired of it, and it's negatively impacting users.
Diffstat (limited to 'src/render/Framebuffer.cpp')
-rw-r--r--src/render/Framebuffer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/render/Framebuffer.cpp b/src/render/Framebuffer.cpp
index c48ff6f3..7e086778 100644
--- a/src/render/Framebuffer.cpp
+++ b/src/render/Framebuffer.cpp
@@ -2,7 +2,7 @@
#include "OpenGL.hpp"
CFramebuffer::CFramebuffer() {
- m_cTex = makeShared<CTexture>();
+ ;
}
bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
@@ -12,6 +12,9 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
uint32_t glFormat = FormatUtils::drmFormatToGL(drmFormat);
uint32_t glType = FormatUtils::glFormatToType(glFormat);
+ if (!m_cTex)
+ m_cTex = makeShared<CTexture>();
+
if (!m_iFbAllocated) {
firstAlloc = true;
glGenFramebuffers(1, &m_iFb);
@@ -54,7 +57,8 @@ bool CFramebuffer::alloc(int w, int h, uint32_t drmFormat) {
}
glBindTexture(GL_TEXTURE_2D, 0);
- glBindFramebuffer(GL_FRAMEBUFFER, g_pHyprOpenGL->m_iCurrentOutputFb);
+ if (g_pHyprOpenGL)
+ glBindFramebuffer(GL_FRAMEBUFFER, g_pHyprOpenGL->m_iCurrentOutputFb);
m_vSize = Vector2D(w, h);
@@ -85,14 +89,17 @@ void CFramebuffer::bind() {
#else
glBindFramebuffer(GL_FRAMEBUFFER, m_iFb);
#endif
- glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y);
+ if (g_pHyprOpenGL)
+ glViewport(0, 0, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.x, g_pHyprOpenGL->m_RenderData.pMonitor->vecPixelSize.y);
+ else
+ glViewport(0, 0, m_vSize.x, m_vSize.y);
}
void CFramebuffer::release() {
if (m_iFbAllocated)
glDeleteFramebuffers(1, &m_iFb);
- m_cTex->destroyTexture();
+ m_cTex.reset();
m_iFbAllocated = false;
m_vSize = Vector2D();
}