mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 06:05:59 +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
|
@ -858,9 +858,11 @@ void CHyprOpenGLImpl::applyScreenShader(const std::string& path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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,9 +42,10 @@ class CShader {
|
||||||
GLint gradientLength = -1;
|
GLint gradientLength = -1;
|
||||||
GLint angle = -1;
|
GLint angle = -1;
|
||||||
|
|
||||||
GLint time = -1;
|
float initialTime = 0;
|
||||||
GLint distort = -1;
|
GLint time = -1;
|
||||||
GLint wl_output = -1;
|
GLint distort = -1;
|
||||||
|
GLint wl_output = -1;
|
||||||
|
|
||||||
// Blur prepare
|
// Blur prepare
|
||||||
GLint contrast = -1;
|
GLint contrast = -1;
|
||||||
|
@ -64,4 +65,4 @@ class CShader {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unordered_map<std::string, GLint> m_muUniforms;
|
std::unordered_map<std::string, GLint> m_muUniforms;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue