The os and gl packages were separate in the past, which required
uintptr for cross-package CFTypeRefs. That's no longer needed.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Now that syscall/js.TypedArrayOf is going away in Go 1.13 (sse
https://golang.org/issue/31980), copying byte slices to JS before
use is necessary. To avoid garbage, re-use a single buffer for all
transfers.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
syscall/js.TypedArrayOf is going away in Go 1.13. Avoid it for
invalidateFramebuffer by using a buffer managed by JS.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
The frame callback for macOS comes in from a different thread than
the UI thread. Serialize event handling to maintain the invariant
that only one event is processed at a time.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With layout.Widget a function instead of an interface, the amount
of per-frame garbage can be drastically reduced.
The layout code ends up slightly more explicit.
As a side benefit, the awkward ordering indexing for Flex and Stack
fit nicely into their new explicit Layout methods.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
GL_EXT_disjoint_timer_query_webgl2 is the WebGL 2 counterpart to
the WebGL 1 GL_EXT_disjoint_timer_query extension.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Some devices don't support floating point FBOs even though they
support OpenGL ES 3. Check support by creating a FBO and fail early
if no support is found.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
I found a convincing use case: stopping asynchronous activities
while paused. A follow up change will rename the stages and add
an example.
This reverts commit f9840b0963.
I'm not convinced the API is right. For exmaple, an event that
notifies a program when to save its state is both smaller and
might be sufficient.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
It doesn't seem worth the trouble: images must be scanned for
alpha != 1 and GPUs don't like RGB formats. Use RGBA always.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
WebGL use opaque values for object handles, not integers. To ensure
portability, wrap handle types with a struct.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Pros:
- Much less per-frame garbage
- Allow future preprocessing of ops while building it
- Much fewer interface calls and pointer chasing
- Allow future serialization of ops for remote rendering
Cons:
- Slightly clumsier API
Signed-off-by: Elias Naur <mail@eliasnaur.com>
Serialize the implied tree of layers and handlers into a list
that can be traversed from the end to collect handlers.
This change will make it easier to switch op representation in
a follow-up change.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
With an interface instead of anonymous functions, amending an
area's parameters can be done even after adding it to an OpHandler.
This will be useful when we switch to serialized op lists.
Signed-off-by: Elias Naur <mail@eliasnaur.com>
For some reason, the CADisplayLink.paused property didn't work on
iOS 10 but does on iOS 12. Use addToRunLoop and removeFromRunLoop
instead.
Signed-off-by: Elias Naur <mail@eliasnaur.com>