renderer: don't call glActiveTexture unless we're going to do something

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 <erik.faye-lund@collabora.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
macos/master
Erik Faye-Lund 6 years ago
parent 20cba1d469
commit e54daddc47
  1. 3
      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); tview->gl_swizzle_a == GL_ONE ? 1.0 : 0.0);
} }
glActiveTexture(GL_TEXTURE0 + *sampler_id);
if (tview->texture) { if (tview->texture) {
GLuint id; GLuint id;
struct vrend_resource *texture = tview->texture; struct vrend_resource *texture = tview->texture;
@ -3654,7 +3653,9 @@ static void vrend_draw_bind_samplers_shader(struct vrend_context *ctx,
} else } else
id = tview->id; id = tview->id;
glActiveTexture(GL_TEXTURE0 + *sampler_id);
glBindTexture(target, id); glBindTexture(target, id);
if (ctx->sub->views[shader_type].old_ids[i] != id || ctx->sub->sampler_state_dirty) { 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); vrend_apply_sampler_state(ctx, texture, shader_type, i, *sampler_id, tview);
ctx->sub->views[shader_type].old_ids[i] = id; ctx->sub->views[shader_type].old_ids[i] = id;

Loading…
Cancel
Save