Skip to content

Commit

Permalink
perf: Directly bind the new texture to TEXTURE1
Browse files Browse the repository at this point in the history
  • Loading branch information
danyspin97 committed Jul 12, 2024
1 parent bfcf45f commit 430244a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion daemon/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ fn load_texture(gl: &gl::Gl, image: DynamicImage) -> Result<gl::types::GLuint> {
let mut texture = 0;
gl.GenTextures(1, &mut texture);
gl_check!(gl, "generating textures");
gl.ActiveTexture(gl::TEXTURE0);
gl.ActiveTexture(gl::TEXTURE1);
gl_check!(gl, "activating textures");
gl.BindTexture(gl::TEXTURE_2D, texture);
gl_check!(gl, "binding textures");
Expand Down
5 changes: 2 additions & 3 deletions daemon/src/render/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ impl Renderer {
.expect("previous wallpaper to be set")
.bind(&self.gl)?;

self.gl.ActiveTexture(gl::TEXTURE1);
self.check_error("activating gl::TEXTURE1")?;
self.current_wallpaper.bind(&self.gl)?;
// current_wallpaper is already binded to TEXTURE1, as load_texture loads the image
// there
}

Ok(())
Expand Down

0 comments on commit 430244a

Please sign in to comment.