gpu/internal/opengl: support sRGB emulation for desktop OpenGL

Desktop OpenGL implements a GL_FRAMEBUFFER_SRGB setting; query that instead
of the frambuffer color encoding.

With this change it is no longer necessary to enable FRAMEBUFFER_SRGB
in the macOS setup; remove it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-05-17 09:50:49 +02:00
parent b622412ac6
commit 03ee75fd72
6 changed files with 47 additions and 19 deletions
+10
View File
@@ -83,6 +83,7 @@ typedef struct {
void (*glGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
const GLubyte *(*glGetString)(GLenum name);
GLint (*glGetUniformLocation)(GLuint program, const GLchar *name);
GLboolean (*glIsEnabled)(GLenum cap);
void (*glLinkProgram)(GLuint program);
void (*glPixelStorei)(GLenum pname, GLint param);
void (*glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
@@ -319,6 +320,10 @@ static GLint glGetUniformLocation(glFunctions *f, GLuint program, const GLchar *
return f->glGetUniformLocation(program, name);
}
static GLboolean glIsEnabled(glFunctions *f, GLenum cap) {
return f->glIsEnabled(cap);
}
static void glLinkProgram(glFunctions *f, GLuint program) {
f->glLinkProgram(program);
}
@@ -588,6 +593,7 @@ func (f *Functions) load(forceES bool) error {
f.f.glGetShaderInfoLog = must("glGetShaderInfoLog")
f.f.glGetString = must("glGetString")
f.f.glGetUniformLocation = must("glGetUniformLocation")
f.f.glIsEnabled = must("glIsEnabled")
f.f.glLinkProgram = must("glLinkProgram")
f.f.glPixelStorei = must("glPixelStorei")
f.f.glReadPixels = must("glReadPixels")
@@ -980,6 +986,10 @@ func (f *Functions) InvalidateFramebuffer(target, attachment Enum) {
C.glInvalidateFramebuffer(&f.f, C.GLenum(target), C.GLenum(attachment))
}
func (f *Functions) IsEnabled(cap Enum) bool {
return C.glIsEnabled(&f.f, C.GLenum(cap)) == TRUE
}
func (f *Functions) LinkProgram(p Program) {
C.glLinkProgram(&f.f, C.GLuint(p.V))
}