From 7d5021ca821940db4fdbe2be8105c24c66afc4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Sat, 23 May 2020 03:23:41 +0200 Subject: [PATCH] Set sampler uniform only once --- src/pipeline.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pipeline.rs b/src/pipeline.rs index d3c407f..2c73261 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -11,7 +11,6 @@ pub struct Pipeline { vertex_array: ::VertexArray, instances: ::Buffer, transform: ::UniformLocation, - sampler: ::UniformLocation, cache: Cache, current_instances: usize, supported_instances: usize, @@ -55,6 +54,8 @@ impl Pipeline { unsafe { gl.use_program(Some(program)); + gl.uniform_1_i32(Some(sampler), 0); + gl.uniform_matrix_4_f32_slice( Some(transform), false, @@ -70,7 +71,6 @@ impl Pipeline { vertex_array, instances, transform, - sampler, current_instances: 0, supported_instances: Instance::INITIAL_AMOUNT, current_transform: IDENTITY_MATRIX, @@ -112,7 +112,6 @@ impl Pipeline { gl.active_texture(glow::TEXTURE0); gl.bind_texture(glow::TEXTURE_2D, Some(self.cache.texture)); - gl.uniform_1_i32(Some(self.sampler), 0); gl.bind_vertex_array(Some(self.vertex_array));