mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
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:
@@ -145,10 +145,11 @@ func newOpenGLDevice(api driver.OpenGL) (driver.Device, error) {
|
|||||||
}
|
}
|
||||||
gles30 := gles && ver[0] >= 3
|
gles30 := gles && ver[0] >= 3
|
||||||
gles31 := gles && (ver[0] > 3 || (ver[0] == 3 && ver[1] >= 1))
|
gles31 := gles && (ver[0] > 3 || (ver[0] == 3 && ver[1] >= 1))
|
||||||
|
gl40 := !gles && ver[0] >= 4
|
||||||
b := &Backend{
|
b := &Backend{
|
||||||
glver: ver,
|
glver: ver,
|
||||||
gles: gles,
|
gles: gles,
|
||||||
ubo: gles30,
|
ubo: gles30 || gl40,
|
||||||
funcs: f,
|
funcs: f,
|
||||||
floatTriple: floatTriple,
|
floatTriple: floatTriple,
|
||||||
alphaTriple: alphaTripleFor(ver),
|
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 {
|
func lookupUniform(funcs *gl.Functions, p gl.Program, loc driver.UniformLocation) uniformLocation {
|
||||||
u := funcs.GetUniformLocation(p, loc.Name)
|
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}
|
return uniformLocation{uniform: u, offset: loc.Offset, typ: loc.Type, size: loc.Size}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user