Switch to using an index for sprite tracking

Frees up two bytes in GPUCell. Doesn't require a minimum texture row
size. Makes a bunch of code faster. Index uses 31 bits which gives us
2,147,483,647 aka ~ 2 billion sprites.
This commit is contained in:
Kovid Goyal
2024-12-11 08:36:03 +05:30
parent 203a5f4e00
commit 0fb49f4139
12 changed files with 97 additions and 71 deletions

View File

@@ -14,6 +14,7 @@ from kitty.fast_data_types import (
ParsedFontFeature,
get_fallback_font,
set_allow_use_of_box_fonts,
sprite_idx_to_pos,
sprite_map_set_layout,
sprite_map_set_limits,
test_render_line,
@@ -231,7 +232,7 @@ def block_helpers(s, sprites, cell_width, cell_height):
line = s.line(y)
test_render_line(line)
for x in range(width * scale):
ans.append(sprites[line.sprite_at(x)])
ans.append(sprites[sprite_idx_to_pos(line.sprite_at(x), setup_for_testing.xnum, setup_for_testing.ynum)])
return ans
def block_test(*expected, **kw):