A fast, practical GPU rasterizer for fonts and vector graphics

Related tags

Game pathfinder
Overview

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 master 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.

Comments
  • Nothing is displayed when running on Magic Leap One

    Nothing is displayed when running on Magic Leap One

    The following demo has been installed on Magic Leap One. https://github.com/servo/pathfinder/releases

    Installation succeeded and ran. But nothing is displayed. My Magic Leap One is Lumin OS v0.96.0.

    Thanks,

    bug 
    opened by tokufxug 18
  • C bindings

    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.

    enhancement help wanted 
    opened by mdsitton 17
  • Random artifacts when rendering path (webgl)

    Random artifacts when rendering path (webgl)

    Use pathfinder's Path2D API and render some outlines into scene with webgl results with random artifacts (seems to be blank tiles).

    image

    As no one reported this before, I think maybe it's webgl related. @s3bk

    opened by zimond 15
  • Release cadence?

    Release cadence?

    I see latest pathfinder version was released 1,5 years ago. I believe there are some changes and fixes accumulated since then. What are the roadmap and release plans for this project?

    opened by berkus 13
  • No curves rendered on Linux Nvidia 970M with official drivers

    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?

    question compatibility 
    opened by siriux 13
  • Graphics driver crash in Chrome with 2014 rMBP in ECAA, Nvidia GT 750M

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

    I tried running the new Pathfinder web demo at revision 81a6f8f0513ae0b03f49209fc4472dca7040d3b9 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.

    compatibility 
    opened by trishume 13
  • macOS Radeon performance woes

    macOS Radeon performance woes

    It appears to be compiling shaders constantly as seen in the attached Instruments screenshot.

    Screen Shot 2020-04-15 at 11 16 29 PM

    My system is:

    Model Name: MacBook Pro Model Identifier: MacBookPro14,3 Processor Name: Intel Core i7 Processor Speed: 2.9 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 8 MB Hyper-Threading Technology: Enabled Memory: 16 GB

    System Version: macOS 10.14.6 (18G3020) Kernel Version: Darwin 18.7.0

    And my graphics / display hardware is:

    Radeon Pro 560:

    Chipset Model: Radeon Pro 560 Type: GPU Bus: PCIe PCIe Lane Width: x8 VRAM (Total): 4 GB Vendor: AMD (0x1002) Device ID: 0x67ef Revision ID: 0x00c0 ROM Revision: 113-C980AJ-927 VBIOS Version: 113-C9801AU-A02 EFI Driver Version: 01.A0.927 Automatic Graphics Switching: Supported gMux Version: 4.0.29 [3.2.8] Metal: Supported, feature set macOS GPUFamily2 v1 Displays: Color LCD: Display Type: Built-In Retina LCD Resolution: 2880 x 1800 Retina Framebuffer Depth: 30-Bit Color (ARGB2101010) Main Display: Yes Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No LG UltraFine: Resolution: 5120 x 2880 (5K/UHD+ - Ultra High Definition Plus) UI Looks like: 2560 x 1440 @ 60 Hz Framebuffer Depth: 30-Bit Color (ARGB2101010) Display Serial Number: 910NTXRBJ538 Mirror: Off Online: Yes Rotation: Supported Automatically Adjust Brightness: No Connection Type: DisplayPort

    performance 
    opened by waywardmonkeys 12
  • Please add support for SVG OpenType fonts!

    Please add support for SVG OpenType fonts!

    Please add support for SVG OpenType fonts! We use them extensively in our opengl games!

    img_0433

    https://blogs.adobe.com/creativecloud/photoshop-cc-adds-support-for-opentype−svg-fonts-an-in-depth-look/

    https://www.microsoft.com/typography/otspec/svg.htm

    enhancement 
    opened by Emasoft 12
  • Can't run example.GLSL 4.1 is not supported - Debian Stretch

    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)

    compatibility classic 
    opened by tupshin 11
  • Cleaned up VR implementation

    Cleaned up VR implementation

    Fixed up https://github.com/pcwalton/pathfinder/pull/75

    Actually mergeable.

    I still want to improve the camera code. It currently just overwrites the rotation matrix, but we can do better.

    Ideally the code gets refactored into having two view transforms.

    r? @pcwalton

    opened by Manishearth 10
  • stroke path calculation seems broken in certain case

    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?

    bug 
    opened by zimond 10
  • Can pathfinder_color get a version bump to include the latest changes?

    Can pathfinder_color get a version bump to include the latest changes?

    pathfinder_color v0.5.0 was released about a week before a PR was submitted that marked ColorU::new() and friends as const fn. This would be very nice functionality to have available, but declaring a dependency on a particular revision leads to pulling in two separate versions of pathfinder_simd (one linked to the revision, and another for the versioned pathfinder_* crates we depend upon).

    Would it be possible to bump pathfinder_color to v0.5.1 so we can make use of these const functions?

    opened by vorporeal 0
  • Bump loader-utils from 1.2.3 to 1.4.2 in /examples/canvas_webgl_minimal/www

    Bump loader-utils from 1.2.3 to 1.4.2 in /examples/canvas_webgl_minimal/www

    Bumps loader-utils from 1.2.3 to 1.4.2.

    Release notes

    Sourced from loader-utils's releases.

    v1.4.2

    1.4.2 (2022-11-11)

    Bug Fixes

    v1.4.1

    1.4.1 (2022-11-07)

    Bug Fixes

    v1.4.0

    1.4.0 (2020-02-19)

    Features

    • the resourceQuery is passed to the interpolateName method (#163) (cd0e428)

    v1.3.0

    1.3.0 (2020-02-19)

    Features

    • support the [query] template for the interpolatedName method (#162) (469eeba)
    Changelog

    Sourced from loader-utils's changelog.

    1.4.2 (2022-11-11)

    Bug Fixes

    1.4.1 (2022-11-07)

    Bug Fixes

    1.4.0 (2020-02-19)

    Features

    • the resourceQuery is passed to the interpolateName method (#163) (cd0e428)

    1.3.0 (2020-02-19)

    Features

    • support the [query] template for the interpolatedName method (#162) (469eeba)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies javascript 
    opened by dependabot[bot] 0
  • pathfinder_export is not on crates.io

    pathfinder_export is not on crates.io

    I'm a little new to the whole rust ecosystem, so please forgive me if this is a dumb thing to report. I was able to find all of the modular crates on crates.io that I tried except for pathfinder_export. Is there an easy way to use it in my project without downloading the whole master branch and using it locally?

    opened by asattely 10
  • Use pf-text with wasm

    Use pf-text with wasm

    Is it possible to use features = ["pf-text"] with wasm? I have the next error during compilation:

    warning: In file included from harfbuzz/src/harfbuzz.cc:1:
    warning: In file included from harfbuzz/src/hb-aat-layout.cc:28:
    warning: harfbuzz/src/hb.hh:178:10: fatal error: 'math.h' file not found
    warning: #include <math.h>
    warning:          ^~~~~~~~
    warning: 1 error generated.
    
    error: failed to run custom build command for `harfbuzz-sys v0.3.4`
    
    opened by AaronPorts 4
Releases(preview-3)
Owner
Servo
The Servo web browser engine
Servo
VTK is an open-source software system for image processing, 3D graphics, volume rendering and visualization

Introduction VTK is an open-source software system for image processing, 3D graphics, volume rendering and visualization. VTK includes many advanced a

Kitware, Inc. 2k Nov 28, 2022
📽 Highly Optimized Graphics Math (glm) for C

?? OpenGL Mathematics (glm) for C Documentation Almost all functions (inline versions) and parameters are documented inside the corresponding headers.

Recep Aslantas 1.5k Dec 2, 2022
A library for high-performance, modern 2D graphics with SDL written in C.

SDL_gpu, a library for making hardware-accelerated 2D graphics easy. by Jonathan Dearborn SDL_gpu is licensed under the terms of the MIT License. See

Jonathan Dearborn 1.1k Nov 30, 2022
VE Font Cache is a single header-only GPU font rendering library designed for game engines.

VE Font Cache is a single header-only GPU font rendering library designed for game engines. It aims to: Be fast and simple to integrate. Take advantag

Xi Ma Chen 341 Oct 17, 2022
Mach is a game engine & graphics toolkit for the future.

Mach engine ⚠️ Project status: in-development ⚠️ Under heavy development, not ready for use currently. Follow @machengine on Twitter for updates. Zero

Hexops 1.4k Nov 25, 2022
Engine-3D is a 3D-Graphics Renderer built from scratch in C++

Engine3D Engine-3D is a 3D-Graphics Renderer built from scratch in C++, as an Undergraduate Computer Engineering Project for 5th Semester, assigned by

Chirag Lamsal 3 Oct 24, 2022
Care race game built in c++ with sfml. this project is done in 3rd semester of csit for demonstration of computer graphics.

Car Race Car race is simple game which has been built by using SFML in c++ implementing concepts of Computer Graphics for project Work of 3rd semester

subash kc 4 Dec 18, 2021
A minecraft clone built in c++ opengl for the purpose of prefecting graphics programming skills.

LearnOpenGL - CLion This is a project template for OpenGL development with JetBrains CLion IDE. It was created mainly for LearnOpenGL tutorials. Inclu

Jeremy Dellock 1 Dec 28, 2021
Yet another approach to developing a personal 3D graphics engine. Windows + Direct3D 12.

RegEngine Yet another approach to developing a personal 3D graphics engine. Windows + Direct3D 12. Work in progress... Nothing to see here. I just ren

Adam Sawicki 21 Nov 3, 2022
DigitalVox4 - Metal Graphics Engine

DigitalVox is the name of a series. Although each version is based on a component system, the specific implementation is very different. Therefore, different code repositories are used for management.

yangfengzzz 8 Jun 11, 2022
Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

EnTT is a header-only, tiny and easy to use library for game programming and much more written in modern C++. Among others, it's used in Minecraft by

Michele Caini 7.4k Nov 22, 2022
Gaming meets modern C++ - a fast and reliable entity-component system (ECS) and much more

EnTT is a header-only, tiny and easy to use entity-component system (and much more) written in modern C++. Among others, it's also used in Minecraft by Mojang and The Forge by Confetti.

Sean Middleditch 8 Feb 16, 2021
A Tiny 2D OpenGL based C++ Game Engine that is fast, lightweight and comes with a level editor.

A Tiny 2D OpenGL based C++ Game Engine that is fast, lightweight and comes with a level editor.

Samuel Rasquinha 56 Nov 28, 2022
Ultralight is an ultra-fast, ultra-light, standards-compliant HTML renderer for applications and games.

Ultralight is an ultra-fast, ultra-light, standards-compliant HTML renderer for applications and games. It supports most modern HTML5, CSS, and JavaScript features while still remaining light in binary size and memory usage.

Ultralight 4.1k Nov 27, 2022
A fast entity component system (ECS) for C & C++

Flecs is a fast and lightweight Entity Component System with a focus on high performance game development (join the Discord!). Highlights of the frame

Sander Mertens 3.4k Nov 25, 2022
Simple, fast, easy to get started mid-level game engine written in Zig

Alka Game engine written in zig, compatible with master branch. This engine does provide a toolset for you but generally you have to implement how the

Kiakra 22 Oct 23, 2022
A simple localization framework that can re-localize in built maps based on FAST-LIO.

Realtime 3D global localization in a pre-built point cloud map. By fusing low-frequency global localization (about 0.5~0.2Hz), and high-frequency odometry from FAST-LIO, the entire system is computationally efficient.

KINO 238 Dec 3, 2022
MotorMC is a blazing fast, multi threaded, asynchronous Minecraft server software

MotorMC is a blazing fast, multi threaded, asynchronous Minecraft server software that aims to handle many players (1000+) on a single world while still providing an experience as close to vanilla Minecraft as possible.

Garet Halliday 73 Nov 9, 2022
Real-time Water - Fast Water Simulation for Games Using Height Fields

In this project a water-simulation was implemented based on the approach suggested in the presentation "Fast Water Simulation for Game

Henrik Patjens 137 Jun 4, 2022