Commit Graph

35 Commits

Author SHA1 Message Date
Elias Naur 5f2adf9b2f ui: get rid of Inf
It's not worth the special cases. Use a large value where needed
(layout.List, text.Editor...) instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 12:12:51 +02:00
Elias Naur 5e1f078b12 ui: merge Transform into TransformOp
The separate Transform type is not worth its weight.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 02:50:55 -07:00
Elias Naur d178167c3b ui/app/internal/gpu: add workaround for render corruption
Fixes gio#13

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-29 02:50:50 -07:00
Elias Naur c1128e7f8a ui/app/internal/gpu: only apply clear optimization for rect clips
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-24 20:16:38 -07:00
Elias Naur 84fb7279eb ui/draw: rename ImageOp.Img to Src
To match widget.Image.Src field name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-18 15:58:11 +02:00
Elias Naur 3a6fda129a ui: shorten OpReader.Decode for loops
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-12 11:44:50 +02:00
Elias Naur 38ec6a8831 ui/draw: rename ColorOp.Col to Color 2019-07-05 17:14:57 +02:00
Elias Naur 33fc35f58d ui/draw: switch to color.RGBA for colors
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-07-02 14:56:48 +02:00
Elias Naur 7aa7bb3be4 ui: rename ops to have Op suffixed, not prefixed
Match Go's FooError name pattern.

While we're here, rename RedrawOp to InvalidateOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-21 17:01:45 +02:00
Elias Naur 1f809234b8 ui/app/internal/gpu: replace look up texture with calculation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-10 01:18:23 +02:00
Elias Naur eddc0c948e ui/app/internal/gpu: fix stenciling on the iOS simulator
It seems that the iOS simulator can return NaN from texture2D, so
even though width == 0, the resulting cover is not.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-09 22:21:25 +02:00
Elias Naur bd005a09e3 ui/app/internal/gpu: upload path data to GPU before re-use
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-08 18:30:04 +02:00
Elias Naur 659a85aae0 ui/app/internal/gpu: add specialized path cache to avoid key allocations
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 22:45:44 +02:00
Elias Naur 1e38eec0ab ui: build paths as ops
Instead of allocating and constructing a clip path, store path data
directly in op lists. Use separate op lists for cached text layout
paths.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 22:18:04 +02:00
Elias Naur 0d2cffe196 ui: let OpsReader keep track of references
Instead of exposing the entire reference slice, return the relevant
references from Next.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 5966aab77e ui: move ops reader to ui package
To prepare support for cached OpBlock to refer to other Ops lists.

The exposure of OpsReader is alleviated by the removal of the Refs
and Data accessors for Ops.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-02 19:17:53 +02:00
Elias Naur 7ae8fdaae7 ui/app/internal/gpu: track image and color in a state stack
Just like the other drawing state, the current image or color must
be tracked in a stack.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 18:43:51 +02:00
Elias Naur 00a87f542d ui: introduce OpColor, a specialized OpImage for uniform colors
To avoid allocating an image.Image for OpImage.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 13:01:51 +02:00
Elias Naur 0061c73a89 ui: split OpImage into OpImage and OpDraw
In preparation for an OpColor (and future OpGradient and similar).

Label and Editor no longer take an explicit source image. They
draw with the current image.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-06-01 12:44:49 +02:00
Elias Naur a1c0693eeb ui/app: add Lock/Unlock to Context for macOS
Without locking, asynchronous OpenGL rendering crashes on macOS.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-24 14:01:26 +02:00
Elias Naur 642318842c ui/app/internal/gpu: add pathOp cache
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-16 21:16:36 +02:00
Elias Naur 32c525f7fd ui/app/internal/gpu: check for GL_EXT_disjoint_timer_query_webgl2
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>
2019-05-13 19:50:26 +02:00
Elias Naur 18c74f00af ui/app/internal/gpu: check floating point FBO support
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>
2019-05-13 12:44:47 +02:00
Elias Naur 530b9b09b2 ui/app/internal/gpu: drop useless timing
It is almost always 0.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-12 18:00:25 +02:00
Elias Naur f1c87417bd ui/app: split extension string before matching
Avoids false matches for extensions whose names are substrings of
other extensions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-11 13:17:57 +02:00
Elias Naur 51482b6493 ui/app/internal/gpu: move sRGBA feature detection to context
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-10 17:50:06 +02:00
Elias Naur fd9eb029c8 ui/app/internal/gpu: drop opaque texture optimization
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>
2019-05-08 17:57:10 +02:00
Elias Naur 871ae34be5 ui/app/internal/gl: move single channel format detection to context
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur f5fa968038 ui/app/internal/gpu: implement OpenGL ES 2 float fbo fallbacks
Also applicable to WebGL.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur d118bd5a88 ui/app/internal/gpu: introduce caps and context
Enables graceful fallback to OpenGL ES 2 and WebGL.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-05-08 17:57:10 +02:00
Elias Naur 8df5feeeea ui/app: make opengl objects structs
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>
2019-05-08 17:57:10 +02:00
Elias Naur 252e058766 all: serialize ops
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>
2019-04-27 22:19:34 +02:00
Elias Naur e0d586893d ui/app/internal/gpu: flush before drawing
And delete an unnecessary error check from Flush to make sure pending
draws are always finalized.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-25 10:01:58 +02:00
Elias Naur 48b6a73753 all: run goimports
gioui.org/ui was renamed from gioui.org/ui/ui before the release,
but the import order wasn't changed accordingly.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-04-02 17:09:06 +02:00
Elias Naur 0f05231c35 all: initial import
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-03-31 10:47:22 +02:00