From fc9e84c72ec0dc9e021b8e9f89da12526b31ef27 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 18 Feb 2018 22:09:27 -0500 Subject: [PATCH] Eliminates unsafe optimisation. Also likely to be unhelpful as and when multiple machines are in play. --- Outputs/CRT/Internals/Shaders/Shader.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Outputs/CRT/Internals/Shaders/Shader.cpp b/Outputs/CRT/Internals/Shaders/Shader.cpp index 482107576..72fa3b086 100644 --- a/Outputs/CRT/Internals/Shaders/Shader.cpp +++ b/Outputs/CRT/Internals/Shaders/Shader.cpp @@ -14,7 +14,9 @@ using namespace OpenGL; namespace { - Shader *bound_shader = nullptr; + // The below is disabled because it isn't context/thread-specific. Which makes it + // fairly 'unuseful'. +// Shader *bound_shader = nullptr; } GLuint Shader::compile_shader(const std::string &source, GLenum type) { @@ -75,20 +77,20 @@ Shader::Shader(const std::string &vertex_shader, const std::string &fragment_sha } Shader::~Shader() { - if(bound_shader == this) Shader::unbind(); +// if(bound_shader == this) Shader::unbind(); glDeleteProgram(shader_program_); } void Shader::bind() { - if(bound_shader != this) { +// if(bound_shader != this) { glUseProgram(shader_program_); - bound_shader = this; - } +// bound_shader = this; +// } flush_functions(); } void Shader::unbind() { - bound_shader = nullptr; +// bound_shader = nullptr; glUseProgram(0); }