Commit Graph

139 Commits

Author SHA1 Message Date
Patrick Walton 61833168e5 Update the debug UI 2020-06-23 13:15:59 -07:00
Patrick Walton 41c0c5f071 Upgrade to the latest master surfman 2020-05-08 12:47:58 -07:00
Patrick Walton 90fb36f199 Switch to using surfman in X11 mode.
Partially addresses #310.
2020-05-08 12:22:46 -07:00
Patrick Walton da2f65ddf4 Fix `surfman` reference in `Cargo.toml` 2020-04-30 15:04:49 -07:00
Patrick Walton ac83f79d94 Add a compute shader path, optimize GPU memory management, and switch from SDL
to `surfman`.

This is a large commit; explanations of each change follow.

This adds an optional compute shader path, off by default, for rendering fills
to alpha masks. It usually does not improve performance at present, but it
provides a good baseline for further optimizations. Later improvements will
likely aim to avoid writes to the mask texture entirely. Supporting
infrastructure for compute shader has been added to `pathfinder_gpu` for the
OpenGL and Metal backends.

The Metal backend has been optimized to avoid unneccessary buffer allocations
and reflection. As part of this, argument buffers have been removed, as the
current SPIRV-Cross compiler no longer requires them.

The GPU renderer has been improved to avoid stalls. Now, separate buffers are
allocated for each fill batch and for each frame. This can be extended in the
future to allow for separate buffers for tile draw operations as well.

SDL usage has been removed in favor of the native Rust `surfman` and `winit`.
Because `surfman` allows for selection of the integrated GPU on multi-GPU
system, it is chosen by default. The demo supports a new
`--high-performance-gpu` option to opt into the discrete GPU.
2020-04-30 13:33:29 -07:00
Patrick Walton cd09177ead Implement the infrastructure needed to support multiple clip paths.
This also lays the groundwork needed to reduce batch breaks between solid and
alpha tiles.
2020-04-21 18:25:20 -07:00
Patrick Walton 564533ff29 Switch from Rust MPSC channels to `crossbeam-channel`.
7x performance improvement in contour.svg from MPVG!
2020-04-21 09:57:47 -07:00
Patrick Walton 6c996981a3 Fix some transform issues and implement transformed radial gradients in SVG.
In particular, this fixes the usvg-to-Pathfinder transform conversion and the
definition of `Transform2F::row_major()`.

Makes `drops.svg` from the MPVG samples work.
2020-04-20 16:40:02 -07:00
Patrick Walton d9a93a102c Publish `pathfinder_svg` to crates.io 2020-04-17 13:57:04 -07:00
Patrick Walton ef20671ab7 Publish `pathfinder_canvas` to crates.io 2020-04-17 13:50:36 -07:00
Patrick Walton 686773224c Publish `pathfinder_text` to crates.io 2020-04-17 13:44:11 -07:00
Patrick Walton 1cd5966d3d Publish `pathfinder_content` and `pathfinder_renderer` to crates.io 2020-04-17 13:23:45 -07:00
Patrick Walton ccf9822e11 Fix `pathfinder_metal` crate description 2020-04-17 13:05:45 -07:00
Patrick Walton adf87d7636 Bump the `pathfinder_color` version to 0.5 to match other crates 2020-04-17 13:00:43 -07:00
Patrick Walton a91da6fdb4 Publish `pathfinder_resources` to crates.io 2020-04-17 12:33:22 -07:00
Patrick Walton 171fb21fe7 Switch back to upstream `skribo` 2020-04-17 12:15:55 -07:00
Patrick Walton 0b43f629cd Cache loaded fonts and glyph outlines.
Approximately a 70% CPU time improvement on the NanoVG demo.
2020-04-16 16:28:44 -07:00
Sebastian K 582f025c91 Update WebGL backend for recent changes 2020-04-16 12:02:42 -07:00
Patrick Walton 5efdf2a04a Implement the missing pieces of `TextMetrics` for canvas.
This required a `font-kit` upgrade, and with it a `skribo` upgrade.
2020-04-14 15:01:30 -07:00
Patrick Walton 0399061a70 Bump versions of `pathfinder_simd` and `pathfinder_geometry` 2020-04-09 10:31:18 -07:00
Patrick Walton 895f73096e Switch back to instanced drawing for tiles.
Improves tile build time by something around 2x in the NanoVG demo.
2020-04-08 17:16:54 -07:00
Patrick Walton ae97ccea5a Improve ergonomics of the canvas font interface, and use the right fonts in the
NanoVG demo.
2020-04-01 16:25:13 -07:00
Patrick Walton f1d5906c9e Switch to my branch of `skribo` for much better `fill_text()` performance 2020-03-30 21:30:14 -07:00
Patrick Walton a1f0ae097a Add thumbnail images to the NanoVG demo 2020-03-30 16:18:41 -07:00
Patrick Walton 9723fa441b Update `image`, `glutin`, and `jni` crates.
From #277.
2020-03-27 15:49:26 -07:00
Patrick Walton 55df287fec Move radial gradients from the CPU to the GPU 2020-03-26 21:24:20 -07:00
Patrick Walton 0c93045f50 Replace the individual tile shaders with an ubershader 2020-03-25 21:59:51 -07:00
乌戈 22f9c3bf6e Use instant crate to build for wasm32 target 2020-03-05 01:54:36 +08:00
Patrick Walton f607b607b0 Composite render targets using tiles, taking the Z-buffer into account.
We can do more tile-based optimization, but this should be enough to ensure a
correct rendering.

This temporarily breaks subpixel AA, but it should be fixable by modifying
`blur.fs.glsl`.

Closes #271.
2020-03-02 20:10:10 -08:00
Patrick Walton 0f35d9c817 Add an embedded resource loader that places resources directly in the binary.
This is useful for WebGL and for downstream crates.io use.
2020-02-28 17:10:53 -08:00
Sebastian K e2fbde820d Implement a WebGL backend
Signed-off-by: Patrick Walton <pcwalton@mimiga.net>
2020-02-28 10:41:35 -08:00
Patrick Walton d1c7da8bd2 Implement pattern repeating and image smoothing control 2020-02-26 14:56:05 -08:00
Patrick Walton 4933efb513 Add Lighten and Darken composite ops 2020-02-20 20:38:43 -08:00
Patrick Walton 16a2de88df Rename "postprocessing" to "effects" and start initial work on composite ops 2020-02-20 14:22:07 -08:00
Patrick Walton 25f9346160 Add an incomplete port of the NanoVG example app 2020-02-19 11:00:03 -08:00
Patrick Walton 243f2cc9b2 Add basic, incomplete support for clip paths in SVG 2020-02-16 15:02:37 -08:00
Patrick Walton 90445bac7e Implement basic support for non-repeating image patterns. 2020-02-11 17:20:21 -08:00
Patrick Walton 5a21557a6d Implement basic linear gradients.
This is not a very efficient implementation yet, but it seems to work.
2020-02-10 16:01:05 -08:00
Emmanuel Gil Peyrot 124472cff1 Regenerate Cargo.lock with the latest changes 2020-02-06 09:39:58 +01:00
Emmanuel Gil Peyrot cc6fe7864b Add quickcheck build-dependency
quickcheck usage in pathfinder_content had been added in
b8f622203a, but not to the Cargo.toml.

This makes tests pass again.
2020-02-05 14:35:20 +01:00
Patrick Walton b269723254 Switch to per-pixel texture lookup for paints.
This is a prerequisite for supporting gradients and images.
2020-02-04 21:50:13 -08:00
Patrick Walton 2db43797c3 Split colors out into their own crate.
A lot of downstream consumers of `pathfinder_gpu` want to use colors without
the path stuff.
2020-01-31 09:17:04 +01:00
Patrick Walton 5ea86ccba8 Bump `pathfinder_geometry` and `pathfinder_simd` to version 0.4 2020-01-23 18:24:56 -08:00
Sebastian K e38e2d800f update usvg to 0.8 2019-12-28 11:46:31 +03:00
Patrick Walton 0662f6433f Allow any texture format to be uploaded; fix Metal compilation on newer rustcs 2019-12-20 11:48:51 -08:00
Patrick Walton 7c655246ae Add some more features to blending, and expand texture upload features 2019-12-19 08:58:02 -08:00
Patrick Walton 9124d9856a Add some more methods to 3D vectors, and a `gluLookAt()` workalike 2019-12-18 15:19:42 -08:00
Kamal Ahmad 29713c5cd9 Bump lyon, font-kit and skribo versions to fix crashes 2019-11-20 22:51:03 +05:00
Patrick Walton ff212dce36 Add 2D matrix uniform types and a couple more useful geometry methods 2019-11-10 10:28:20 -08:00
est31 ad143712a8 Remove redundant fixedbitset dependency 2019-08-30 20:24:09 +02:00
Patrick Walton 4cdded74b4 Fix SVG export in the demo; update `Cargo.lock` 2019-06-25 11:32:26 -07:00
Patrick Walton 9efe44640d Update `Cargo.lock` 2019-06-24 12:05:59 -07:00
Patrick Walton 2c49a3360e Add Metal support to the C API 2019-06-21 13:37:17 -07:00
Patrick Walton 1c34b12948 Add some font functions to the C API 2019-06-21 13:17:11 -07:00
Patrick Walton 9107f21966 wip 2019-06-21 10:40:32 -07:00
Patrick Walton 431dcf3d2e Rename `pathfinder_geometry::basic` to simply `pathfinder_geometry`, and move
the remaining code in that crate to a new crate, `pathfinder_content`

The old hierarchy was confusing.
2019-06-21 10:06:19 -07:00
Patrick Walton 336f2ca302 Rename `pathfinder_flash` to `pathfinder_swf` for consistency with other crates
in the Rust Flash ecosystem
2019-06-21 09:28:15 -07:00
Patrick Walton 82b0826407 Merge remote-tracking branch 'hardiesoft/swf_renderer' 2019-06-21 09:25:00 -07:00
Patrick Walton 0012f09eeb Fix examples 2019-06-20 21:43:57 -07:00
Patrick Walton 010bc66073 Upgrade `resvg` to 0.7 2019-06-20 17:13:15 -07:00
Patrick Walton 36db39883c Add C bindings to the canvas text APIs 2019-06-20 16:07:38 -07:00
Jon Hardie b1dc8a1ab7 Merge remote-tracking branch 'origin/swf_renderer' into swf_renderer 2019-06-21 11:00:49 +12:00
Patrick Walton 487577a11b Add Metal support.
This commit substantially reworks the `pathfinder_gpu` API to better support
modern APIs like Metal. It should open the door to `gfx-rs`, `wgpu`, Vulkan,
and D3D12 backends relatively straightforwardly.

A new example, `canvas_metal_minimal`, has been added.

Note that the new Metal shaders require a patched version of `spirv-cross` to
build properly. An upstream patch is forthcoming.
2019-06-20 11:47:22 -07:00
jonathanhardie b17d6c605a Remove incorrect debug assertion 2019-06-19 11:25:26 +12:00
Patrick Walton 5dfe14ebc4 Add a minimal `glutin` example 2019-06-12 10:50:24 -07:00
Patrick Walton bc713a5181 Remove the rustache dependency.
1/3 reduction in binary size for `canvas_minimal`.

Closes #158.
2019-05-26 13:02:52 -07:00
Patrick Walton e04cc273ee Add enough C bindings to recreate `canvas_minimal` in C.
Closes #12.
2019-05-25 20:21:38 -07:00
Bastien Orivel 349c1a9cd0 Update quickcheck to 0.8
This dedupes some dependencies
2019-05-24 19:22:23 +02:00
Patrick Walton 8c4f05ce39 Initial rudimentary Lottie parsing code 2019-05-23 18:03:09 -07:00
Patrick Walton 7518fa65c0 Update dependencies 2019-05-13 18:47:19 -07:00
Patrick Walton 89ca998fa8 Add a convenience method for creating a scene proxy with an empty scene.
This makes animation rendering loops a bit easier for users.
2019-05-13 18:29:57 -07:00
Patrick Walton f24d93819b Add arc building methods and switch the Moiré demo to use them.
Also, stop taking points by reference in many methods, for consistency.
2019-05-13 12:42:13 -07:00
Patrick Walton 639a8f39e8 Add Moiré demo 2019-05-11 11:53:50 -07:00
Patrick Walton a078766dc6 Implement basic text rendering in canvas with `skribo` and `font-kit`.
Skribo currently writes some debugging info to standard output. A patch is
forthcoming to fix that.
2019-05-09 15:21:18 -07:00
Patrick Walton 9de7d95d33 Start a simple HTML canvas-like API, and add a minimal example to show how to
use it.
2019-05-03 14:15:38 -07:00
Patrick Walton 8606cd013e Replace commented out printlns with proper debug statements 2019-04-29 16:43:24 -07:00
Patrick Walton b85dc2f001 Add basic pinch zoom support on Android 2019-04-26 22:29:38 -07:00
Patrick Walton 6c31e1bc01 In VR mode, render one eye and then reproject to both eyes instead of rendering
twice.

This reduces both CPU and GPU time a lot in exchange for a small loss in
quality.
2019-04-26 17:22:54 -07:00
Alan Jeffrey bc89d88222 Dead code elimination 2019-04-15 12:43:41 -04:00
Alan Jeffrey 4c1e532f7f Regenerated Cargo.lock 2019-04-15 12:43:41 -04:00
Alan Jeffrey 685651c119 Wire up magicleap landscape demo cube faces to pathfinder demo 2019-04-15 12:43:41 -04:00
Patrick Walton 9e38da25e1 Remove the `TileObjectPrimitive` structure in favor of a flat list of
backdrops.

This reduces memory usage a bit and adds the infrastructure needed to support a
tile map.
2019-04-11 18:54:03 -07:00
Patrick Walton 3d4f8bd008 Pipeline between CPU and GPU at a more fine-grained level.
This makes us stop running one frame behind.
2019-04-09 17:06:43 -07:00
Patrick Walton ae192ffee7 Add ARM SIMD 2019-03-28 19:26:47 -07:00
Patrick Walton 0458d9a7f2 Factor out bits of the postprocessing shader into includes 2019-03-18 21:40:10 -07:00
Patrick Walton bb32777101 Initial work toward VR support 2019-03-14 14:42:22 -07:00
Patrick Walton 9c404dfdc1 Add an Android port 2019-03-12 13:55:26 -07:00
Patrick Walton d1728dfe6d Update the scalar SIMD fallback 2019-03-08 12:30:07 -08:00
Patrick Walton a74c0abbec Factor the SDL code out in preparation for other ports 2019-03-07 16:14:26 -08:00
Patrick Walton 40209b6fe8 Show a warning when unsupported SVG features are used 2019-03-06 18:25:08 -08:00
Patrick Walton 8dc3a84d09 Remove `tile-svg` and the serialization code.
They can be added later if needed, but for now they're just bitrotting.
2019-03-05 15:38:10 -08:00
Patrick Walton 33aa6f905d Move UI event code and widgets to the `pathfinder_ui` crate 2019-03-05 15:36:07 -08:00
Patrick Walton ad0691c146 Move the generic UI code in the renderer crate to a separate crate 2019-03-05 15:13:55 -08:00
Patrick Walton f7a8b573ce Move the GPU rendering code out of `pathfinder_gl`, since it's now no longer
OpenGL-specific
2019-03-05 14:46:18 -08:00
Patrick Walton ae450b063e WIP: Factor out GL code 2019-03-04 14:55:32 -08:00
Patrick Walton 64b480fe32 Some more work on the site 2019-03-01 14:58:02 -08:00
Patrick Walton ac24b67300 Add a simple SVG-subset-to-Skia-code tool, for benchmarking 2019-02-25 15:06:33 -08:00
Patrick Walton f6af769486 Add screenshot functionality. 2019-02-25 11:33:26 -08:00
Patrick Walton fc62e9bc71 Subdivide offset curves to an error bound. 2019-02-20 18:27:27 -08:00
Patrick Walton 3a8478a048 Remove all Lyon dependencies.
We may want to re-merge at a later date, but for now all relevant algorithms
have been appropriately SIMD-ified.
2019-02-20 16:46:50 -08:00