Commit Graph

1952 Commits

Author SHA1 Message Date
Elias Naur d43f513e63 internal/scene: add Command.String
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-27 16:49:06 +02:00
Elias Naur 3322e211c9 f32: handle empty rectangles in Union and Intersect
The old renderer depends on the old behaviour of Union, so change that
reference to a copy.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-27 16:49:06 +02:00
Inkeliz d51d8b46c3 app, app/internal: [wasm,android] new Option to set Orientation
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-04-25 21:32:54 +02:00
Elias Naur a06a7a4b3c app: make Fullscreen, Windowed Options
Instead of

app.WindowMode(app.Fullscreen)

programs can now just use

app.Fullscreen

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-23 10:25:24 +02:00
Inkeliz 9dae29844c app, app/internal: [wasm,android] new Option to change navigation/status color
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-04-22 12:15:26 +02:00
Elias Naur 2296c80d28 internal/f32color: delete unused NRGBAToRGBA_PostAlpha
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-21 17:17:39 +02:00
pierre 354f5b43d2 app: added missing handling of Options.Size for X11
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-04-20 12:15:55 +02:00
Elias Naur 22f16d7b02 gpu/shaders: use mediump precision for kernel4 colors, areas
Improves performance on Pixel 1.

Add restrict qualifiers while we're here.

Also sync with piet-gpu.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-20 10:39:10 +02:00
Elias Naur ff7d224a0b gpu/shaders: use mediump precision for sRGB copy shader
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-20 10:39:10 +02:00
Elias Naur ee519351f7 gpu/shaders: ensure dynamically uniform barriers when malloc fails
GPU APIs require that barrier() calls are dynamically uniform, that is
for every barrier in the code, every shader invocation in a workgroup
must all call it, or all not call it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-18 17:20:19 +02:00
Elias Naur f930e3f3d7 internal/gl: implement glGetProgramBinary
Useful for debugging shader compiler issues, such as those that may
cause

https://github.com/linebender/piet-gpu/issues/83

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-18 17:20:19 +02:00
Elias Naur 3b69b5ed05 gpu/internal/opengl: fix package name
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-18 17:16:03 +02:00
Elias Naur 9bf4e559bc gpu/internal/opengl: use uniform blocks on macOS
The reflected uniform names are for the shader versions that don't use uniform
buffer objects. For UBO shaders, the names won't resolve.

This change adds a panic when shader uniforms are not found, and fixes

Fixes gio#216

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-17 11:10:33 +02:00
Elias Naur c19ce8e1d7 gpu/internal/convertshaders: don't require GL_ARB_shading_language_420pack
It's not supported on macOS.

Updates gio#216

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-17 11:10:20 +02:00
Dan Kortschak 0a91858163 layout: fix spelling of Alignment
Signed-off-by: Dan Kortschak <dan@kortschak.io>
2021-04-16 11:07:21 +02:00
Elias Naur 3a94f7bf70 gpu/shaders: update piet-gpu
Changes:

- fix BeginClip bounding box
- replace continue not supported by HLSL

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 13:56:41 +02:00
Elias Naur e9a020f774 gpu/internal/convertshaders: build compute shaders in HLSL cs_5_0 profile
The recent changes to the compute shaders have fixed all errors
previously reported by fxc. Switch from dxc to fxc to target shader
model 5.0, supported by Direct3D 11.

Because we know dxc must be available, always build compute shaders even
though the result is not yet used.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 12:49:49 +02:00
Elias Naur e3bb153274 gpu/internal/convertshaders: don't wait for winepath to exit
Apparently, exec.Command.Output waits for winepath's grandchildren to
exit. However, that may take several seconds if wineserver was started
by winepath.

exec.Command.StdoutPipe works better, in that it is closed when the
winepath process exits.

A similar change may help run the fxc.exe tool under Wine, if that ever
turns out to have the same problem.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 12:44:06 +02:00
Elias Naur 8adcf25049 gpu/internal/convertshaders: batch calls to winepath
Wine tools can be slow to run, so it makes sense to batch their use.
Fortunately, winepath supports resolving multiple paths in one
execution.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 12:44:06 +02:00
Elias Naur 3b3d41a7ea gpu/internal/convertshaders: don't use Wine for the dxc tool
dxc exists for Linux, and seems to work.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 12:44:06 +02:00
Elias Naur 23e0c898ef gpu/internal/driver: use strings for generated DXIL assembly
Literal strings are a more compact than literal byte slices. A future
change will switch to go:embed to save even more space.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 12:44:06 +02:00
Elias Naur fbee13a07d gpu/internal/convertshaders,gpu: represent converted shaders with raw literals
Raw strings with linebreaks are easier to read and produce smaller
diffs.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-12 12:43:46 +02:00
aarzilli 495c690187 app: prevent default Windows event handler from running for WM_SYSKEYUP/DOWN
F10 has a special meaning on Windows, if the default handler runs the
first key press following F10 will not generate a key.Press event and
if the first key press after F10 is space the window menu will be
opened instead.

Fixes #213

Signed-off-by: aarzilli <alessandro.arzilli@gmail.com>
2021-04-10 11:40:05 +02:00
pierre abd6e8f9cd app: support changing Window options at runtime
A Window can now be requested to change its options after
it has been started via its Option method.

All options are supported on macOS, Windows and X11.
On Wayland, only the Size and Title options can be changed
at runtime.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-04-07 09:23:25 +02:00
Inkeliz 96840772c7 app/internal/wm: [js] avoid duplicated-paste
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-04-06 09:21:07 +02:00
pierre ce7f0da06e app/internal/wm: use Option method to initialize windows
Added (*w.window).Option methods to the backends and use them for setting the initial options passed into NewWindow.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-04-02 21:15:42 +02:00
pierre b77c1628f3 app/internal/wm: [macOS] run closure on main thread earlier if possible
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-04-02 18:33:12 +02:00
Elias Naur 662cd2e97a app/internal/log: [Android] don't truncate log lines
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-02 16:13:35 +02:00
pierre 6330caad95 app/internal/wm: change Options fields from values to pointers
Switching to pointer values in Options, including using window manager defaults for size and title, in preparation for updating options on the fly.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-04-02 13:52:52 +02:00
Elias Naur 9d7b57f74a app/internal/wm: delete unused parameter
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-01 16:50:02 +02:00
Elias Naur ebf2dcea50 gpu/shaders: update piet-gpu
Changes:
- faster implementation of RGBA output
- fix stroked clips and images

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-31 19:56:50 +02:00
pierre 5e1a662b94 io/pointer: support nested scrollables
Fixes #185.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-03-31 09:57:13 +02:00
Elias Naur f3d75f38a9 app/internal/wm: [macOS/iOS] don't release nil strings in nsstringToString
Fixes gio#210

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-29 09:20:24 +02:00
Elias Naur 217f3f4de6 cmd/gogio: dump child program outputs to test log
Without logging, a failing child result in nondescript errors such as

windows_test.go:126: exit status 2

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-28 16:18:47 +02:00
Elias Naur e49afe7fa1 .builds: silence apt-get, curl commands
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-28 15:45:13 +02:00
Elias Naur c2e0910c8b .builds: don't pass -v to go test
Some tests are so verbose they hide the relevant error messages.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-28 14:17:04 +02:00
Elias Naur 17ba8e28af io/router: drop the correct handlers when a pointer grab is requested
Fixes gio#208

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-27 13:18:30 +01:00
Inkeliz 07802569f7 app: [js] move redraw out of js.FuncOf
Currently, the redraw is called inside js.FuncOf. That PR moves the
redraw to the main function, using channels inside the FuncOf, instead.

The current method (of calling inside the FuncOf) seems to be responsable
to generate `deadlock` errors. It happens even when the wrapped in
goroutines.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-03-26 15:48:15 +01:00
Inkeliz 416094a82c app: [js] support for fullscreen mode
Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-03-26 08:15:42 +01:00
pierre 3e525a0393 io/router: move static conditions out of the loop
Signed-off-by: pierre <pierre.curto@gmail.com>
2021-03-25 11:11:30 +01:00
pierre b796dd8e3b layout: make list example use List.Position.Count
Counting the number of displayed elements via the ListElement function is incorrect.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-03-25 11:11:25 +01:00
Inkeliz b7dc407dbe cmd/gogio: [android] add support for AAB
That patch makes possible to generate Android App Bundle (`.aab`) instead
of APK. In order to generate AAB use `-o outputfile.aab`.

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
2021-03-25 08:19:41 +01:00
pierre 238dd1aa86 app: added support for fullscreen mode
The option field WindowMode allows changing the window mode of an application in either Windowed or Fullscreen.
Only macOS, Windows and X11 platforms are currently supported.

Updates gio#89.

Signed-off-by: pierre <pierre.curto@gmail.com>
2021-03-23 23:26:46 +01:00
Elias Naur bc2c3db43e op/clip,gpu: move approximation of complex strokes to op/clip.Op.Add
Before this change, the two renderers both had special case code for
approximating strokes they don't support natively. This change moves
that conversion to clip.Op.Add, for several reasons:

- The compute renderer no longer need fallback logic and caches for
  strokes it doesn't support.
- The approximation logic is slow. Moving it to clip.Op.Add will not
  speed it up, but will make the cost easier to spot in profiles. Until all
  strokes are supported natively, users can use macros to cache
  expensive strokes.
- Reduced garbage: Op.Add takes an op.Ops anyway, and can use that for
  storing the approximated stroke outline.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-23 19:37:45 +01:00
Elias Naur 06c53c3777 internal/ops: expose PC and ResetAt
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-23 16:21:11 +01:00
Elias Naur 0a4b6549da internal/stroke,gpu: move stroking of path data to package internal/strokg
Pure refactor, preparing for use in op/clip.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-23 15:42:43 +01:00
Elias Naur 7825bda8f8 internal/stroke,op/clip: don't import op/clip from internal/stroke
To avoid an import cycle in a future change, internal/stroke can no
longer import op/clip. Move required op/clip functionality to
internal/stroke and duplicate the remaining types.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-23 15:28:52 +01:00
Elias Naur f9cf6ff20a op/clip: separate function for approximating arcs with quadratic curves
Both Path.Arc and the internal stroke package needs to support arcs;
this change isolates the approximation computation into a function we
can move to internal/stroke in a follow-up.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-23 15:01:00 +01:00
Elias Naur 8c8d1dc16f internal/stroke,gpu: create internal package for stroke to path conversion
Complex strokes are not yet supported in either of the current renderers,
so they are converted to filled outlines in package gpu.

We're about to move that complexity up to the op/clip package, so we're
going to need the converter available from outside package gpu. This
change extracts the conversion code and related types to the separate,
internal package stroke.

No functional changes; a follow-up moves the stroke conversion.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-23 12:35:41 +01:00
Elias Naur 8750828c69 gpu,gpu/shaders: [compute] add alpha to output
Fixes the glfw example where Gio content is composited (alpha blended)
on top of custom content.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-22 16:27:26 +01:00