From b755345a464096f3a9b2581128caaf634b4d96e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Molinari?= Date: Tue, 23 Jul 2024 14:01:59 +0200 Subject: [PATCH] gl-renderer: Assume fixed wireframe tex unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wireframe unit can only be used by the wireframe texture so there's no need to bind it anymore before use. Signed-off-by: Loïc Molinari --- libweston/renderer-gl/gl-renderer.c | 1 + libweston/renderer-gl/gl-shaders.c | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 77d0677a..34f83360 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -1812,6 +1812,7 @@ update_wireframe_tex(struct gl_renderer *gr, if (new_size <= gr->wireframe_size) return; + glActiveTexture(GL_TEXTURE0 + TEX_UNIT_WIREFRAME); if (gr->wireframe_size == 0) { glGenTextures(1, &gr->wireframe_tex); glBindTexture(GL_TEXTURE_2D, gr->wireframe_tex); diff --git a/libweston/renderer-gl/gl-shaders.c b/libweston/renderer-gl/gl-shaders.c index e40dafe5..b49b4eaa 100644 --- a/libweston/renderer-gl/gl-shaders.c +++ b/libweston/renderer-gl/gl-shaders.c @@ -765,12 +765,8 @@ gl_shader_load_config(struct gl_shader *shader, break; } - if (sconf->req.wireframe) { - assert(sconf->wireframe_tex != 0); + if (sconf->req.wireframe) glUniform1i(shader->tex_uniform_wireframe, TEX_UNIT_WIREFRAME); - glActiveTexture(GL_TEXTURE0 + TEX_UNIT_WIREFRAME); - glBindTexture(GL_TEXTURE_2D, sconf->wireframe_tex); - } } bool