GithubHelp home page GithubHelp logo

servo / pathfinder Goto Github PK

View Code? Open in Web Editor NEW
3.4K 89.0 191.0 8.86 MB

A fast, practical GPU rasterizer for fonts and vector graphics

License: Apache License 2.0

Rust 82.45% GLSL 11.07% HTML 0.15% Metal 6.18% Makefile 0.15%

pathfinder's Introduction

Pathfinder 3

Logo

Pathfinder 3 is a fast, practical, GPU-based rasterizer for fonts and vector graphics using OpenGL 3.0+, OpenGL ES 3.0+, WebGL 2, and Metal.

Please note that Pathfinder is under heavy development and is incomplete in various areas.

Quick start

Pathfinder contains a library that implements a subset of the HTML canvas API. You can quickly add vector rendering to any Rust or C/C++ app with it. The library is available on crates.io. See examples/canvas_minimal for a small example of usage.

Demos

Demo app sources are available in demo/native. Simply run:

$ cd demo/native
$ cargo run --release

A variety of small examples are also available to get you up and running quickly. For example, you can run the canvas_nanovg example like so:

$ cd examples/canvas_nanovg
$ cargo run --release

Features

The project features:

  • Rust and C bindings, for easy embedding in your own applications regardless of programming language. (Note that the C bindings are currently less complete; pull requests are welcome!)

  • GPU compute-based rendering, where available. Pathfinder has two rendering modes: D3D11, which is based on compute, and D3D9, which is based on hardware rasterization. (Note that these names are purely convenient ways to refer to hardware levels: the project doesn't have a proper Direct3D backend yet.) In the D3D11 mode, Pathfinder uses compute shaders to achieve large reductions in CPU usage and overall better performance than what the built-in GPU rasterization hardware can provide.

  • Fast CPU setup if needed, making full use of parallelism. If the D3D9 backend is in use, Pathfinder performs the tiling step using SIMD and Rayon in order to get as much parallelism out of the CPU as possible. (In the D3D11 backend, these steps are done on GPU instead.) The CPU step can be pipelined with the GPU to hide its latency.

  • Fast GPU rendering, even at small pixel sizes. Even on lower-end GPUs, Pathfinder often matches or exceeds the performance of the best CPU rasterizers. The difference is particularly pronounced at large sizes, where Pathfinder regularly achieves multi-factor speedups.

  • High quality antialiasing. Pathfinder can compute exact fractional trapezoidal area coverage on a per-pixel basis for the highest-quality antialiasing possible (effectively 256xAA).

  • Advanced font rendering. Pathfinder can render fonts with slight hinting and can perform subpixel antialiasing on LCD screens. It can do stem darkening/font dilation like macOS and FreeType in order to make text easier to read at small sizes. The library also has support for gamma correction.

  • Support for SVG. Pathfinder 3 is designed to efficiently handle workloads that consist of many overlapping vector paths, such as those commonly found in complex SVG and PDF files. It performs tile-based occlusion culling, which often results in dramatic performance wins over typical software renderers that use the painter's algorithm. A simple loader that leverages the resvg library to render a subset of SVG is included, so it's easy to get started.

  • 3D capability. Pathfinder can render fonts and vector paths in 3D environments without any loss in quality. This is intended to be useful for vector-graphics-based user interfaces in VR, for example.

  • Lightweight. Pathfinder is designed first and foremost for simplicity and generality instead of a large number of specialized fast paths. It consists of a set of modular crates, so applications can pick and choose only the components that are necessary to minimize dependencies.

  • Portability to most GPUs manufactured in the last decade, including integrated and mobile GPUs. Any GPU capable of Direct3D 9/OpenGL 3.0/WebGL 2.0 should be able to run Pathfinder. Currently, backends are available for OpenGL, OpenGL ES, Metal, and WebGL.

Building

Pathfinder can be used from either Rust or C/C++. See the appropriate section below.

Rust

Simply run cargo build --release at top level to build all the crates. Pathfinder is a set of modular crates, allowing you to select only the parts of the library you need and omit the rest. The libraries are available on crates.io with the pathfinder_ prefix (e.g. pathfinder_canvas), but you may wish to use the main branch for the latest features and bug fixes.

C

The C bindings use cargo-c. Install cargo-c with cargo install cargo-c, and then use a command like:

$ cargo cinstall --destdir=/tmp/pathfinder-destdir --manifest-path c/Cargo.toml
$ sudo cp -a /tmp/pathfinder-destdir/* /

The resulting library is usable via pkg-config as pathfinder. For examples of use, see the examples in the examples/ directory beginning with c_.

cargo-c has a variety of other options such as --prefix, which may be useful for packagers.

Community

There's a Matrix chat room available at #pathfinder:mozilla.org. If you're on the Mozilla Matrix server, you can search for Pathfinder to find it. For more information on connecting to the Matrix network, see this wiki.mozilla.org page.

The entire Pathfinder community, including the chat room and GitHub project, is expected to abide by the same Code of Conduct that the Rust project itself follows. (At the moment, the authors will handle violations.)

Build status

Build Status

Authors

The primary author is Patrick Walton (@pcwalton), with contributions from the Servo development community.

The logo was designed by Jay Vining.

License

Pathfinder is licensed under the same terms as Rust itself. See LICENSE-APACHE and LICENSE-MIT.

Material Design icons are copyright Google Inc. and licensed under the Apache 2.0 license.

pathfinder's People

Contributors

adjective-object avatar arturoc avatar bobo1239 avatar bors-servo avatar dependabot[bot] avatar eijebong avatar errata-c avatar est31 avatar floppyhammer avatar frewsxcv avatar hardiesoft avatar jdm avatar jonaspleyer avatar jrr avatar kognise avatar kyythane avatar leroycep avatar linkmauve avatar lu-zero avatar luisbg avatar manishearth avatar mbebenita avatar mrobinson avatar nical avatar nickspag avatar pcwalton avatar s3bk avatar tangmi avatar toolness avatar veedrac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pathfinder's Issues

Example fails on 2010 MBP

It's one of the dead dGPU series so running on just the iGP, which is probably the cause but I figure I might as well report it.

Error (w/ backtrace):

thread 'main' panicked at 'Couldn't create a window!', /Users/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-mac/build/src/libcore/option.rs:715
stack backtrace:
   1:        0x1057f32da - std::sys::imp::backtrace::tracing::imp::write::hd3b65cdfe843284c
   2:        0x1057f49ff - std::panicking::default_hook::{{closure}}::hf2b7428652613d83
   3:        0x1057f46a7 - std::panicking::default_hook::h5da8f27db5582938
   4:        0x1057f4e66 - std::panicking::rust_panic_with_hook::hcef1e67c646c6802
   5:        0x1057f4d04 - std::panicking::begin_panic::hc2e8ca89533cd10d
   6:        0x1057f4c22 - std::panicking::begin_panic_fmt::h60990696c3c3a88d
   7:        0x1057f4b87 - rust_begin_unwind
   8:        0x10581c880 - core::panicking::panic_fmt::h10231c789bd0e97d
   9:        0x10581c8ed - core::option::expect_failed::h77d0b34eebcbdfc8
  10:        0x10574e2cb - lorem_ipsum::main::h449476b86ae0c048
  11:        0x1057f5c5a - __rust_maybe_catch_panic
  12:        0x1057f5206 - std::rt::lang_start::h87cb84a8b6cb187e

iGP spec (from System Report):

Intel HD Graphics:

Chipset Model: Intel HD Graphics
Type: GPU
Bus: Built-In
VRAM (Dynamic, Max): 288 MB
Vendor: Intel (0x8086)
Device ID: 0x0046
Revision ID: 0x0012
gMux Version: 1.9.21

OpenGL Extension Viewer report:

Renderer: Apple Software Renderer

Vendor: Apple Inc.

Memory: 0 MB

Version: 4.1 APPLE-12.1.0

Device: MacBookPro6,2

Shading language version: 4.10


Core features
v3.0 (100 % - 23/23)

v3.1 (100 % - 8/8)

v3.2 (100 % - 10/10)

v3.3 (100 % - 10/10)

v4.0 (100 % - 14/14)

v4.1 (100 % - 7/7)

v4.2 (15 % - 2/13)

v4.3 (0 % - 0/23)

v4.4 (0 % - 0/10)

v4.5 (0 % - 0/11)

vARB 2015 (0 % - 0/13)

vARB 2016 (0 % - 0/1)

Linux deps in Readme

I'm on Ubuntu LTS and to make it compile I had to install the following packages:
cmake, libgl-dev, libx11-dev, xrandr-dev

I don't know if this list is complete, but it will definitely help if it's in the Readme.

White screen on 2014 Retina MBP

Running gfxCardStatus, app appears to switch to using the discrete GPU when launching sample app. Switches back to integrated when sample app is terminated.

Doesn't appear to be related to the switch from integrated to discrete as I launched two copies of the app and neither works.

System profiler:


  Chipset Model:	Intel Iris Pro
  Type:	GPU
  Bus:	Built-In
  VRAM (Dynamic, Max):	1536 MB
  Vendor:	Intel (0x8086)
  Device ID:	0x0d26
  Revision ID:	0x0008
  Automatic Graphics Switching:	Supported
  gMux Version:	4.0.8 [3.2.8]
  Metal:	Supported

NVIDIA GeForce GT 750M:

  Chipset Model:	NVIDIA GeForce GT 750M
  Type:	GPU
  Bus:	PCIe
  PCIe Lane Width:	x8
  VRAM (Total):	2048 MB
  Vendor:	NVIDIA (0x10de)
  Device ID:	0x0fe9
  Revision ID:	0x00a2
  ROM Revision:	3776
  Automatic Graphics Switching:	Supported
  gMux Version:	4.0.8 [3.2.8]
  Metal:	Supported
  Displays:
Color LCD:
  Display Type:	Retina LCD
  Resolution:	2880 x 1800 Retina
  Retina:	Yes
  Pixel Depth:	32-Bit Color (ARGB8888)
  Main Display:	Yes
  Mirror:	Off
  Online:	Yes
  Automatically Adjust Brightness:	No
  Built-In:	Yes

Link error on macOS 10.12.6

error: linking with cc failed: exit code: 1
|
= note: "cc" "-m64" "-L" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/pathfinder_server-d81cfa61efd7b6db.pathfinder_server0.rcgu.o" "-o" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/pathfinder_server-d81cfa61efd7b6db" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/pathfinder_server-d81cfa61efd7b6db.crate.allocator.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps" "-L" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/build/fontsan-72fd1c942a3f2fa9/out/lib" "-L" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/build/miniz-sys-64ca519ecee376a4/out" "-L" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/build/ring-7dfcc1e9a995e56d/out" "-L" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/librocket_contrib-50f6cc556a05d100.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/librocket-c687ad2776b3eba0.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcookie-96a656274a53deda.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libpear-959f47670bc30146.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libstate-dee99d4d108de679.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libisatty-886a79c03dfa7b12.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libimage-d34a7ac826db8776.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libgif-e2e5b125a6b77ca7.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblzw-4a755344faf49a52.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libpathfinder_font_renderer-43b36ba08d004703.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcore_text-20bcaa6aaf827fd3.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libapp_units-d54ebfcf596ba1d6.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libtoml-3c80b1b386b7e329.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libordermap-06cb6dba1facb08f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libpng-81e04733ba5d90ba.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libinflate-102de0c06e0a1b46.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libnum_iter-4dab621078e5df00.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/librustc_serialize-a889a4fe3a7dbe63.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libsmallvec-a808ef5d69ec0b43.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libfontsan-11577004c92f8e88.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libminiz_sys-9ac7185d460f891e.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libenum_primitive-95af202657897c7f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libjpeg_decoder-3ac8f0b748522f0d.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/librayon-fca4aa22d72785c8.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/librayon_core-5250b944c2d358d9.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/librand-42d60fa77ae4023d.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcoco-63db7513d1dee27f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblru_cache-0470ac7203f498be.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblinked_hash_map-74322f2fc732fbb3.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcore_graphics-204af4f0a9fbf11d.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libforeign_types-d74f661f34d1684d.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libbitflags-fb9a35f0935039a2.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcore_foundation-88be1239c0fca397.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcore_foundation_sys-36a1191d5d49ad78.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libpathfinder_partitioner-4485704a257d1a69.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libpathfinder_path_utils-be4fc8cf9bf9d4a9.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libbit_vec-30aa1d07dfe6813f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libbincode-7953a2e0f73f2b40.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libhyper-22ac0d1694dad5bc.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libmime-9b254f7900017ed9.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libtraitobject-108c02eb9919f1ae.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libnum_cpus-860dc29147df84b4.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libhttparse-dd835a0c0660ae20.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libunicase-424fa30f5dfce43b.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liburl-81c648a08d15e474.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libpercent_encoding-1d7caa3fff43b039.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libidna-d8410879a6b3a33e.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libtime-edfe3e3dc1d62e63.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libbase64-a5b58026b4a182bf.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libunicode_normalization-5554160ea15a56ed.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libenv_logger-854b26903ddb5393.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libregex-6ad1442de2a59485.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libregex_syntax-46e9017375f46c02.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libaho_corasick-ae6f749088280399.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libmemchr-e2311e38eeb1ece1.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblanguage_tags-f450c4c6019e503f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libthread_local-dc7d08b90c7a96a6.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblazy_static-12fee8d0b016dbdc.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libunreachable-2588997982ba550f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libvoid-6d58bea43c9f4258.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libeuclid-a74510d706dba974.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblog-86cd8093cf57a34e.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libnum_rational-a05bb3e025e89b22.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libdeflate-f5c9944630e87fb7.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libbyteorder-2d6912b733347e9f.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libscopeguard-5c47a00daea80856.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libscoped_threadpool-804789269f798f3b.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libfreetype_sys-bb92a533be03add1.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libyansi-279006fdfa4f8728.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libheapsize-ed43fb22de3698a7.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libunicode_bidi-941bcf27ebc859b8.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libmatches-cc6598cb83827685.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libsafemem-d657b6868445abad.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libtypeable-d1b4be1f70cb1c5b.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libring-bd4cdac761666a11.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libuntrusted-a50e3276b397c9bd.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/liblibc-c70a44633b9f30ed.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libutf8_ranges-6460f1bd9c2078a7.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libserde_json-0cee4a0a4369a078.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libdtoa-926e433c78d547b3.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libitoa-32cc207585aac845.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libserde-b599bb20eb67327a.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libnum_integer-66320512b287c4c7.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libnum_traits-2d49ea83b07a584c.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libadler32-b3131c1060b7a904.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libeither-527bcc5ab71684bd.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libcolor_quant-055a54b9e6af76eb.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libarrayvec-c5c41ddda4719ac2.rlib" "/Users/nigelbarber/Documents/github/pathfinder/demo/server/target/release/deps/libnodrop-4614bc1ccbed7893.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-37507bc42dbe9769.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-1ce580742eee3c59.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_jemalloc-e2f3a8bc2c37efd7.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-cf7427b7cf136f9f.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc_system-2ae91ee530952540.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-411dd041b417f2dc.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-b9404d2d88ffe119.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd_unicode-bfc8f9db37aaf43c.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librand-ddc29881ce534568.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-ecc3b9887f78fe76.rlib" "/Users/nigelbarber/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-3f172fbe1067a0ac.rlib" "-framework" "ApplicationServices" "-l" "c++" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreGraphics" "-framework" "CoreFoundation" "-l" "freetype" "-framework" "Security" "-l" "System" "-l" "resolv" "-l" "pthread" "-l" "c" "-l" "m"
= note: ld: library not found for -lfreetype
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: Could not compile pathfinder_server.

Is this ready for production use?

I'm considering using this project in the Amethyst game engine. I have a few questions:

In this issue you state you're working on Pathfinder 2. How soon can I reasonably expect that to be ready? Also, will Pathfinder 1 work on Windows 10? Is it just the example failing or is it the library itself? What font formats are supported? Are you planning on uploading this to cargo at any point?

Core i7 3770 (Ivy Bridge) + Linux + Firefox MCAA fails

On the text demo, zooming too much causes the text to appear like this:
text demo
Changing options doesn't make much of a difference (sometimes the artifacts change), but using a different antialiasing solves this.

If I activate subpixel-AA the rendering time jumps to 90-120ms, but only after the same level of zoom where the bad rendering shows up.
I'm using linux with the integrated GPU of the Core i7 3770 (Ivy Bridge).
The browser is Firefox 58.0b6

relevant glxinfo:

client glx vendor string: Mesa Project and SGI
    Device: Mesa DRI Intel(R) Ivybridge Desktop  (0x162)
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Desktop 
OpenGL core profile version string: 4.2 (Core Profile) Mesa 17.2.2 - padoka PPA
OpenGL version string: 3.0 Mesa 17.2.2 - padoka PPA
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 17.2.2 - padoka PPA

expose more data from partitioner

Current partitioner API is not easy for situation like caching. As it clears buffers on every .partition() call, an extra copy is needed to store the old partition data. An API to directly output the buffers instead of offering slices would be better.

fontsan fails to compile

OSX: `10.12.6`
cargo 0.23.0-nightly (e447ac7e9 2017-09-27)
rustc 1.22.0-nightly (4c053db23 2017-10-22)

When running:

cargo run --release

I get:

   Compiling num-traits v0.1.40
   Compiling pear_codegen v0.0.10
   Compiling lazy_static v0.2.9
   Compiling utf8-ranges v1.0.0
   Compiling yansi v0.3.4
   Compiling untrusted v0.5.1
   Compiling odds v0.2.25
   Compiling quote v0.3.15
   Compiling httparse v1.2.3
   Compiling serde v1.0.16
   Compiling libc v0.2.32
   Compiling rustc-serialize v0.3.24
   Compiling dtoa v0.4.2
   Compiling typeable v0.1.2
   Compiling gcc v0.3.54
   Compiling core-foundation-sys v0.4.4
   Compiling futures v0.1.16
   Compiling regex-syntax v0.4.1
   Compiling matches v0.1.6
   Compiling traitobject v0.1.0
   Compiling version_check v0.1.3
   Compiling bitflags v1.0.0
   Compiling void v1.0.2
   Compiling log v0.3.8
   Compiling unicode-normalization v0.1.5
   Compiling state v0.3.2
   Compiling half v1.0.1
   Compiling bit-vec v0.4.4
   Compiling safemem v0.2.0
   Compiling ordermap v0.2.13
   Compiling language-tags v0.2.2
   Compiling either v1.3.0
   Compiling heapsize v0.4.1
   Compiling itoa v0.3.4
   Compiling rayon-core v1.2.1
   Compiling percent-encoding v1.0.0
   Compiling linked-hash-map v0.4.2
   Compiling smallvec v0.4.4
   Compiling cc v1.0.2
   Compiling scopeguard v0.3.3
   Compiling foreign-types v0.3.0
   Compiling unicode-xid v0.0.4
   Compiling pear v0.0.10
   Compiling byteorder v1.1.0
   Compiling nodrop v0.1.11
   Compiling memchr v1.0.2
   Compiling isatty v0.1.5
   Compiling num_cpus v1.7.0
   Compiling time v0.1.38
   Compiling rand v0.3.17
   Compiling unicode-bidi v0.3.4
   Compiling unreachable v1.0.0
   Compiling mime v0.2.6
   Compiling unicase v1.4.2
   Compiling rocket_codegen v0.3.3
   Compiling rocket v0.3.3
   Compiling lru-cache v0.1.1
   Compiling coco v0.1.1
   Compiling synom v0.11.3
   Compiling base64 v0.6.0
   Compiling arrayvec v0.4.4
   Compiling aho-corasick v0.6.3
   Compiling thread_local v0.3.4
   Compiling bincode v0.8.0
   Compiling serde_json v1.0.4
   Compiling toml v0.4.5
   Compiling idna v0.1.4
   Compiling syn v0.11.11
   Compiling miniz-sys v0.1.10
   Compiling cmake v0.1.26
   Compiling core-foundation v0.4.4
   Compiling app_units v0.5.6
   Compiling euclid v0.15.4
   Compiling regex v0.2.2
   Compiling core-graphics v0.11.0
   Compiling rayon v0.7.1
   Compiling url v1.5.1
   Compiling fontsan v0.4.0 (https://github.com/servo/fontsan.git#29e879c8)
   Compiling core-text v7.0.0 (https://github.com/servo/core-text-rs.git#c9c689be)
error: failed to run custom build command for `fontsan v0.4.0 (https://github.com/servo/fontsan.git#29e879c8)`
process didn't exit successfully: `/Users/mbebenita/Workspace/pathfinder/demo/server/target/release/build/fontsan-b8694d5e7558edaa/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/Users/mbebenita/.cargo/git/checkouts/fontsan-75864180be477bc9/29e879c/src" "-DCMAKE_INSTALL_PREFIX=/Users/mbebenita/Workspace/pathfinder/demo/server/target/release/build/fontsan-dacfa508ca9b7c68/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=Release"

--- stderr
thread 'main' panicked at '
failed to execute command: No such file or directory (os error 2)
is `cmake` not installed?

build script failed, must exit now', /Users/mbebenita/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.26/src/lib.rs:599:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

Size limit on SVGs

Tried out some SVGs that I exported from OpenStreetMaps (click share button and set the SVG format) and the Pathfinder server failed in some unknown way. Getting a highly complicated OSM SVG map to render smoothly would make a great demo.

Text demo only renders at 45fps due to slow per-frame layout

I noticed that while the SVG and 3D demos render at 60fps and almost entirely on the GPU, the text demo only runs at 45fps and spins up my laptop fans doing a bunch of CPU work every frame.

Looking at the profile and code it looks like layout is being done every frame. It seems that this is currently required for stem darkening and hinting to work, but is done even when both of those features are disabled. I can't see any obvious hotspots in the profile, but given that the amount of text being rendered is pretty small compared to most web pages, I imagine this will have to get better if you want to fulfill your ambitions.

Why is it that layout is done on the CPU every frame? I thought I remember seeing something about you doing stem darkening on the GPU. I imagine you have some optimizations in mind and just haven't got around to implementing them yet.

I'm super impressed by the current state of the demo though. The quality is amazing, the other two demos are crazy fast, and the GPU times on the text demo are still great.

screen shot 2017-11-11 at 9 14 44 pm

client/js directory seems to be missing

When I cd to demo/server and then cargo run it and then visit it in the browser, the browser console gives me a couple of 404's for stuff in the js directory. Maybe its not checked into git?

Expose generic vector rendering API

I saw your recent presentation, and I would be interested in maybe giving this a shot. Font parsing should also probably be hidden behind a feature.

Please consider adding a LICENSE to this repository.

While the statement at the end of the README technically provides guidance, having a LICENSE file here makes your declared license visibly apparent, and permits GitHub automation to represent your project's license visually, and will avoid setting off alarms if someone forks this into gh:mozilla/* for some reason someday.

Normally I only write this issue for gh:mozilla/* repos (as an admin of said org), but since this is a Mozilla Foundation work, I felt it appropriate to register the request (not demand!) here as well. I'm in #github as atoll if you wish to follow up for any reason out of band, too.

demo/client does not compile

Windows 10 64 bits

node v8.4.0
npm 5.3.0
webpack 3.5.6

built with the following commands :

npm install
npm run build
Version: webpack 3.5.6
Time: 81ms
             Asset     Size  Chunks             Chunk Names
      text-demo.js  6.18 kB       0  [emitted]  text-demo
       svg-demo.js  6.21 kB       1  [emitted]  svg-demo
  mesh-debugger.js  6.15 kB       2  [emitted]  mesh-debugger
        3d-demo.js  6.14 kB       3  [emitted]  3d-demo
      3d-demo.html  6.64 kB          [emitted]
        index.html  4.14 kB          [emitted]
mesh-debugger.html  3.81 kB          [emitted]
     svg-demo.html   8.1 kB          [emitted]
    text-demo.html  10.5 kB          [emitted]
   [0] ./src/3d-demo.ts 329 bytes {3} [built] [failed] [1 error]
   [1] ./src/svg-demo.ts 385 bytes {1} [built] [failed] [1 error]
   [2] ./src/text-demo.ts 355 bytes {0} [built] [failed] [1 error]
   [3] ./src/mesh-debugger.ts 327 bytes {2} [built] [failed] [1 error]

ERROR in ./src/3d-demo.ts
Module parse failed: D:\Workspace\pathfinder\demo\client\src\3d-demo.ts Unexpected token (28:11)
You may need an appropriate loader to handle this file type.
| import PathfinderBufferTexture from "./buffer-texture";
|
| const WIDTH: number = 150000;
| const PADDING: number = 2000;
|

ERROR in ./src/mesh-debugger.ts
Module parse failed: D:\Workspace\pathfinder\demo\client\src\mesh-debugger.ts Unexpected token (25:15)
You may need an appropriate loader to handle this file type.
| import * as opentype from "opentype.js";
|
| const CHARACTER: string = 'r';
|
| const FONT: string = 'eb-garamond';

ERROR in ./src/svg-demo.ts
Module parse failed: D:\Workspace\pathfinder\demo\client\src\svg-demo.ts Unexpected token (28:12)
You may need an appropriate loader to handle this file type.
| const parseColor = require('parse-color');
|
| const SVG_NS: string = "http://www.w3.org/2000/svg";
|
| const PARTITION_SVG_PATHS_ENDPOINT_URL: string = "/partition-svg-paths";

ERROR in ./src/text-demo.ts
Module parse failed: D:\Workspace\pathfinder\demo\client\src\text-demo.ts Unexpected token (32:18)
You may need an appropriate loader to handle this file type.
| import SSAAStrategy from './ssaa-strategy';
|
| const DEFAULT_TEXT: string =
| `’Twas brillig, and the slithy toves
| Did gyre and gimble in the wabe;

Support for different line join and cap styles

I'm primarily interested in round joins and caps, but this issue could serve for discussion about line joins and caps in general.

Regarding round joins and caps, would it be better to do those in a separate pass? Each join/cap could be set up as a quad with vertex attributes specifying the normalised coordinates from the centre of the circle, and the pixel shader would check whether the interpolated 2d coordinate is inside the circle (i.e. magnitude less than one). I'm interested in implementing this at some point, and I think it might end up more performant in my use cases than encoding each join/cap as a set of quadratic curves, which could end up with a high density of triangles. I'm not too sure how this technique would interact with the existing anti-aliasing techniques in use in pathfinder as I'm not yet familiar with how XCAA works.

I'm also interested in supporting line dash patterns, though that's best left for another issue.

LoremIpsum example apparently now requires OpenGL 4.4+ ?

It seems this line ended up bumping the OpenGL version requirement to 4.4+ for this example: pcwalton@49408b9#diff-65d637d8d8f74f7ebed766c5a7d9caddR957

It calls the compute_shader crate's "OpenGL 4.5+ backend" (api::gl:queue::submit_clear calls gl::ClearTexImage which is a 4.4 API).

Did you mean to make Pathfinder 4.3+ but the examples 4.4+ ?

The lorem ipsum example crashes on 4.3:

Running target\debug\examples\lorem-ipsum.exe resources/tests/nimbus-sans/NimbusSanL-Regu.ttf
thread 'main' panicked at 'gl function was not loaded', g:\work\tests\pathfinder\target\debug\build\gl-256f76015a3dc339\out/bindings.rs:20591
stack backtrace:
   0:        0x1402f6898 - std::panicking::default_hook::{{closure}}
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:356
   1:        0x1402f5da4 - std::panicking::default_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:367
   2:        0x1402f96ed - std::panicking::rust_panic_with_hook
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:555
   3:        0x1402e4327 - std::panicking::begin_panic<&str>
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:517
   4:        0x1402e4bc5 - gl::missing_fn_panic
                        at C:\Users\lqd\.cargo\registry\src\github.com-1ecc6299db9ec823\gl-0.6.1\src\lib.rs:79
   5:        0x1402df4c2 - gl::ClearTexImage
                        at g:\work\tests\pathfinder\target\debug\build\gl-256f76015a3dc339\out\bindings.rs:3104
   6:        0x1402e37e3 - compute_shader::api::gl::queue::submit_clear
                        at C:\Users\lqd\.cargo\git\checkouts\compute-shader-f4827bcbd5ce554b\c155f7f\src\api\gl\queue.rs:137
   7:        0x13ff6aeba - compute_shader::queue::Queue::submit_clear
                        at C:\Users\lqd\.cargo\git\checkouts\compute-shader-f4827bcbd5ce554b\c155f7f\src\queue.rs:139
   8:        0x13ffe9745 - lorem_ipsum::create_image
                        at g:\work\tests\pathfinder\examples\lorem-ipsum.rs:957
   9:        0x13ffe4f4b - lorem_ipsum::Renderer::new
                        at g:\work\tests\pathfinder\examples\lorem-ipsum.rs:399
  10:        0x13ffe2faa - lorem_ipsum::main
                        at g:\work\tests\pathfinder\examples\lorem-ipsum.rs:150
  11:        0x1402fa3e1 - panic_unwind::__rust_maybe_catch_panic
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libpanic_unwind\lib.rs:98
  12:        0x1402f99aa - std::rt::lang_start
                        at C:\bot\slave\nightly-dist-rustc-win-msvc-64\build\src\libstd\rt.rs:51
  13:        0x13fff1bab - main
  14:        0x140311567 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:255
  15:         0x76ca59cc - BaseThreadInitThunk
error: process didn't exit successfully: `target\debug\examples\lorem-ipsum.exe resources/tests/nimbus-sans/NimbusSanL-Regu.ttf` (exit code: 101)

No text renders with gamma correction enabled

In the text demo, no text shows up without disabling gamma correction. The other settings don't seem to have an effect on the problem. The render time is close to what it is when text is visible.

  • Firefox 56.0.2 (64-bit)
  • Windows 10 Fall Creators Update
  • Intel HD 530, latest drivers (15.60.0.4849 according to the site; 23.20.16.4849 according to Task Manager)

No errors in the debug console, only the texSubImage2D warnings about zeroing texture data.

MacBook Pro 2014 fails to render XCAA text (Firefox+Chrome)

I originally filed #2 for Pathfinder 1, but it appears that Pathfinder 2 is just as broken on my 2014 Macbook Pro.

I've tested under both Firefox and Chrome and neither can successfully render glyphs in XCAA mode, but work just fine in 4xSSAA.

System

Model Name: MacBook Pro
Model Identifier: MacBookPro11,3
Processor Name: Intel Core i7
Processor Speed: 2.8 GHz

GPUs:

1

Chipset Model: Intel Iris Pro
Type: GPU
Bus: Built-In
VRAM (Dynamic, Max): 1536 MB
Vendor: Intel
Device ID: 0x0d26
Revision ID: 0x0008
Automatic Graphics Switching: Supported
gMux Version: 4.0.8 [3.2.8]
Metal: Supported, feature set macOS GPUFamily1 v3

2

Chipset Model: NVIDIA GeForce GT 750M
Type: GPU
Bus: PCIe
PCIe Lane Width: x8
VRAM (Total): 2 GB
Vendor: NVIDIA (0x10de)
Device ID: 0x0fe9
Revision ID: 0x00a2
ROM Revision: 3776
Automatic Graphics Switching: Supported
gMux Version: 4.0.8 [3.2.8]
Metal: Supported, feature set macOS GPUFamily1 v3

screen shot 2017-11-27 at 10 34 10 am

screen shot 2017-11-27 at 10 34 19 am

Chromium doesn't show anything on linux

Chromium Version: 62.0.3202.94
I couldn't find a similar issue, maybe it's already known.
Every demo is blank, I get the following errors in the console:

Uncaught (in promise) TypeError: Cannot read property 'createQueryEXT' of null
    at TextDemoView.initContext (text-demo.js:23417)
    at new DemoView (text-demo.js:23334)
    at new TextDemoView (text-demo.js:42460)
    at TextDemoController.createView (text-demo.js:42357)
    at view.Promise.all.then.assets (text-demo.js:32508)
    at <anonymous>
text-demo.js:23392 Uncaught TypeError: Cannot read property 'canvasResized' of undefined
    at TextDemoView.resized (text-demo.js:23392)
    at TextDemoView.resizeToFit (text-demo.js:23320)
    at PathfinderView.window.addEventListener (text-demo.js:23260)
text-demo.js:23379 Uncaught TypeError: Cannot read property 'meshesAttached' of undefined
    at TextDemoView.redraw (text-demo.js:23379)
    at window.requestAnimationFrame (text-demo.js:23266)

No curves rendered on Linux Nvidia 970M with official drivers

I can get the demo to work on firefox, but all the letters are only composed of straight lines, no curves rendered.

On Chromium nothing is shown at all, just the white background when the font is loaded.

Do I need to enable something on the browsers?

Examples fails on Windows 10

Windows 10 64-bit build 14393

GPU 1: NVIDIA GeForce GT 650M
GPU 2: Intel(R) HD Graphics 4000

OpenGL Version: 4.5.0 NVIDIA 373.06
GLSL (OpenGL Shading Language) Version: 4.50 NVIDIA

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ComputeError(CompileFailed("ERROR: 0:12: \'#extension\' :  \'GL_ARB_compute_shader\' is not supported\nERROR: 0:13: \'#extension\' :  \'GL_ARB_explicit_uniform_location\' is not supported\nERROR: 0:14: \'#extension\' :  \'GL_ARB_shader_image_load_store\' is not supported\nERROR: 0:15: \'#extension\' :  \'GL_ARB_shader_storage_buffer_object\' is not supported\nERROR: 0:51: \'local_size_x\' : syntax error syntax error\n\n\u{0}\u{0}"))', src\libcore\result.rs:860
stack backtrace:
   0:     0x7ff611d3e197 - std::panicking::default_hook::{{closure}}
                        at C:\projects\rust\src\libstd\panicking.rs:356
   1:     0x7ff611d3d6c4 - std::panicking::default_hook
                        at C:\projects\rust\src\libstd\panicking.rs:367
   2:     0x7ff611d40fe1 - std::panicking::rust_panic_with_hook
                        at C:\projects\rust\src\libstd\panicking.rs:545
   3:     0x7ff611d40e98 - std::panicking::begin_panic<collections::string::String>
                        at C:\projects\rust\src\libstd\panicking.rs:507
   4:     0x7ff611d40db4 - std::panicking::begin_panic_fmt
                        at C:\projects\rust\src\libstd\panicking.rs:491
   5:     0x7ff611d40d49 - std::panicking::rust_begin_panic
                        at C:\projects\rust\src\libstd\panicking.rs:467
   6:     0x7ff611d48047 - core::panicking::panic_fmt
                        at C:\projects\rust\src\libcore\panicking.rs:69
   7:     0x7ff611ca8555 - core::result::unwrap_failed<pathfinder::error::InitError>
                        at C:\projects\rust\src\libcore\macros.rs:29
   8:     0x7ff611c9f057 - core::result::Result<pathfinder::rasterizer::Rasterizer, pathfinder::error::InitError>::unwrap<pathfinder::rasterizer::Rasterizer,pathfinder::error::InitError>
                        at C:\projects\rust\src\libcore\result.rs:737
   9:     0x7ff611cb41fe - benchmark::main
                        at C:\github\pathfinder\examples\benchmark.rs:62
  10:     0x7ff611d41b11 - panic_unwind::__rust_maybe_catch_panic
                        at C:\projects\rust\src\libpanic_unwind\lib.rs:98
  11:     0x7ff611d412ba - std::rt::lang_start
                        at C:\projects\rust\src\libstd\rt.rs:51
  12:     0x7ff611cbdbcb - main
  13:     0x7ff611d691d0 - __scrt_common_main_seh
                        at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253
  14:     0x7ffdd4d38363 - BaseThreadInitThunk
error: process didn't exit successfully: `target\debug\examples\benchmark.exe` (exit code: 101)

libots fails to compile

Running this command:

cargo run --release

Gives me this error:

CMake Error at CMakeLists.txt:119 (add_library):
  Cannot find source file:

    ots/third_party/woff2/src/buffer.h

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


CMake Error: Cannot determine link language for target "woff2".
CMake Error: CMake can not determine linker language for target: woff2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /Users/mmc/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.26/src/lib.rs:599:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Versions

  • MacOS: 10.13
  • rustc: 1.22.0-nightly (7778906be 2017-10-14)
  • cargo: 0.23.0-nightly (e447ac7e9 2017-09-27)

This seems to be related: servo/fontsan#21

Do the algorithms behind ECAA rely on loop-blinn patents?

I see that when no antialiasing is used (or with SSAA) the loop-blinn algorithm is used (at least a few weeks ago). And this algorithm, as far as I know that is not much, is covered under some patents.

Is the ECAA algorithm based on this, or is a completely new idea and therefore not covered by these patents (as far a you know, of course).

And also, do you plan to write a post about the underlying algorithm as you did for pathfinder1? It seems pretty amazing that you managed to get this to work on opengl 3.0+ !!

Thanks a lot for your great work, this can enable a great deal of things that weren't possible before.

stroke path calculation seems broken in certain case

<path d="M63,252.1L66.1,249.4L63,246.7" stroke-width="2" stroke="#000000" fill="none"/>

Seems the svg demo renders wrong stroke path. Maybe pathfinder_path_utils::stroke is giving wrong endpoints in this case?

Build fails on Windows

Build fails on commit 49408b9

error: no method named `format` found for type `&compute_shader::image::Image` in the current scope
   --> src\rasterizer.rs:334:41
    |
334 |         let accum_program = match image.format() {
    |                                         ^^^^^^

error: aborting due to previous error

Consider optionally offering distance-to-edge antialiasing

This would have the advantage of allowing multicolor SVG meshes to be transformed with full affine transforms (or even 3D transforms, with fragment derivatives?), while preserving analytic antialiasing. It should also be very fast, assuming there's a good way to approximately calculate the distance to a quadratic Bézier curve. The downsides are that the antialiasing would be less accurate around edges and that the circular filter that distance-to-edge AA offers doesn't match the box filter we use elsewhere.

Practically, this would have the effect of making rotations of multicolor vector graphics fast and high-quality. This would be useful for applications like maps.

GLSL 4.10 is not supported

Running this on Arch Linux, x64, Intel CPU with Intel integrated graphics, I get this panic on running the example:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CompileFailed("Tessellation control shader", "0:11(10): error: GLSL 4.10 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, 3.00 ES, and 3.10 ES\n\u{0}")', /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:870

The error message seems pretty descriptive - GLSL 4.10 is not supported, but it supports previous versions correctly, so I guess support is yet to be added for the newer version?

"ERROR in ./src/svg-loader.ts" when building demo

demo/client (master|✔) $ npm run build

> [email protected] build /home/jhasse/git/pathfinder/demo/client
> webpack

HandlebarsPlugin: + helper 'octicon'
HandlebarsPlugin: start compilation
HandlebarsPlugin: + partial 'partials/header.html'
HandlebarsPlugin: + partial 'partials/navbar.html'
HandlebarsPlugin: + partial 'partials/spinner.html'
HandlebarsPlugin: + partial 'partials/switch.html'
HandlebarsPlugin: created output './3d-demo.html'
HandlebarsPlugin: created output './benchmark.html'
HandlebarsPlugin: created output './index.html'
HandlebarsPlugin: created output './integration-test.html'
HandlebarsPlugin: created output './mesh-debugger.html'
HandlebarsPlugin: created output './svg-demo.html'
HandlebarsPlugin: created output './text-demo.html'

ts-loader: Using [email protected] and /home/jhasse/git/pathfinder/demo/client/tsconfig.json
Hash: 314c54593b518ef210ee
Version: webpack 3.8.1
Time: 11582ms
                Asset     Size  Chunks                    Chunk Names
         3d-demo.html  7.53 kB          [emitted]         
         text-demo.js  3.85 MB       0  [emitted]  [big]  text-demo
     mesh-debugger.js  3.66 MB       2  [emitted]  [big]  mesh-debugger
  integration-test.js  3.76 MB       3  [emitted]  [big]  integration-test
         benchmark.js  3.78 MB       4  [emitted]  [big]  benchmark
          svg-demo.js  2.68 MB       5  [emitted]  [big]  svg-demo
           3d-demo.js   3.9 MB       1  [emitted]  [big]  3d-demo
       benchmark.html  7.89 kB          [emitted]         
           index.html  4.29 kB          [emitted]         
integration-test.html  5.25 kB          [emitted]         
   mesh-debugger.html  8.01 kB          [emitted]         
        svg-demo.html  9.28 kB          [emitted]         
       text-demo.html  14.2 kB          [emitted]         
   [6] ./src/gl-utils.ts 3.08 kB {0} {1} {2} {3} {4} {5} [built]
   [9] ./src/aa-strategy.ts 4.02 kB {0} {1} {3} {4} {5} [built]
  [10] ./src/text.ts 11.6 kB {0} {1} {2} {3} {4} [built]
  [12] ./src/meshes.ts 20.9 kB {0} {1} {2} {3} {4} {5} [built]
  [40] ./src/file-picker.ts 1.36 kB {0} {1} {2} {3} {4} {5} [built]
  [66] ./src/xcaa-strategy.ts 42 kB {0} {1} {3} {4} {5} [built]
  [67] ./src/atlas.ts 4.9 kB {0} {1} [built]
  [69] ./src/text-renderer.ts 8.64 kB {0} {1} [built]
  [70] ./src/svg-loader.ts 7.7 kB {2} {5} [built] [3 errors]
  [75] ./src/3d-demo.ts 32.1 kB {1} [built]
  [76] ./src/svg-demo.ts 7.13 kB {5} [built]
  [77] ./src/text-demo.ts 18.3 kB {0} [built]
  [78] ./src/integration-test.ts 9.22 kB {3} [built]
  [79] ./src/benchmark.ts 14 kB {4} [built]
  [80] ./src/mesh-debugger.ts 19.9 kB {2} [built]
    + 66 hidden modules

ERROR in ./src/svg-loader.ts
(110,23): error TS2345: Argument of type '{ body: string; headers: { 'Content-Type': string; }; method: string; }' is not assignable to parameter of type 'RequestInit | undefined'.
  Type '{ body: string; headers: { 'Content-Type': string; }; method: string; }' is not assignable to type 'RequestInit'.
    Types of property 'headers' are incompatible.
      Type '{ 'Content-Type': string; }' is not assignable to type 'Headers | string[][] | undefined'.
        Object literal may only specify known properties, and ''Content-Type'' does not exist in type 'Headers | string[][] | undefined'.

ERROR in ./src/svg-loader.ts
(112,17): error TS7006: Parameter 'response' implicitly has an 'any' type.

ERROR in ./src/svg-loader.ts
(115,17): error TS7006: Parameter 'buffer' implicitly has an 'any' type.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jhasse/.npm/_logs/2017-11-15T13_07_19_034Z-debug.log

This is on Linux with npm 5.4.2.

Can't run example.GLSL 4.1 is not supported - Debian Stretch

cargo run --release --example lorem-ipsum -- resources/tests/nimbus-sans/NimbusSanL-Regu.ttf

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CompileFailed("Tessellation control shader", "0:11(10): error: GLSL 4.10 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.40, 1.50, 3.30, 1.00 ES, 3.00 ES, and 3.10 ES\n\u{0}")', /buildslave/rust-buildbot/slave/stable-dist-rustc-linux/build/src/libcore/result.rs:837

I assume this is not unexpected with that GLSL version, but figured you might as well have an issue for it.

Debian Stretch (Testing)

In some cases holes don't show in filled paths

Given this svg, Pathfinder fails to deal with the hole in the shape correctly.

Pathfinder renders this shape like so:

image

Whereas other SVG renderers (e.g. browsers) draw it with the hole intact:

image

The mesh debugger shows that the hole is not being handled correctly:

image

The correct vertices are being generated, but they are not being used.

README outdated

Most of README is outdated now, I can't run any of the examples

Question: How does the demo work in the browser?

It seems that you're doing the "one-time setup" on the server, but then handling rasterization on the client by using the shaders directly. (i.e. no ASM.js or WASM)

Is that correct? Thanks.

lorem-ipsum shouldn't snap to the nearest pixel

A noob one: looking at pathfinder and linux FF side by side
pathfinder-vs-linuxff
For small-ish font size is it the subpixel rendering that makes Firefox's output looking so much better?
How much does the HDPI alleviate the difference?

subpixel antialiasing

Support subpixel antialiasing. This should be straightforward.

What do you mean by this this?

Zoomed text looks fine in pathfinder. You want to create more smoothness or it's something different.

Congratulations for writing such a wonderful and researched library.

Thank you for work!

More stroke path problems

As well as the problems reported in #57, which I've added some more screenshots to to show that the path closing bug has not been entirely fixed after the issue was closed, I've found some other problems with strokes, which appear to have been introduced by some of the fixes for #57, or at least significantly worsened.

Here is an SVG (again, uploaded as a zip since GitHub does not allow SVGs to be directly uploaded:
shaldon_bridge.zip

This is what other SVG rendering implementations draw it as:

image

This is how it appears in the Pathfinder demo with XCAA (ignore the line width difference due to hard-coded limits in the demo):

image

And with no AA:

image

And here is how it appears in a renderer I am writing that uses Pathfinder (no AA yet):

image

The problems due to round line joins and caps not being implemented should be ignored. The main problem that makes this unusable at the moment are the triangle spikes. In some scenes I have tested, these triangle spikes can be huge, and completely obscure the rest of the scene.

The other problem visible is the variable width of the strokes, though this may be part of the same problem.

Rendering issues

2017-04-20-00 38 02
2017-04-20-00 45 49

glxinfo
Graphics card is an MSI Radeon RX 480. Arch Linux with kernel 4.10.8-1, mesa 17.0.2-2, amdgpu 1.3.0-1. I used rustup override nightly to compile with rustc version 1.18.0-nightly (452bf0852 2017-04-19).

I tried running the lorem-ipsum example with cargo run --example lorem-ipsum resources/tests/nimbus-sans/NimbusSansL-Regu.ttf and with cargo run --example lorem-ipsum /usr/share/fonts/TTF/FreeMono.ttf and got the pictured results. I tried a few otfs in /usr/share/fonts/OTF but they panicked.

Clarify required WebGL extensions

I see that the demo requires the following WebGL extensions:

  • EXT_color_buffer_half_float
  • ANGLE_instanced_arrays
  • OES_texture_half_float
  • EXT_disjoint_timer_query
  • OES_vertex_array_object
  • EXT_frag_depth
  • OES_element_index_uint
  • OES_texture_float
  • WEBGL_depth_texture

Of these, it doesn't look like EXT_color_buffer_half_float or EXT_frag_depth are actually used. Is it safe to remove the getExtension calls for them?

Plans for supported platforms and/or apis?

From what I understand, the core algorithms of path rendering have solidified, but the actual interface to Pathfinder is still very much in flux. In addition, I haven't seen any reference to any plans for support beyond mac os, and the (admittedly awesome) demo is split between multiple languages--including, it seems, the entirety of the code loading the data into the shaders.

Anyway, that seems like a pretty specific setup. Are there plans for expanding:

  1. The client-side rendering code to a rust-native chunk of code?
  2. The shader-side rendering to other platforms (vulkan, metal, d3d, etc)

I'd like to play around with it, but I'm hesitant to where I should invest my efforts.

Best,
Duane

Graphics driver crash in Chrome with 2014 rMBP in ECAA, Nvidia GT 750M

I tried running the new Pathfinder web demo at revision 81a6f8f in Chrome. I loaded the Nimbus sans font and it rendered a very ugly aliased looking line of text. Then I switched it to ECAA and my computer hard crashed to the login screen.

I'm using a 2014 15" rMBP. I have a discrete GPU but at the time I was using gfxSwitcher to lock the GPU to the integrated Intel Iris Pro.

I know there's probably nothing you can do about this and it's not your fault. Just noting it down in case anyone else runs into it.

C bindings

As mentioned quite a few times in the hacker news post from a few days ago the ability to use pathfinder from other languages would be a great addition.

u and other letters are not rendered

The letter u is not rendered.

See the screenshot:

screenshot_20170228_232555

Used font: OxygenMono-Regular.ttf . Can be extracted from the ubuntu package, located under oxygen-fonts/mono-400/OxygenMono-Regular.ttf.

My setup:

OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2)
OpenGL core profile version string: 4.3 (Core Profile) Mesa 12.0.3

Can't build

error: use of unstable library feature 'iter_min_by' (see issue #36105)
  --> src/rect_packer.rs:53:18
   |
53 |                 .min_by(|&(_, a), &(_, b)| area(a).cmp(&area(b)))
   |                  ^^^^^^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.