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

Long-running custom shaders #913

Open
YaLTeR opened this issue Jan 1, 2025 · 0 comments
Open

Long-running custom shaders #913

YaLTeR opened this issue Jan 1, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@YaLTeR
Copy link
Owner

YaLTeR commented Jan 1, 2025

Currently you can set a custom shader for short animations (window open, close, resize) but not for something long-running. For example, you can't put a custom shader on a window or an output in general.

This can be used for fun effects, but also for things like grayscale mode, or desaturating unfocused windows and such.

The reason I haven't added it yet is that it requires some damage tracking design. While short animations can sidestep the problem and always draw with full damage, anything long-running should report correct damage whenever possible since this massively affects power consumption and background system load.

I have two ideas on how to handle this.

One is to have a property that you must set when using a custom shader that tells niri how it affects damage. The two obvious values are: does not affect damage (i.e. the shader changes each pixel independently), requires full damage (the shader can do whatever it wants, but same input texture always produces the same output texture), and requires full damage and is animated (the shader can do whatever it wants and accepts current time as input for animations).

Second idea is to also offer different shader interfaces for these values. Like, for shaders that do not affect damage, offer a vec4 process(vec4 color) interface that processes each pixel individually. I suspect this could be unnecessarily limiting, and well, if you're writing a custom shader and set the damage property wrong, then the worst thing that can happen is you get some weird redrawing on screen.

@YaLTeR YaLTeR added the enhancement New feature or request label Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant