gl.go 687 B

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