Backport fg override algo change from slang to legacy glsl shaders

This commit is contained in:
Kovid Goyal
2026-07-03 12:22:37 +05:30
parent a0034e362d
commit 47a238e4b3
2 changed files with 10 additions and 3 deletions

View File

@@ -1,4 +1,3 @@
#define DO_FG_OVERRIDE {DO_FG_OVERRIDE}
#define FG_OVERRIDE_THRESHOLD {FG_OVERRIDE_THRESHOLD}
#define FG_OVERRIDE_ALGO {FG_OVERRIDE_ALGO}
#define TEXT_NEW_GAMMA {TEXT_NEW_GAMMA}
@@ -25,5 +24,11 @@
#define ONLY_FOREGROUND
#endif
#if FG_OVERRIDE_ALGO == 0
#define DO_FG_OVERRIDE 0
#else
#define DO_FG_OVERRIDE 1
#endif
// Linear space luminance values
const vec3 Y = vec3(0.2126, 0.7152, 0.0722);

View File

@@ -190,11 +190,13 @@ class LoadShaderPrograms:
)
def resolve_cell_defines(only_fg: int, only_bg: int, src: str) -> str:
algo = '1' if self.text_fg_override_threshold.unit == '%' else '2'
if not self.text_fg_override_threshold.scaled_value:
algo = '0'
r = self.cell_program_replacer.replacements
r['ONLY_FOREGROUND'] = str(only_fg)
r['ONLY_BACKGROUND'] = str(only_bg)
r['DO_FG_OVERRIDE'] = '1' if self.text_fg_override_threshold.scaled_value else '0'
r['FG_OVERRIDE_ALGO'] = '1' if self.text_fg_override_threshold.unit == '%' else '2'
r['FG_OVERRIDE_ALGO'] = algo
r['FG_OVERRIDE_THRESHOLD'] = str(self.text_fg_override_threshold.scaled_value)
r['TEXT_NEW_GAMMA'] = '0' if self.text_old_gamma else '1'
return self.cell_program_replacer(src)