Merge branch 'master' into shader-decomp

This commit is contained in:
wheremyfoodat 2024-08-19 22:19:13 +03:00
commit 1366e7a76e
19 changed files with 305 additions and 18 deletions

View file

@ -432,6 +432,25 @@ namespace OpenGL {
return m_handle != 0;
}
bool createFromBinary(const uint8_t* binary, size_t size, GLenum format) {
m_handle = glCreateProgram();
glProgramBinary(m_handle, format, binary, size);
GLint success;
glGetProgramiv(m_handle, GL_LINK_STATUS, &success);
if (!success) {
char buf[4096];
glGetProgramInfoLog(m_handle, 4096, nullptr, buf);
fprintf(stderr, "Failed to link program\nError: %s\n", buf);
glDeleteProgram(m_handle);
m_handle = 0;
}
return m_handle != 0;
}
GLuint handle() const { return m_handle; }
bool exists() const { return m_handle != 0; }
void use() const { glUseProgram(m_handle); }