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.
This commit is contained in:
Vaxry
2024-11-01 15:52:03 +00:00
parent 3852418d24
commit d8b865366a
5 changed files with 139 additions and 71 deletions

View File

@@ -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();
}