Conversation
Implemented as more of a color search-and-replace feature. This allows enabling a transparent background on apps which are not alpha-aware - pick an unlikely color to use as the background, then configure SwayFX to remap it to another color with an alpha value.
Implemented as more of a color search-and-replace feature. This allows enabling a transparent background on apps which are not alpha-aware - pick an unlikely color to use as the background, then configure SwayFX to remap it to another color with an alpha value. Requires wlrfx/scenefx#160.
| vec4 c = sample_texture(); | ||
|
|
||
| // Color-key transparency: replace matching colors | ||
| if (colorkey_enabled) { |
There was a problem hiding this comment.
please use #define/#if and a new shader object for this, so perfomance stays identical when disabled
There was a problem hiding this comment.
AFAIU, because this is a uniform, the if should already be inlined. Are you aware of this causing any impact beyond shader compilation?
There was a problem hiding this comment.
Not sure how accurate this is, but
https://gist.github.com/CyberShadow/d5608b15998194aa75504016b7dd5b75
$ nix-shell --run ./run_benchmark.sh
Compiling branchless benchmark...
Compiling branching benchmark...
Running benchmarks...
========================================
OpenGL Version: 4.6 (Core Profile) Mesa 25.1.5
Renderer: AMD Radeon RX 6900 XT (radeonsi, navi21, LLVM 19.1.7, DRM 3.63, 6.15.5)
=== BRANCHLESS SHADER BENCHMARK ===
Resolution: 1920x1080
Iterations: 100000
Total time: 0.729 seconds
Average: 0.0073 ms/frame
FPS: 137188.91
OpenGL Version: 4.6 (Core Profile) Mesa 25.1.5
Renderer: AMD Radeon RX 6900 XT (radeonsi, navi21, LLVM 19.1.7, DRM 3.63, 6.15.5)
=== BRANCHING SHADER BENCHMARK (80% false, 20% true) ===
Resolution: 1920x1080
Iterations: 100000
Total time: 0.729 seconds
Average: 0.0073 ms/frame
FPS: 137139.10
========================================
Benchmark complete!
There was a problem hiding this comment.
Not sure how accurate this is, but
The issue isn't with high-end hardware, but with power limited "weak" (in comparison) laptop GPUs, especially with all the other things being rendered during the same frame, like poorly damaged toplevels, blur, shadows, etc.
There was a problem hiding this comment.
The issue isn't with high-end hardware, but with power limited "weak" (in comparison) laptop GPUs
Fair, here are the results on my 8-year-old laptop on the integrated GPU:
Compiling branchless benchmark...
Compiling branching benchmark...
Running benchmarks...
========================================
OpenGL Version: 4.6 (Core Profile) Mesa 25.2.4
Renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
=== BRANCHLESS SHADER BENCHMARK ===
Resolution: 1920x1080
Iterations: 10000
Total time: 4.240 seconds
Average: 0.4240 ms/frame
FPS: 2358.35
OpenGL Version: 4.6 (Core Profile) Mesa 25.2.4
Renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
=== BRANCHING SHADER BENCHMARK (80% false, 20% true) ===
Resolution: 1920x1080
Iterations: 10000
Total time: 4.227 seconds
Average: 0.4227 ms/frame
FPS: 2365.82
========================================
Benchmark complete!
especially with all the other things being rendered during the same frame, like poorly damaged toplevels, blur, shadows, etc.
If you insist, I'll apply the patch if that's what you want. Or do you want me to test any specific combination?
Implemented as more of a color search-and-replace feature.
This allows enabling a transparent background on apps which are not alpha-aware - pick an unlikely color to use as the background, then configure SwayFX to remap it to another color with an alpha value.