~eliasnaur/gio

1

[ANN] New compute renderer merged, call for help

Details
Message ID
<C873ZYSHTBCF.1CC11YC5BFA01@themachine>
DKIM signature
pass
Download raw message
Hi,

The new compute branch has been merged into main, containing the first
release of the new 2D vector graphics renderer based in the excellent
piet-gpu[0] project.

The renderer is not yet the default, so if you're running a Linux or
Android device, you must force its use by setting an environment
variable:

$ go get gioui.org@29c95c659df7d934cca87c3bff4b073f22531d22
$ GIORENDERER=forcecompute go run gioui.org/example/kitchen

An error message about missing compute support means your GPU doesn't
support OpenGL 3.1, which is ok. See [2] for more caveats.

The interesting commits are [1] that imports the piet-gpu GPU
programs, and [2] that translates Gio operations to piet-gpu operations
and runs the compute programs on OpenGL ES.

I've upstreamed all my work on the compute shaders themselves, some
still pending review[3]. I intend to keep the GPU programs in sync with
piet-gpu, so Gio can benefit from fixes and new features from upstream,
and vice versa.

Roadmap

We now have two renderers, which means twice the maintenance burden,
so the most important next step is deleting the old renderer. Before
we can do that, several tasks remain (in no particular order):

- Stabilize and make the compute renderer default (where supported).
- Windows (Direct3D) and macOS/iOS (Metal) support.
- WebAssembly support (2D Canvas or WebGPU).
- CPU fallback.

Making the new renderer default is a question of wide testing so we can
be confident in switching over. I'd love for you to test your programs
and examples on your supported devices.

Also, gradients are currently rendered as a single color. Egon (CC'ed)
is there a chance you can take a look at an implementation? I suppose a
1D texture is the fastest way.

Further, if anyone would like to look into the Windows or Appled ports,
I'd be very grateful. The Windows port is probably easiest because Gio
the old renderer already uses Direct3D. Let's coordinate here or on Slack
so we don't waste resources.

WebAssembly is problematic because the only way to run compute shaders
in the browser is through WebGPU, which is not yet generally
available[4]. We could leave WebAssembly to use the CPU fallback, or
perhaps write a renderer using the 2D Canvas API[5].

I expect most work is in creating a CPU fallback, which entails
compiling the GPU programs to CPU assembly and execute them across
multiple CPU cores. Viktor (CC'ed), you did some initial work in that
direction, let me know whether you'd like to continue that work or
you want me to take over.

Happy New Year!
Elias

[0] https://github.com/linebender/piet-gpu
[1] https://gioui.org/commit/02185461610ec
[2] https://gioui.org/commit/d23514fd582516b
[3] https://github.com/linebender/piet-gpu/pull/61
[4] https://caniuse.com/webgpu
[5] https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
Details
Message ID
<da1ca2c49aacc9b0d0f6c05cf7b4c787@evereska.org>
In-Reply-To
<C873ZYSHTBCF.1CC11YC5BFA01@themachine> (view parent)
DKIM signature
pass
Download raw message
I tried to go get the good version, got:

go1.15.6 get gioui.org@29c95c659df7d934cca87c3bff4b073f22531d22
go get gioui.org@29c95c659df7d934cca87c3bff4b073f22531d22: gioui.org@29c95c659df7d934cca87c3bff4b073f22531d22: invalid version: unknown revision 29c95c659df7d934cca87c3bff4b073f22531d22

Same result with go1.16beta1.

Tanguy ⧓

December 31, 2020 5:33 PM, "Elias Naur" <mail@eliasnaur.com> wrote:

> Hi,
> 
> The new compute branch has been merged into main, containing the first
> release of the new 2D vector graphics renderer based in the excellent
> piet-gpu[0] project.
> 
> The renderer is not yet the default, so if you're running a Linux or
> Android device, you must force its use by setting an environment
> variable:
> 
> $ go get gioui.org@29c95c659df7d934cca87c3bff4b073f22531d22
> $ GIORENDERER=forcecompute go run gioui.org/example/kitchen
> 
> An error message about missing compute support means your GPU doesn't
> support OpenGL 3.1, which is ok. See [2] for more caveats.
> 
> The interesting commits are [1] that imports the piet-gpu GPU
> programs, and [2] that translates Gio operations to piet-gpu operations
> and runs the compute programs on OpenGL ES.
> 
> I've upstreamed all my work on the compute shaders themselves, some
> still pending review[3]. I intend to keep the GPU programs in sync with
> piet-gpu, so Gio can benefit from fixes and new features from upstream,
> and vice versa.
> 
> Roadmap
> 
> We now have two renderers, which means twice the maintenance burden,
> so the most important next step is deleting the old renderer. Before
> we can do that, several tasks remain (in no particular order):
> 
> - Stabilize and make the compute renderer default (where supported).
> - Windows (Direct3D) and macOS/iOS (Metal) support.
> - WebAssembly support (2D Canvas or WebGPU).
> - CPU fallback.
> 
> Making the new renderer default is a question of wide testing so we can
> be confident in switching over. I'd love for you to test your programs
> and examples on your supported devices.
> 
> Also, gradients are currently rendered as a single color. Egon (CC'ed)
> is there a chance you can take a look at an implementation? I suppose a
> 1D texture is the fastest way.
> 
> Further, if anyone would like to look into the Windows or Appled ports,
> I'd be very grateful. The Windows port is probably easiest because Gio
> the old renderer already uses Direct3D. Let's coordinate here or on Slack
> so we don't waste resources.
> 
> WebAssembly is problematic because the only way to run compute shaders
> in the browser is through WebGPU, which is not yet generally
> available[4]. We could leave WebAssembly to use the CPU fallback, or
> perhaps write a renderer using the 2D Canvas API[5].
> 
> I expect most work is in creating a CPU fallback, which entails
> compiling the GPU programs to CPU assembly and execute them across
> multiple CPU cores. Viktor (CC'ed), you did some initial work in that
> direction, let me know whether you'd like to continue that work or
> you want me to take over.
> 
> Happy New Year!
> Elias
> 
> [0] https://github.com/linebender/piet-gpu
> [1] https://gioui.org/commit/02185461610ec
> [2] https://gioui.org/commit/d23514fd582516b
> [3] https://github.com/linebender/piet-gpu/pull/61
> [4] https://caniuse.com/webgpu
> [5] https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
Reply to thread Export thread (mbox)