gl-renderer: add missing glActiveTexture calls

Various functions leave the current active texture as whatever. The
functions touched in this commit forgot to reset the active texture to
slot 0 before binding their textures. If not explicitly unbound, this
could leave textures lingering in unused slots, perhaps. Not sure if
that could cause any harm, but for consistency's sake, always use slot 0
when not multitexturing.

Found by code inspection.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago
parent c12963f98d
commit 7714c6172d
  1. 5
      libweston/renderer-gl/gl-renderer.c

@ -1721,6 +1721,8 @@ gl_renderer_flush_damage(struct weston_surface *surface)
data = wl_shm_buffer_get_data(buffer->shm_buffer);
glActiveTexture(GL_TEXTURE0);
if (gs->needs_full_upload || quirks->gl_force_full_upload) {
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
@ -1786,6 +1788,8 @@ ensure_textures(struct gl_surface_state *gs, int num_textures)
if (num_textures <= gs->num_textures)
return;
glActiveTexture(GL_TEXTURE0);
for (i = gs->num_textures; i < num_textures; i++) {
glGenTextures(1, &gs->textures[i]);
glBindTexture(gs->target, gs->textures[i]);
@ -2861,6 +2865,7 @@ gl_renderer_surface_copy_content(struct weston_surface *surface,
if (!gl_renderer_use_program(gr, &shader))
return -1;
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, cw, ch,

Loading…
Cancel
Save