diff --git a/include/renderer_gl/renderer_gl.hpp b/include/renderer_gl/renderer_gl.hpp index 85dfe683..fbda4175 100644 --- a/include/renderer_gl/renderer_gl.hpp +++ b/include/renderer_gl/renderer_gl.hpp @@ -26,7 +26,6 @@ class GPU; // Cached recompiled fragment shader struct CachedProgram { OpenGL::Program program {}; - GLuint uboBinding = 0; bool ready = false; }; diff --git a/src/core/renderer_gl/renderer_gl.cpp b/src/core/renderer_gl/renderer_gl.cpp index be18b278..28987e8f 100644 --- a/src/core/renderer_gl/renderer_gl.cpp +++ b/src/core/renderer_gl/renderer_gl.cpp @@ -23,11 +23,11 @@ using namespace Helpers; using namespace PICA; namespace { - constexpr uint uboBlockBinding = 2; + static constexpr uint uboBlockBinding = 2; void initializeProgramEntry(GLStateManager& gl, CachedProgram& programEntry) { OpenGL::Program& program = programEntry.program; - program.use(); + gl.useProgram(program); // Init sampler objects. Texture 0 goes in texture unit 0, texture 1 in TU 1, texture 2 in TU 2, and the light maps go in TU 3 glUniform1i(OpenGL::uniformLocation(program, "u_tex0"), 0); @@ -35,11 +35,6 @@ namespace { glUniform1i(OpenGL::uniformLocation(program, "u_tex2"), 2); glUniform1i(OpenGL::uniformLocation(program, "u_tex_luts"), 3); - // Allocate memory for the program UBO - glGenBuffers(1, &programEntry.uboBinding); - gl.bindUBO(programEntry.uboBinding); - glBufferData(GL_UNIFORM_BUFFER, sizeof(PICA::FragmentUniforms), nullptr, GL_DYNAMIC_DRAW); - // Set up the binding for our UBO. Sadly we can't specify it in the shader like normal people, // As it's an OpenGL 4.2 feature that MacOS doesn't support... uint uboIndex = glGetUniformBlockIndex(program.handle(), "FragmentUniforms");