forked from fyne-io/fyne
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gl.go
34 lines (27 loc) · 699 Bytes
/
gl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//go:generate go run ../../../cmd/fyne bundle -o shaders.go --prefix shader --package gl shaders/
package gl
import (
"log"
"runtime"
"github.com/gorustyt/fyne/v2"
)
const floatSize = 4
const max16bit = float32(255 * 255)
// logGLError logs error in the GL renderer.
//
// Receives a function as parameter, to lazily get the error code only when
// needed, avoiding unneeded overhead.
func logGLError(getError func() uint32) {
if fyne.CurrentApp().Settings().BuildType() != fyne.BuildDebug {
return
}
err := getError()
if err == 0 {
return
}
log.Printf("Error %x in GL Renderer", err)
_, file, line, ok := runtime.Caller(2)
if ok {
log.Printf(" At: %s:%d", file, line)
}
}