gpu/internal/opengl: use uniform blocks on macOS

The reflected uniform names are for the shader versions that don't use uniform
buffer objects. For UBO shaders, the names won't resolve.

This change adds a panic when shader uniforms are not found, and fixes

Fixes gio#216

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-04-17 11:02:19 +02:00
parent c19ce8e1d7
commit 9bf4e559bc
+5 -1
View File
@@ -145,10 +145,11 @@ func newOpenGLDevice(api driver.OpenGL) (driver.Device, error) {
}
gles30 := gles && ver[0] >= 3
gles31 := gles && (ver[0] > 3 || (ver[0] == 3 && ver[1] >= 1))
gl40 := !gles && ver[0] >= 4
b := &Backend{
glver: ver,
gles: gles,
ubo: gles30,
ubo: gles30 || gl40,
funcs: f,
floatTriple: floatTriple,
alphaTriple: alphaTripleFor(ver),
@@ -571,6 +572,9 @@ func (b *Backend) NewProgram(vertShader, fragShader driver.ShaderSources) (drive
func lookupUniform(funcs *gl.Functions, p gl.Program, loc driver.UniformLocation) uniformLocation {
u := funcs.GetUniformLocation(p, loc.Name)
if !u.Valid() {
panic(fmt.Errorf("uniform %q not found", loc.Name))
}
return uniformLocation{uniform: u, offset: loc.Offset, typ: loc.Type, size: loc.Size}
}