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:
Party Wumpus 2024-07-16 21:03:10 +01:00 committed by GitHub
parent da956c8a97
commit 293e687389
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 8 deletions

View file

@ -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);

View file

@ -42,9 +42,10 @@ class CShader {
GLint gradientLength = -1;
GLint angle = -1;
GLint time = -1;
GLint distort = -1;
GLint wl_output = -1;
float initialTime = 0;
GLint time = -1;
GLint distort = -1;
GLint wl_output = -1;
// Blur prepare
GLint contrast = -1;
@ -64,4 +65,4 @@ class CShader {
private:
std::unordered_map<std::string, GLint> m_muUniforms;
};
};