Commit Graph

1553 Commits

Author SHA1 Message Date
Patrick Walton 42289eec6e Fix Metal memory management and the `canvas_metal_minimal`, `canvas_nanovg`,
and `macos_app` examples.

`winit` does not create an autorelease pool, so the Metal backend had not taken
the presence of one into account. Now the Metal backend creates and flushes
autorelease pools as necessary.

Closes #334.
Closes #376.
2020-06-29 12:48:49 -07:00
bors-servo ac405fb988
Auto merge of #370 - pcwalton:optional-timer-query, r=pcwalton
Turn off timer queries if the debug UI is off.

Closes #360.
2020-06-25 14:07:22 -04:00
Patrick Walton e16f0a045e Turn off timer queries if the debug UI is off.
Closes #360.
2020-06-25 11:06:17 -07:00
bors-servo e21d79bf0f
Auto merge of #369 - pcwalton:nested-svg-fixup, r=pcwalton
Fix `Display` impl on `BuildResultFlags`

@bors-servo: r+
2020-06-25 11:37:03 -04:00
bors-servo 72a9deed9f
Auto merge of #368 - pcwalton:vector-additions, r=pcwalton
Add `recip`, `angle` and `angle_between` methods to `Vector2F`
2020-06-24 21:35:04 -04:00
Patrick Walton 6d11a8fc8f Fix `Display` impl on `BuildResultFlags` 2020-06-24 18:00:12 -07:00
Sebastian K 7b244cad68 Add `recip`, `angle` and `angle_between` methods to `Vector2F` 2020-06-24 17:57:37 -07:00
bors-servo 495708dbf1
Auto merge of #367 - pcwalton:transformed, r=pcwalton
Add some new Outline methods
2020-06-24 20:52:50 -04:00
Sebastian K 9d86f663ed Add a new `Outline::len()` method 2020-06-24 17:47:30 -07:00
Sebastian K e5eee41b48 Micro-optimize `Contour::from_rect()` 2020-06-24 17:43:16 -07:00
Sebastian K 5eb346f77d Add an `Outline::with_capacity()` method 2020-06-24 17:43:16 -07:00
Sebastian K 4dea6aa258 Add a `transformed()` method to `Outline` and `Contour`. 2020-06-24 17:43:14 -07:00
bors-servo 265e781efa
Auto merge of #365 - pcwalton:c-svg, r=pcwalton
Expose `pathfinder_svg` to the C API

Closes #357.
2020-06-24 20:36:08 -04:00
Emmanuel Gil Peyrot 9e670287d0 Expose `pathfinder_svg` to the C API 2020-06-24 17:35:43 -07:00
Patrick Walton 3e64e29fb2 Rename `BuiltSVG` to `SVGScene` 2020-06-24 17:35:43 -07:00
bors-servo 981677976e
Auto merge of #366 - pcwalton:outline-merge, r=pcwalton
Add a function to merge two outlines
2020-06-24 20:12:23 -04:00
Sebastian K 3486d55565 Add a function to merge two outlines 2020-06-24 17:11:07 -07:00
bors-servo 89067a9ab7
Auto merge of #364 - pcwalton:c-api-gl4, r=pcwalton
Expose OpenGL 4.x in the C bindings

Closes #352.
2020-06-24 14:48:21 -04:00
Patrick Walton bc0b37c56a Panic when invalid arguments are passed to the C API.
Closes #352.
2020-06-24 11:45:47 -07:00
Patrick Walton 4877e0da57 Expose OpenGL 4.x in the C bindings 2020-06-24 11:34:28 -07:00
bors-servo bf50e74396
Auto merge of #363 - pcwalton:cargo-c, r=pcwalton
Use `cargo-c`, and update the README.

Closes #343.
2020-06-23 20:41:09 -04:00
Patrick Walton db80dd8aaa Use `cargo-c`, and update the README.
Closes #343.
2020-06-23 17:37:59 -07:00
bors-servo b3232265b4
Auto merge of #362 - pcwalton:nested-svg, r=pcwalton
`usvg` should never have nested `<svg>` nodes, so remove code that (doesn't) handle that case.

Closes #349.
2020-06-23 18:24:55 -04:00
Patrick Walton dc73e12473 `usvg` should never have nested `<svg>` nodes, so remove code that (doesn't)
handle that case.

Closes #349.
2020-06-23 15:23:43 -07:00
Patrick Walton 3dc70e0111
Merge pull request #350 from pcwalton/gpu-tiling-dicing
Add a rendering path for Direct3D 11-class hardware that uses compute shader for most stages.
2020-06-23 14:58:38 -07:00
Patrick Walton e3a966cc99 Update `Cargo.lock` 2020-06-23 13:31:53 -07:00
Patrick Walton a2d87a6624 Update the C canvas example 2020-06-23 13:31:53 -07:00
Patrick Walton 9ff46b39cd Update examples 2020-06-23 13:31:53 -07:00
Patrick Walton 423a91ea1a Update the demo for the D3D11 backend 2020-06-23 13:15:59 -07:00
Patrick Walton 72cdef2c2a Update the C backend 2020-06-23 13:15:59 -07:00
Patrick Walton 7a1db16340 Update the WebGL backend 2020-06-23 13:15:59 -07:00
Patrick Walton 769dae4a9c Update various front-end libraries 2020-06-23 13:15:59 -07:00
Patrick Walton 13b2c91dde Update the scene proxy 2020-06-23 13:15:59 -07:00
Patrick Walton f92c631f97 Rework the tile builder for D3D11 2020-06-23 13:15:59 -07:00
Patrick Walton 17356311d6 Rework renderer options 2020-06-23 13:15:59 -07:00
Patrick Walton 7a996d330c Update `pathfinder_renderer::{paint, scene}` 2020-06-23 13:15:59 -07:00
Patrick Walton df15c855c4 Significantly rework the GPU renderer for the D3D11 backend 2020-06-23 13:15:59 -07:00
Patrick Walton 58a76f0f16 Update `gpu_data` 2020-06-23 13:15:59 -07:00
Patrick Walton eabe1b239d Update `pathfinder_content` 2020-06-23 13:15:59 -07:00
Patrick Walton 385272851a Remove the separate `z_buffer` module 2020-06-23 13:15:59 -07:00
Patrick Walton b8055c38c1 Update `pathfinder_geometry` 2020-06-23 13:15:59 -07:00
Patrick Walton 23c171fb6f Refactor GPU a bit more 2020-06-23 13:15:59 -07:00
Patrick Walton 3bb4a47757 Remove old shaders 2020-06-23 13:15:59 -07:00
Patrick Walton 79326025af Rework the blit shader 2020-06-23 13:15:59 -07:00
Patrick Walton 661da5e12b Refactor GPU performance measurement 2020-06-23 13:15:59 -07:00
Patrick Walton 61833168e5 Update the debug UI 2020-06-23 13:15:59 -07:00
Patrick Walton ff7c13c8fb Add a new compute-based D3D11 backend 2020-06-23 13:10:06 -07:00
Patrick Walton 4091fe7ce1 Update the Metal backend 2020-06-23 13:10:06 -07:00
Patrick Walton 21a82ae049 Update the OpenGL backend 2020-06-23 13:10:06 -07:00
Patrick Walton 7771fd877d Add a unified GPU allocator 2020-06-23 13:10:06 -07:00
Patrick Walton 754a44ae22 Rename the existing renderer to `d3d9` in preparation for the D3D11 branch 2020-06-23 13:10:05 -07:00
bors-servo 5e3fb5fed0
Auto merge of #356 - linkmauve:c-resources-path, r=pcwalton
Expose creating a resource loader from a path to C

This is useful when Pathfinder is shipped by a Linux distribution, and not with everything bundled.
2020-06-16 12:11:35 -04:00
bors-servo 22d5dbc26a
Auto merge of #353 - linkmauve:no-foreign-types, r=pcwalton
Only use foreign-types on macOS in the C API

Its only use is for `CoreAnimationLayerRef::from_ptr()` in `PFMetalDeviceCreate`, so this fixes a warning on other platforms.

The last time I tried to fix this warning I didn’t notice that it was actually used, and thus 2d2bc14e5c broke the macOS build in #257.
2020-06-16 11:54:58 -04:00
bors-servo 1b63996fef
Auto merge of #347 - as-cii:metal-manifest, r=pcwalton
Add missing Metal shader to resources/MANIFEST

This fixes an issue that caused `pathfinder_metal` to panic when [attempting to load shaders](0f35009215/metal/src/lib.rs (L854)) using the embedded resource loader.

/cc: @nathansobo
2020-06-16 11:37:25 -04:00
Patrick Walton a47c703518
Merge pull request #358 from windexlight/scalar-u32x2-fix
Implement BitAnd, BitOr, and Not for U32x2 in scalar version.
2020-06-16 08:37:02 -07:00
Sam Schanken 714421b3c6 Implement BitAnd, BitOr, and Not for U32x2 in scalar version. 2020-06-13 17:18:49 -07:00
Emmanuel Gil Peyrot 5e8c20e78c Expose creating a resource loader from a path to C 2020-06-11 16:02:09 +02:00
Emmanuel Gil Peyrot f2c0aba352 C API: Only use foreign-types on macOS
Its only use is for CoreAnimationLayerRef::from_ptr() in
PFMetalDeviceCreate, so this fixes a warning on other platforms.

The last time I tried to fix this warning I didn’t notice that it was
actually used, and thus 2d2bc14e5c broke
the macOS build in #257.
2020-06-05 17:12:35 +02:00
Antonio Scandurra cc54fa6e03 Add missing Metal shader to resources/MANIFEST
Co-Authored-By: Nathan Sobo <nathansobo@gmail.com>
2020-05-28 16:11:23 +02:00
bors-servo 0f35009215
Auto merge of #342 - pcwalton:listener-lifetime, r=pcwalton
Don't restrict render command listeners to the static lifetime
2020-05-16 14:05:57 -04:00
bors-servo 523734d95e
Auto merge of #341 - pcwalton:new-tiling-simd, r=pcwalton
Use SIMD a bit more in the new tiling code.
2020-05-16 13:49:38 -04:00
Sebastian K 18d2b006ac Don't restrict render command listeners to the static lifetime 2020-05-16 10:47:06 -07:00
Patrick Walton 13f9fdc96c Use SIMD a bit more in the new tiling code. 2020-05-16 10:38:34 -07:00
bors-servo 28c4bc194d
Auto merge of #340 - pcwalton:new-tiling, r=pcwalton
Replace the tiling algorithm with the one from "Random Access Vector Graphics".

This is a significant improvement in CPU time, as well as an overall
simplification.
2020-05-15 22:38:27 -04:00
Patrick Walton abecb697be Quit the NanoVG demo when pressing Escape, not any key.
The previous setup was making it hard to take screenshots.
2020-05-15 19:14:32 -07:00
Patrick Walton deee2436c1 Make the NanoVG demo use the filesystem resource loader.
The embedded resource loader doesn't have the needed fonts.
2020-05-15 19:14:08 -07:00
Patrick Walton 6ed3237b10 Remove path rect clipping, since it's no longer required 2020-05-15 19:13:18 -07:00
Patrick Walton 37c993eee6 Remove monotonic conversion, since it's no longer required 2020-05-15 19:12:46 -07:00
Patrick Walton 440510a126 Add an `abs` method to `Vector2F` 2020-05-15 19:11:39 -07:00
Patrick Walton 3433545a76 Minor cleanup in the `line_segment` module 2020-05-15 19:10:56 -07:00
Patrick Walton a67b4dd5b7 Replace the tiling algorithm with the one from "Random Access Vector Graphics".
This is a significant improvement in CPU time, as well as an overall
simplification.
2020-05-15 19:10:12 -07:00
Patrick Walton c61f3e5ae8 Add some new operators to `RectI` 2020-05-15 19:08:39 -07:00
bors-servo 1630a3b97c
Auto merge of #338 - servo:jdm-patch-1, r=jdm
Add homu webhook.
2020-05-13 11:13:11 -04:00
Josh Matthews 3f201e4729
Add homu webhook. 2020-05-13 10:43:48 -04:00
Patrick Walton 8808bfda63
Merge pull request #337 from pcwalton/macos-radeon
Associate texture parameters in shaders with specific texture units, to work around a macOS Radeon driver bug.
2020-05-12 22:08:12 -07:00
Patrick Walton ef0c0e0679 Associate texture parameters in shaders with specific texture units, to work
around a macOS Radeon driver bug.

Also, ensure there is always a dummy texture bound to every parameter in the
OpenGL backend.

These together stop the macOS Radeon drivers from recompiling the shader on
every drawcall.

Possibly addresses #300.
2020-05-12 21:40:38 -07:00
Patrick Walton 33cd3798d7
Merge pull request #335 from Veedrac/master
Change how point_queue and active_edges are sorted for performance
2020-05-11 15:24:59 -07:00
Veedrac 033a150639 Order and sample gradient correctly
Zero-width gradient sections should be ‘ignored’.
The visible endpoints should be precisely the first
and last colors added at that point.

https://html.spec.whatwg.org/multipage/canvas.html#interpolation
2020-05-11 21:47:39 +01:00
Veedrac 6d8a89b8c5 Cleanup: remode redundant ops in tiles.rs 2020-05-11 21:47:39 +01:00
Veedrac 1c48e8900e Faster sorting strategy, remove SortedVector
point_queue is only sorted by y coordinate to coordinate
work to one strip at a time. This is more efficiently handled
by punting later work into a next_point_queue,
and never explicitly sorting the data.

active_edges is only sorted by x coordinate for the tile-by-tile
work in process_old_active_edges. It is much more efficient
to sort once inside that function.
2020-05-11 21:47:35 +01:00
Patrick Walton cbceee85e6
Merge pull request #336 from Veedrac/hidpi_fix
Fix non-integer HiDPI support in demo
2020-05-11 11:19:06 -07:00
Veedrac faea46b9f6 Fix non-integer HiDPI support in demo 2020-05-11 13:14:54 +01:00
Patrick Walton 5ed26819bb
Merge pull request #331 from frewsxcv/frewsxcv-rect
Implement {Add,Sub,Mul}Assign for RectF
2020-05-10 21:33:47 -07:00
Patrick Walton fc515f950f
Merge pull request #329 from frewsxcv/frewsxcv-colors
Promote ColorU functions to `const`.
2020-05-10 21:33:23 -07:00
Patrick Walton 116b528e4e
Merge pull request #330 from frewsxcv/frewsxcv-embedded
Switch to the embedded loader for the examples.
2020-05-10 21:33:04 -07:00
Corey Farwell 9f71feb545
Update main.rs 2020-05-09 12:49:43 -04:00
Corey Farwell e993e350e2 Implement {Add,Sub,Mul}Assign for RectF 2020-05-08 21:25:45 -04:00
Corey Farwell e1ec307b3f Switch to the embedded loader for the examples. 2020-05-08 21:17:23 -04:00
Corey Farwell e26338835b Promote ColorU functions to `const`. 2020-05-08 21:09:38 -04:00
Patrick Walton aa1279d692
Merge pull request #328 from pcwalton/precision-highp
Only define `precision highp sampler2D` in OpenGL ES.
2020-05-08 17:16:35 -07:00
Patrick Walton 2ad02b0b78 Only define `precision highp sampler2D` in OpenGL ES.
Closes #309.
2020-05-08 16:59:40 -07:00
Patrick Walton 1a37b7f819
Merge pull request #327 from pcwalton/glfw-c-example
Add an example showing how to use the Pathfinder C API with GLFW
2020-05-08 16:53:06 -07:00
Patrick Walton feb6cca419
Merge pull request #326 from pcwalton/c-font-context-docs
Document `PFCanvasFontContextCreateWithFonts()`.
2020-05-08 15:10:07 -07:00
Patrick Walton bbf4c88d0d Add an example showing how to use the Pathfinder C API with GLFW
Closes #258.
2020-05-08 15:09:21 -07:00
Patrick Walton fd57193442
Merge pull request #325 from pcwalton/update-embedded
Update the resource manifest for recent changes
2020-05-08 14:33:53 -07:00
Patrick Walton b669cc7087 Document `PFCanvasFontContextCreateWithFonts()`.
Closes #247.
2020-05-08 14:27:41 -07:00
Patrick Walton d039e9009e
Merge pull request #324 from pcwalton/metal-layer-non-macos
Provide a placeholder definition of `CAMetalLayer` in the C API.
2020-05-08 14:18:00 -07:00
Patrick Walton 84cd92aea4 Update the resource manifest for recent changes 2020-05-08 14:17:13 -07:00
Patrick Walton 9998fe49bd Provide a placeholder definition of `CAMetalLayer` in the C API.
Closes #260.
2020-05-08 14:07:06 -07:00
Patrick Walton d3ceef749f
Merge pull request #323 from pcwalton/surfmanup
Upgrade to the latest master surfman
2020-05-08 13:17:52 -07:00