Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shader time always count from zero #6903

Merged
merged 3 commits into from
Jul 16, 2024
Merged

Conversation

PartyWumpus
Copy link
Contributor

Describe your PR, what does it fix/add?

At the moment, a shader's time uniform is initially set to whatever the current value of m_tGlobalTimer is. This means that any shaders that are enabled after hyprland starts have no way of knowing how long it has been since they were enabled (this only applies to the user defined screen shader as far as I can tell).

This PR fixes this by storing the initial time and setting the time uniform to time - initialTime, so a shader's first time value is zero (and then counts up normally from there).

Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

This only sets the initial time value for the screen shader (everything else defaulting to zero), as I assume nothing else actually needs it. This does mean the initial time could just be stored outside of the CShader, but it's easier this way.

It means that whenever the config is edited and the user has a screen shader active it will reset the screen shader's time back to zero instead of continuing roughly from where they were. If this is a problem then it could instead just expose an initial_time uniform to the shader but the only thing you could possibly do with it is just float timer = time-initial_time; so I think it's best not to, for ease of use. (the first commit does it this way)

Is it ready for merging, or does it need work?

Should be ready to merge, it works fine on my machine.

vaxerski
vaxerski previously approved these changes Jul 16, 2024
Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oke doke

@vaxerski
Copy link
Member

can you rebase on main and run clang-format to make the ci happy?

@PartyWumpus
Copy link
Contributor Author

Sure, done. I thought I already ran clang-format, but clearly I forgot.

Copy link
Member

@vaxerski vaxerski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coolio, thanks!

@vaxerski vaxerski merged commit 293e687 into hyprwm:main Jul 16, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants