From a6efb9038219562f65c20c997996b74dffed3910 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 11 Aug 2017 09:00:26 -0400 Subject: [PATCH] s/gen/ensure/ fixes #47 --- render/gles2/texture.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/render/gles2/texture.c b/render/gles2/texture.c index f2c88af5c..5a28edbd5 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -21,11 +21,10 @@ static struct pixel_format external_pixel_format = { .shader = &shaders.external }; -static void gles2_texture_gen_texture(struct wlr_texture_state *surface) { +static void gles2_texture_ensure_texture(struct wlr_texture_state *surface) { if (surface->tex_id) { return; } - GL_CALL(glGenTextures(1, &surface->tex_id)); GL_CALL(glBindTexture(GL_TEXTURE_2D, surface->tex_id)); GL_CALL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); @@ -46,7 +45,7 @@ static bool gles2_texture_upload_pixels(struct wlr_texture_state *texture, texture->wlr_texture->format = format; texture->pixel_format = fmt; - gles2_texture_gen_texture(texture); + gles2_texture_ensure_texture(texture); GL_CALL(glBindTexture(GL_TEXTURE_2D, texture->tex_id)); GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride)); GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, fmt->gl_format, width, height, 0, @@ -96,7 +95,7 @@ static bool gles2_texture_upload_shm(struct wlr_texture_state *texture, texture->wlr_texture->format = format; texture->pixel_format = fmt; - gles2_texture_gen_texture(texture); + gles2_texture_ensure_texture(texture); GL_CALL(glBindTexture(GL_TEXTURE_2D, texture->tex_id)); GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, pitch)); GL_CALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0)); @@ -176,7 +175,7 @@ static bool gles2_texture_upload_drm(struct wlr_texture_state *tex, return false; } - gles2_texture_gen_texture(tex); + gles2_texture_ensure_texture(tex); GL_CALL(glBindTexture(GL_TEXTURE_2D, tex->tex_id)); EGLint attribs[] = { EGL_WAYLAND_PLANE_WL, 0, EGL_NONE };