Recent activity

Re: op/clip - stroke path 3 months ago

From Viktor Ogeman to ~eliasnaur/gio

> (support for dash-lines probably means dealing with the rasterizer... not somewhere I want to put my keyboard at this point in time...)

long term yes, not not needed short-term if you do need high fps, you
could simply create an external package
that takes a dashed line specification and turns it into a long series
of filled shape draws.. Ugly but could work
as a stop-gap until we have proper support in the renderer.


[PATCH] gpu: fix negative intersections 3 months ago

From Viktor Ogeman to ~eliasnaur/gio-patches

Fixes a bug due to that f32.Rect.Intersect will not return the
empty rectangle for non intersecting rectangles - but instead
a swapped rectangle. By removing the .Canon() call in gpu.go we
ensure that non overlapping clipping rects and paint rects will
lead to no painting.

The Canon() call is not needed since boundsForTransformedRect()
was previously updated to always return a canonical rectangle.

Test case added.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 gpu/gpu.go                                        |   2 +-
[message trimmed]

Affine transformations merged 4 months ago

From Viktor Ogeman to ~eliasnaur/gio

Good afternoon,

Just wanted to give a short update and let you know that support for
affine transformations have just now been merged. This should allow
you both to transform entire UIs (as in the updated kitchen example),
or use transforms when drawing individual objects.

It *should* be backwards compatible, and allow you to access the new
functionality through a call to op.Affine(yourTransform).Add(ops). In
general expect about 15% increased CPU time in your old drawing operations,
if you see much larger degradations please let me know.

As before, simply using op.Offset (or op.Affine with an offset-only
transform) will use cached results and thus give good performance.

[PATCH v2 15/15] gpu: build gpu data also when outside window 4 months ago

From Viktor to ~eliasnaur/gio-patches

This commit fixes a bug where a shape first drawn off-screen
and later moved into screen would not display properly. Since we
cache CPU operations (vertex transform / construction) we need to
upload the constructed data to the GPU after it was build, or a later
frame will use non-initialized memory for it's draw call.

Note that this fix removes the optimization of not processing clip
paths outside the screen - but this is assumed to be uncommon except
when it is first drawn off screen to later be moved in (e.g. in a scrolling list)
in which case we do want to upload the data and prepare for that later

This commit also does a few minor clean ups and adds a test case.
[message trimmed]

[PATCH v2 14/15] gpu: avoid pointers of pathData 4 months ago

From Viktor to ~eliasnaur/gio-patches

Save allocations by using pathData instead of *pathData.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 gpu/caches.go |  6 +++---
 gpu/gpu.go    |  2 +-
 gpu/path.go   | 10 +++++-----
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gpu/caches.go b/gpu/caches.go
index 4ed461b..7a383c2 100644
--- a/gpu/caches.go
+++ b/gpu/caches.go
@@ -26,7 +26,7 @@ type opCache struct {
[message trimmed]

[PATCH v2 13/15] internal/f32color: use explicit type to avoid allocation 4 months ago

From Viktor to ~eliasnaur/gio-patches

f32color.RGBAFromSRGB is used extensively in package gpu, avoid an
interface type to save allocations.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 internal/f32color/rgba.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/internal/f32color/rgba.go b/internal/f32color/rgba.go
index 03377ac..efaa1fb 100644
--- a/internal/f32color/rgba.go
+++ b/internal/f32color/rgba.go
@@ -38,8 +38,8 @@ func (col RGBA) Opaque() RGBA {
	return col
[message trimmed]

[PATCH v2 12/15] gpu: cache transformed bounds 4 months ago

From Viktor to ~eliasnaur/gio-patches

To avoid duplicate work when using macros and non-offset transforms,
cache also the new bounding boxes set up for them. The ops.Reader
already generates Keys for all operations, so use them in the cache.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 gpu/gpu.go             | 24 +++++++++---------------
 internal/ops/reader.go |  4 ----
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/gpu/gpu.go b/gpu/gpu.go
index 6a6abe4..cd87f2a 100644
--- a/gpu/gpu.go
+++ b/gpu/gpu.go
[message trimmed]

[PATCH v2 11/15] gpu: optimize opCache to avoid expensive map lookups 4 months ago

From Viktor to ~eliasnaur/gio-patches

Benchmarking showed that the double map access calls
were a bottleneck. Rework the cache to avoid half of them.

The simplest, naive approach would have been to store a
pointer to a struct with a keep field in the map, allowing cheap
update and frame() operation. Benchmarking showed that the
increased GC pressure of that approach decreased performance

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 gpu/caches.go | 75 +++++++++++++++++++++++++++++++++++----------------
 1 file changed, 52 insertions(+), 23 deletions(-)
[message trimmed]

[PATCH v2 09/15] gpu: reintroduce reuse of offset-only stenciling 4 months ago

From Viktor to ~eliasnaur/gio-patches

Reintroduce support for offset in stencil vertex so we can reuse
cached values if the only difference in transform is offset. Split
current transform into a pure-offset part and the rest and use
only the complex part as cache key.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 gpu/gpu.go               | 43 +++++++++++++++++++++++++++-------------
 gpu/path.go              | 11 ++++++----
 gpu/shaders.go           | 27 +++++++++++++------------
 gpu/shaders/stencil.vert |  9 +++++----
 4 files changed, 55 insertions(+), 35 deletions(-)

diff --git a/gpu/gpu.go b/gpu/gpu.go
[message trimmed]

[PATCH v2 10/15] gpu: exploit pathCache in collectOps 4 months ago

From Viktor to ~eliasnaur/gio-patches

Previously the cache was only filled during gpu-buffer creation,
resulting in extra work on the CPU to transform vertices if the same
shape was used multiple times in the same frame. Cases such as font
rendering was cached already before this change as it is drawn in it's
own op.Ops that is never reset - and thus re-used from one frame
to the next.

Since we are now calling put() twice per frame an update should no
longer panic.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
 gpu/caches.go | 3 ---
 gpu/gpu.go    | 7 +++++--
[message trimmed]