mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 05:25:58 +01:00
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
This commit is contained in:
parent
da956c8a97
commit
293e687389
2 changed files with 11 additions and 8 deletions
|
@ -861,6 +861,8 @@ 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");
|
||||||
|
if (m_sFinalScreenShader.time != -1)
|
||||||
|
m_sFinalScreenShader.initialTime = m_tGlobalTimer.getSeconds();
|
||||||
m_sFinalScreenShader.wl_output = glGetUniformLocation(m_sFinalScreenShader.program, "wl_output");
|
m_sFinalScreenShader.wl_output = glGetUniformLocation(m_sFinalScreenShader.program, "wl_output");
|
||||||
m_sFinalScreenShader.fullSize = glGetUniformLocation(m_sFinalScreenShader.program, "screen_size");
|
m_sFinalScreenShader.fullSize = glGetUniformLocation(m_sFinalScreenShader.program, "screen_size");
|
||||||
if (m_sFinalScreenShader.fullSize == -1)
|
if (m_sFinalScreenShader.fullSize == -1)
|
||||||
|
@ -1155,7 +1157,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, CBox* pB
|
||||||
glUniform1i(shader->tex, 0);
|
glUniform1i(shader->tex, 0);
|
||||||
|
|
||||||
if ((usingFinalShader && *PDT == 0) || CRASHING) {
|
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) {
|
} else if (usingFinalShader && shader->time != -1) {
|
||||||
// Don't let time be unitialised
|
// Don't let time be unitialised
|
||||||
glUniform1f(shader->time, 0.f);
|
glUniform1f(shader->time, 0.f);
|
||||||
|
|
|
@ -42,6 +42,7 @@ class CShader {
|
||||||
GLint gradientLength = -1;
|
GLint gradientLength = -1;
|
||||||
GLint angle = -1;
|
GLint angle = -1;
|
||||||
|
|
||||||
|
float initialTime = 0;
|
||||||
GLint time = -1;
|
GLint time = -1;
|
||||||
GLint distort = -1;
|
GLint distort = -1;
|
||||||
GLint wl_output = -1;
|
GLint wl_output = -1;
|
||||||
|
|
Loading…
Reference in a new issue