1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 01:32:55 +00:00

Make use of bound_shader.

This commit is contained in:
Thomas Harte 2024-01-19 22:34:42 -05:00
parent b08c7f8b68
commit 8eb38ac437
2 changed files with 7 additions and 8 deletions

View File

@ -53,7 +53,7 @@
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "&quot;/Users/thomasharte/Desktop/Soft/Master System/R-Type (NTSC).sms&quot;"
argument = "&quot;/Users/thomasharte/Library/Mobile Documents/com~apple~CloudDocs/Soft/Master System/R-Type (NTSC).sms&quot;"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument

View File

@ -14,8 +14,7 @@
using namespace Outputs::Display::OpenGL;
namespace {
// The below is disabled because it isn't context-specific. Work to do.
thread_local Shader *bound_shader = nullptr;
thread_local const Shader *bound_shader = nullptr;
Log::Logger<Log::Source::OpenGL> logger;
}
@ -107,20 +106,20 @@ void Shader::init(const std::string &vertex_shader, const std::string &fragment_
}
Shader::~Shader() {
// if(bound_shader == this) Shader::unbind();
if(bound_shader == this) Shader::unbind();
glDeleteProgram(shader_program_);
}
void Shader::bind() const {
// if(bound_shader != this) {
if(bound_shader != this) {
test_gl(glUseProgram, shader_program_);
// bound_shader = this;
// }
bound_shader = this;
}
flush_functions();
}
void Shader::unbind() {
// bound_shader = nullptr;
bound_shader = nullptr;
test_gl(glUseProgram, 0);
}