doc.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. /*
  5. Package gl implements Go bindings for OpenGL ES 2.0 and ES 3.0.
  6. The GL functions are defined on a Context object that is responsible for
  7. tracking a GL context. Typically a windowing system package (such as
  8. golang.org/x/exp/shiny/screen) will call NewContext and provide
  9. a gl.Context for a user application.
  10. If the gl package is compiled on a platform capable of supporting ES 3.0,
  11. the gl.Context object also implements gl.Context3.
  12. The bindings are deliberately minimal, staying as close the C API as
  13. possible. The semantics of each function maps onto functions
  14. described in the Khronos documentation:
  15. https://www.khronos.org/opengles/sdk/docs/man/
  16. One notable departure from the C API is the introduction of types
  17. to represent common uses of GLint: Texture, Surface, Buffer, etc.
  18. */
  19. package gl // import "fyne.io/fyne/v2/internal/driver/mobile/gl"
  20. /*
  21. Implementation details.
  22. All GL function calls fill out a C.struct_fnargs and drop it on the work
  23. queue. The Start function drains the work queue and hands over a batch
  24. of calls to C.process which runs them. This allows multiple GL calls to
  25. be executed in a single cgo call.
  26. A GL call is marked as blocking if it returns a value, or if it takes a
  27. Go pointer. In this case the call will not return until C.process sends a
  28. value on the retvalue channel.
  29. This implementation ensures any goroutine can make GL calls, but it does
  30. not make the GL interface safe for simultaneous use by multiple goroutines.
  31. For the purpose of analyzing this code for race conditions, picture two
  32. separate goroutines: one blocked on gl.Start, and another making calls to
  33. the gl package exported functions.
  34. */