Whoopsie of major proportions

This commit is contained in:
offtkp 2024-07-31 05:01:38 +03:00
parent fa0df3a1e3
commit 95c5945289
2 changed files with 2 additions and 8 deletions

View file

@ -26,7 +26,6 @@ class GPU;
// Cached recompiled fragment shader
struct CachedProgram {
OpenGL::Program program {};
GLuint uboBinding = 0;
bool ready = false;
};

View file

@ -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");