render: add OpenGL resource caching; optimize texture handling
Mildly improves rendering performance by caching OpenGL resources. Namely: - Cache shader program, VBO/EBO, and textures per output - Automatically free image data after GPU upload - Force RGBA format for consistent texture handling - Track texture state across output changes - Add texture invalidation on image changes This reduces the memory usage by a solid 30MB, but it's still not quite enough. I expect (or rather, hope) that we can cut it by half. Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a6964eebc783c5bc07b1fef7548a8d49f529c
This commit is contained in:
parent
3cbf6d5645
commit
d1116e7721
4 changed files with 221 additions and 114 deletions
|
|
@ -87,6 +87,14 @@ static int assign_wallpaper_to_output(chroma_state_t *state,
|
|||
return CHROMA_ERROR_IMAGE;
|
||||
}
|
||||
|
||||
// Check if image changed and invalidate texture cache if neceessary
|
||||
bool image_changed = (output->image != image);
|
||||
if (image_changed && output->image) {
|
||||
chroma_output_invalidate_texture(output);
|
||||
chroma_log("DEBUG", "Image changed for output %u, invalidated texture",
|
||||
output->id);
|
||||
}
|
||||
|
||||
// Assign image to output
|
||||
output->image = image;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue