Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure textures are always destroyed #86

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

mBornand
Copy link
Contributor

When the previous wallpaper was replaced,
nothing was cleaning up the texture.

This is achieved by moving the destruction of the texture to the wallpaper code. This way we know it will be destroyed each time.

Without this fix I have the same or a similar issue as #81.

When the previous wallpaper was replaced,
nothing was cleaning up the texture.
@danyspin97
Copy link
Owner

Thanks for the PR @mBornand! I am currently in vacation, I'll review the PR first thing next week :)

@danyspin97
Copy link
Owner

I finally see the issue:

    #[inline]
    pub fn transition_finished(&mut self) {
        // By binding transparent pixel into the old wallpaper, we can delete the texture,
        // freeing space from the GPU
        unsafe {
            // The previous wallpaper is always binding in TEXTURE0
            self.gl.ActiveTexture(gl::TEXTURE0);
            self.gl
                .BindTexture(gl::TEXTURE_2D, self.transparent_texture);
            self.prev_wallpaper.take();
        }
    }

When I removed the previous wallpaper by calling Option::take(), the texture was not deleted. With this PR the issue is fixed, because now the texture is properly deleted. Thank you so much @mBornand !

@danyspin97 danyspin97 merged commit 132a01d into danyspin97:main Aug 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants