screenshader: add output uniform

This commit is contained in:
Vaxry 2023-06-10 16:10:26 +02:00
parent 003993337a
commit 7932e42507
2 changed files with 11 additions and 5 deletions

View file

@ -158,8 +158,9 @@ void CHyprOpenGLImpl::end() {
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
if (m_RenderData.mouseZoomFactor != 1.f) {
const auto ZOOMCENTER =
(m_RenderData.mouseZoomUseMouse ? g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition : m_RenderData.pMonitor->vecTransformedSize / 2.f) * m_RenderData.pMonitor->scale;
const auto ZOOMCENTER = (m_RenderData.mouseZoomUseMouse ? g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition :
m_RenderData.pMonitor->vecTransformedSize / 2.f) *
m_RenderData.pMonitor->scale;
monbox.x -= ZOOMCENTER.x;
monbox.y -= ZOOMCENTER.y;
scaleBox(&monbox, m_RenderData.mouseZoomFactor);
@ -351,9 +352,10 @@ void CHyprOpenGLImpl::applyScreenShader(const std::string& path) {
return;
}
m_sFinalScreenShader.proj = glGetUniformLocation(m_sFinalScreenShader.program, "proj");
m_sFinalScreenShader.tex = glGetUniformLocation(m_sFinalScreenShader.program, "tex");
m_sFinalScreenShader.time = glGetUniformLocation(m_sFinalScreenShader.program, "time");
m_sFinalScreenShader.proj = glGetUniformLocation(m_sFinalScreenShader.program, "proj");
m_sFinalScreenShader.tex = glGetUniformLocation(m_sFinalScreenShader.program, "tex");
m_sFinalScreenShader.time = glGetUniformLocation(m_sFinalScreenShader.program, "time");
m_sFinalScreenShader.output = glGetUniformLocation(m_sFinalScreenShader.program, "output");
if (m_sFinalScreenShader.time != -1 && g_pConfigManager->getInt("debug:damage_tracking") != 0 && !g_pHyprRenderer->m_bCrashingInProgress) {
// The screen shader uses the "time" uniform
// Since the screen shader could change every frame, damage tracking *needs* to be disabled
@ -605,6 +607,9 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
glUniform1f(shader->time, 0.f);
}
if (usingFinalShader && shader->output > 0)
glUniform1i(shader->output, m_RenderData.pMonitor->ID);
if (CRASHING) {
glUniform1f(shader->distort, g_pHyprRenderer->m_fCrashingDistort);
glUniform2f(shader->fullSize, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y);

View file

@ -40,6 +40,7 @@ class CShader {
GLint time;
GLint distort;
GLint output;
GLint getUniformLocation(const std::string&);