mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 21:25:59 +01:00
screenshader: add output uniform
This commit is contained in:
parent
003993337a
commit
7932e42507
2 changed files with 11 additions and 5 deletions
|
@ -158,8 +158,9 @@ void CHyprOpenGLImpl::end() {
|
||||||
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
wlr_box monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
|
||||||
|
|
||||||
if (m_RenderData.mouseZoomFactor != 1.f) {
|
if (m_RenderData.mouseZoomFactor != 1.f) {
|
||||||
const auto ZOOMCENTER =
|
const auto ZOOMCENTER = (m_RenderData.mouseZoomUseMouse ? g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition :
|
||||||
(m_RenderData.mouseZoomUseMouse ? g_pInputManager->getMouseCoordsInternal() - m_RenderData.pMonitor->vecPosition : m_RenderData.pMonitor->vecTransformedSize / 2.f) * m_RenderData.pMonitor->scale;
|
m_RenderData.pMonitor->vecTransformedSize / 2.f) *
|
||||||
|
m_RenderData.pMonitor->scale;
|
||||||
monbox.x -= ZOOMCENTER.x;
|
monbox.x -= ZOOMCENTER.x;
|
||||||
monbox.y -= ZOOMCENTER.y;
|
monbox.y -= ZOOMCENTER.y;
|
||||||
scaleBox(&monbox, m_RenderData.mouseZoomFactor);
|
scaleBox(&monbox, m_RenderData.mouseZoomFactor);
|
||||||
|
@ -354,6 +355,7 @@ void CHyprOpenGLImpl::applyScreenShader(const std::string& path) {
|
||||||
m_sFinalScreenShader.proj = glGetUniformLocation(m_sFinalScreenShader.program, "proj");
|
m_sFinalScreenShader.proj = glGetUniformLocation(m_sFinalScreenShader.program, "proj");
|
||||||
m_sFinalScreenShader.tex = glGetUniformLocation(m_sFinalScreenShader.program, "tex");
|
m_sFinalScreenShader.tex = glGetUniformLocation(m_sFinalScreenShader.program, "tex");
|
||||||
m_sFinalScreenShader.time = glGetUniformLocation(m_sFinalScreenShader.program, "time");
|
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) {
|
if (m_sFinalScreenShader.time != -1 && g_pConfigManager->getInt("debug:damage_tracking") != 0 && !g_pHyprRenderer->m_bCrashingInProgress) {
|
||||||
// The screen shader uses the "time" uniform
|
// The screen shader uses the "time" uniform
|
||||||
// Since the screen shader could change every frame, damage tracking *needs* to be disabled
|
// 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);
|
glUniform1f(shader->time, 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (usingFinalShader && shader->output > 0)
|
||||||
|
glUniform1i(shader->output, m_RenderData.pMonitor->ID);
|
||||||
|
|
||||||
if (CRASHING) {
|
if (CRASHING) {
|
||||||
glUniform1f(shader->distort, g_pHyprRenderer->m_fCrashingDistort);
|
glUniform1f(shader->distort, g_pHyprRenderer->m_fCrashingDistort);
|
||||||
glUniform2f(shader->fullSize, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y);
|
glUniform2f(shader->fullSize, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y);
|
||||||
|
|
|
@ -40,6 +40,7 @@ class CShader {
|
||||||
|
|
||||||
GLint time;
|
GLint time;
|
||||||
GLint distort;
|
GLint distort;
|
||||||
|
GLint output;
|
||||||
|
|
||||||
GLint getUniformLocation(const std::string&);
|
GLint getUniformLocation(const std::string&);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue