From 100404c917409f2e1c8a4aea2f768654f8026e8c Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 26 Nov 2016 00:36:59 -0400 Subject: [PATCH] Revert a dumb change that caused a crash due to reading from invalid memory --HG-- branch : minor --- src/modules/graphics/opengl/Shader.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/modules/graphics/opengl/Shader.cpp b/src/modules/graphics/opengl/Shader.cpp index 362b50668..0eb8ce9ae 100644 --- a/src/modules/graphics/opengl/Shader.cpp +++ b/src/modules/graphics/opengl/Shader.cpp @@ -237,15 +237,6 @@ void Shader::mapActiveUniforms() if (u.location == -1) continue; - if (u.baseType == UNIFORM_SAMPLER) - { - // Initialize all samplers to 0. Both GLSL and GLSL ES are supposed - // to do this themselves, but some Android devices (galaxy tab 3 and - // 4) don't seem to do it... - // NOTE: We also restore previously set texture units below. - glUniform1iv(u.location, u.count, u.ints); - } - // Make sure previously set uniform data is preserved, and shader- // initialized values are retrieved. auto oldu = olduniforms.find(u.name); @@ -303,6 +294,11 @@ void Shader::mapActiveUniforms() if (u.baseType == UNIFORM_SAMPLER) { + // Initialize all samplers to 0. Both GLSL and GLSL ES are + // supposed to do this themselves, but some Android devices + // (galaxy tab 3 and 4) don't seem to do it... + glUniform1iv(u.location, u.count, u.ints); + u.textures = new Texture*[u.count]; memset(u.textures, 0, sizeof(Texture *) * u.count); }