diff options
author | Party Wumpus <[email protected]> | 2024-07-16 21:03:10 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-16 22:03:10 +0200 |
commit | 293e687389a19b369f312c5c335c9afe7c886be1 (patch) | |
tree | f1d804b7c13a5dedda2e7088bed1ffaeeea7f889 /src/render/OpenGL.cpp | |
parent | da956c8a979471282db6790f5fa5dcec320ec226 (diff) | |
download | Hyprland-293e687389a19b369f312c5c335c9afe7c886be1.tar.gz Hyprland-293e687389a19b369f312c5c335c9afe7c886be1.zip |
renderer: Make shader time always count from zero (#6903)
* testing out an initialtime variable
* Make time universally start at zero instead of exposing an initial time
* Appease the CI
Diffstat (limited to 'src/render/OpenGL.cpp')
-rw-r--r-- | src/render/OpenGL.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index 8229e210..e127ec2d 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -858,9 +858,11 @@ 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"); + if (m_sFinalScreenShader.time != -1) + m_sFinalScreenShader.initialTime = m_tGlobalTimer.getSeconds(); m_sFinalScreenShader.wl_output = glGetUniformLocation(m_sFinalScreenShader.program, "wl_output"); m_sFinalScreenShader.fullSize = glGetUniformLocation(m_sFinalScreenShader.program, "screen_size"); if (m_sFinalScreenShader.fullSize == -1) @@ -1155,7 +1157,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB glUniform1i(shader->tex, 0); if ((usingFinalShader && *PDT == 0) || CRASHING) { - glUniform1f(shader->time, m_tGlobalTimer.getSeconds()); + glUniform1f(shader->time, m_tGlobalTimer.getSeconds() - shader->initialTime); } else if (usingFinalShader && shader->time != -1) { // Don't let time be unitialised glUniform1f(shader->time, 0.f); |