mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibAccelGfx+LibWeb: Add texture cache for immutable bitmaps
This change introduces a texture cache for immutable bitmaps in the GPU painter. The cache is persisted across page repaints, so now, on page scroll repaint, in many cases, we won't need to upload any new textures. Also, if the same image is painted more than once on a page, its texture will only be uploaded once. Generally, the GPU painter works much faster with this change on all pages that have images.
This commit is contained in:
parent
f4a5c136c3
commit
a1c8fb10fa
7 changed files with 65 additions and 1 deletions
|
@ -425,6 +425,17 @@ void RecordingPainter::execute(PaintingCommandExecutor& executor)
|
|||
executor.prepare_glyph_texture(unique_glyphs);
|
||||
}
|
||||
|
||||
if (executor.needs_update_immutable_bitmap_texture_cache()) {
|
||||
HashMap<u32, Gfx::ImmutableBitmap const*> immutable_bitmaps;
|
||||
for (auto const& command : m_painting_commands) {
|
||||
if (command.has<DrawScaledImmutableBitmap>()) {
|
||||
auto const& immutable_bitmap = command.get<DrawScaledImmutableBitmap>().bitmap;
|
||||
immutable_bitmaps.set(immutable_bitmap->id(), immutable_bitmap.ptr());
|
||||
}
|
||||
}
|
||||
executor.update_immutable_bitmap_texture_cache(immutable_bitmaps);
|
||||
}
|
||||
|
||||
size_t next_command_index = 0;
|
||||
while (next_command_index < m_painting_commands.size()) {
|
||||
auto& command = m_painting_commands[next_command_index++];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue