From e54daddc4758c954c6fcabdeffafecc9982f87a1 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 17 Jan 2019 13:06:53 +0100 Subject: [PATCH] renderer: don't call glActiveTexture unless we're going to do something MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's no point in changing the texture-binding unless we're going to do something with the texture-stage. Signed-off-by: Erik Faye-Lund Reviewed-by: Stéphane Marchesin --- src/vrend_renderer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 6832275..9b723f4 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3640,7 +3640,6 @@ static void vrend_draw_bind_samplers_shader(struct vrend_context *ctx, tview->gl_swizzle_a == GL_ONE ? 1.0 : 0.0); } - glActiveTexture(GL_TEXTURE0 + *sampler_id); if (tview->texture) { GLuint id; struct vrend_resource *texture = tview->texture; @@ -3654,7 +3653,9 @@ static void vrend_draw_bind_samplers_shader(struct vrend_context *ctx, } else id = tview->id; + glActiveTexture(GL_TEXTURE0 + *sampler_id); glBindTexture(target, id); + if (ctx->sub->views[shader_type].old_ids[i] != id || ctx->sub->sampler_state_dirty) { vrend_apply_sampler_state(ctx, texture, shader_type, i, *sampler_id, tview); ctx->sub->views[shader_type].old_ids[i] = id;