mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-19 08:30:22 -07:00
renderer: don't crash if cm fails to compile
This commit is contained in:
parent
b37944605f
commit
3cc8e8c6be
@ -597,9 +597,8 @@ GLuint CHyprOpenGLImpl::createProgram(const std::string& vert, const std::string
|
||||
if (dynamic) {
|
||||
if (fragCompiled == 0)
|
||||
return 0;
|
||||
} else {
|
||||
} else
|
||||
RASSERT(fragCompiled, "Compiling shader failed. FRAGMENT nullptr! Shader source:\n\n{}", frag);
|
||||
}
|
||||
|
||||
auto prog = glCreateProgram();
|
||||
glAttachShader(prog, vertCompiled);
|
||||
@ -869,7 +868,9 @@ void CHyprOpenGLImpl::initShaders() {
|
||||
m_RenderData.pCurrentMonData->m_shQUAD.roundingPower = glGetUniformLocation(prog, "roundingPower");
|
||||
|
||||
#ifndef GLES2
|
||||
prog = createProgram(TEXVERTSRC320, TEXFRAGSRCCM);
|
||||
prog = createProgram(TEXVERTSRC320, TEXFRAGSRCCM, true);
|
||||
m_bCMSupported = prog > 0;
|
||||
if (m_bCMSupported) {
|
||||
m_RenderData.pCurrentMonData->m_shCM.program = prog;
|
||||
m_RenderData.pCurrentMonData->m_shCM.proj = glGetUniformLocation(prog, "proj");
|
||||
m_RenderData.pCurrentMonData->m_shCM.tex = glGetUniformLocation(prog, "tex");
|
||||
@ -899,6 +900,11 @@ void CHyprOpenGLImpl::initShaders() {
|
||||
m_RenderData.pCurrentMonData->m_shCM.applyTint = glGetUniformLocation(prog, "applyTint");
|
||||
m_RenderData.pCurrentMonData->m_shCM.tint = glGetUniformLocation(prog, "tint");
|
||||
m_RenderData.pCurrentMonData->m_shCM.useAlphaMatte = glGetUniformLocation(prog, "useAlphaMatte");
|
||||
} else {
|
||||
Debug::log(
|
||||
ERR,
|
||||
"WARNING: CM Shader failed compiling, color management will not work. It's likely because your GPU is an old piece of garbage, don't file bug reports about this!");
|
||||
}
|
||||
#endif
|
||||
|
||||
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBA);
|
||||
@ -1346,14 +1352,15 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
||||
shader = &m_RenderData.pCurrentMonData->m_shPASSTHRURGBA;
|
||||
usingFinalShader = true;
|
||||
} else {
|
||||
#ifndef GLES2
|
||||
if (m_bCMSupported)
|
||||
shader = &m_RenderData.pCurrentMonData->m_shCM;
|
||||
else
|
||||
#endif
|
||||
switch (tex->m_iType) {
|
||||
#ifdef GLES2
|
||||
case TEXTURE_RGBA: shader = &m_RenderData.pCurrentMonData->m_shRGBA; break;
|
||||
case TEXTURE_RGBX: shader = &m_RenderData.pCurrentMonData->m_shRGBX; break;
|
||||
#else
|
||||
case TEXTURE_RGBA:
|
||||
case TEXTURE_RGBX: shader = &m_RenderData.pCurrentMonData->m_shCM; break;
|
||||
#endif
|
||||
|
||||
case TEXTURE_EXTERNAL: shader = &m_RenderData.pCurrentMonData->m_shEXT; break; // might be unused
|
||||
default: RASSERT(false, "tex->m_iTarget unsupported!");
|
||||
}
|
||||
@ -1363,8 +1370,6 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
||||
if (m_RenderData.currentWindow && m_RenderData.currentWindow->m_sWindowData.RGBX.valueOrDefault()) {
|
||||
#ifdef GLES2
|
||||
shader = &m_RenderData.pCurrentMonData->m_shRGBX;
|
||||
#else
|
||||
shader = &m_RenderData.pCurrentMonData->m_shCM;
|
||||
#endif
|
||||
texType = TEXTURE_RGBX;
|
||||
}
|
||||
@ -1393,7 +1398,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
||||
#endif
|
||||
glUniform1i(shader->tex, 0);
|
||||
#ifndef GLES2
|
||||
if (!usingFinalShader && (texType == TEXTURE_RGBA || texType == TEXTURE_RGBX)) {
|
||||
if (shader == &m_RenderData.pCurrentMonData->m_shCM && !usingFinalShader && (texType == TEXTURE_RGBA || texType == TEXTURE_RGBX)) {
|
||||
const bool skipCM = *PPASS && m_RenderData.pMonitor->activeWorkspace && m_RenderData.pMonitor->activeWorkspace->m_bHasFullscreenWindow &&
|
||||
m_RenderData.pMonitor->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN;
|
||||
glUniform1i(shader->texType, texType);
|
||||
|
@ -290,6 +290,7 @@ class CHyprOpenGLImpl {
|
||||
bool m_bApplyFinalShader = false;
|
||||
bool m_bBlend = false;
|
||||
bool m_bOffloadedFramebuffer = false;
|
||||
bool m_bCMSupported = true;
|
||||
|
||||
CShader m_sFinalScreenShader;
|
||||
CTimer m_tGlobalTimer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user