|
1 | 1 | # Pathfinder C++ |
2 | 2 |
|
3 | | -This is a C++ port of [Pathfinder 3](https://github.com/servo/pathfinder) with a Vulkan backend added. |
| 3 | +[](LICENSE) |
| 4 | +[](https://en.wikipedia.org/wiki/C%2B%2B14) |
4 | 5 |
|
5 | | -## Requirements |
| 6 | +A high-performance, GPU-accelerated 2D vector graphics library, ported from the original Rust implementation of [Pathfinder 3](https://github.com/servo/pathfinder). This version brings the power of massivly parallel vector rasterization to the C++ ecosystem, with native **Vulkan**, **OpenGL**, and **Metal** backends. |
6 | 7 |
|
7 | | -* C++14. |
8 | | -* Hybrid mode: `Vulkan` / `OpenGL 3.3 (or higher)` / `OpenGL ES 3.0 (or higher)` / `WebGL2`. |
9 | | -* GpuDriven mode: `Vulkan` / `OpenGL 4.3 (or higher)` / `OpenGL ES 3.1 (or higher)`. |
| 8 | +## 🚀 Key Features |
10 | 9 |
|
11 | | -Notable: The GpuDriven mode has some limits in an OpenGL ES context because, for ES, it's impossible to read & write |
12 | | -the same image in a single compute invocation. |
| 10 | +* **Massively Parallel Rasterization**: Leverages the GPU to rasterize complex vector scenes at high speeds. |
| 11 | +* **Dual Rendering Strategies**: |
| 12 | + * **Hybrid Mode**: CPU-assisted binning with hardware rasterization. Optimized for mobile devices and static path caching. |
| 13 | + * **GPU-Driven Mode**: Full compute-shader-based pipeline. Minimizes CPU overhead by moving binning and tiling entirely to the GPU. |
| 14 | +* **Advanced Effects**: Native support for shadows, blurs, gradients, and complex clipping paths. |
| 15 | +* **Cross-Platform**: Designed for Windows, Linux, macOS, Android, and Web (Wasm). |
13 | 16 |
|
14 | | -## Run demo |
| 17 | +## 🛠 Supported Backends |
15 | 18 |
|
16 | | -### Shader generation (Optional) |
| 19 | +| Backend | Hybrid Mode | GPU-Driven Mode | Notes | |
| 20 | +| :--- | :---: | :---: | :--- | |
| 21 | +| **Vulkan** | ✅ | ✅ | Best performance | |
| 22 | +| **OpenGL 4.3+** | ✅ | ✅ | Desktop standard | |
| 23 | +| **OpenGL ES 3.1+** | ✅ | ✅* | *Limited by Storage Image access on some ES devices | |
| 24 | +| **OpenGL ES 3.0** | ✅ | ❌ | Compatibility mode | |
| 25 | +| **WebGL2** | ✅ | ❌ | Web target | |
17 | 26 |
|
18 | | -* Run `src/shaders/compile_and_convert.ps1` to generate embedded shader headers. You should have Vulkan SDK installed |
19 | | - first. |
| 27 | +## 📦 Getting Started |
20 | 28 |
|
21 | | -### Windows / Linux / Mac |
| 29 | +### Prerequisites |
| 30 | +* C++14 compatible compiler. |
| 31 | +* CMake 3.15+. |
| 32 | +* Vulkan SDK (if building with Vulkan support or regenerating shaders). |
22 | 33 |
|
23 | | -* Initialize submodules. |
24 | | -* Build and run the CMake project `demo/native/CMakeList.txt`. |
| 34 | +### Building the Library |
| 35 | +```bash |
| 36 | +git clone --recursive https://github.com/your-repo/pathfinder-cpp.git |
| 37 | +cd pathfinder-cpp |
| 38 | +mkdir build && cd build |
| 39 | +cmake .. |
| 40 | +make |
| 41 | +``` |
25 | 42 |
|
26 | | -### Android |
| 43 | +## 🎮 Demos |
| 44 | + |
| 45 | +### Windows / Linux / macOS |
| 46 | +The native demo uses a common application framework. |
| 47 | +1. Initialize submodules: `git submodule update --init --recursive`. |
| 48 | +2. Open the project in your favorite IDE (CLion, VS) and run the `demo` target. |
27 | 49 |
|
28 | | -* Copy `assets` into `demo/android/app/src/main`. |
29 | | -* Open `demo/android` in Android Studio. |
30 | | -* Build and run. |
| 50 | +### Android |
| 51 | +1. Copy `assets` into `demo/android/app/src/main`. |
| 52 | +2. Open `demo/android` in Android Studio. |
| 53 | +3. Deploy to a device supporting GLES 3.0+. |
31 | 54 |
|
32 | | -### Web |
| 55 | +### Web (Emscripten) |
| 56 | +1. Set up the Emscripten environment. |
| 57 | +2. Run `./build_wasm.sh`. |
| 58 | +3. Run `./demo/web/serve.sh` and visit `http://127.0.0.1:8000`. |
33 | 59 |
|
34 | | -* Set up emscripten environment. |
35 | | -* Run `build_wasm.sh` to build the demo. |
36 | | -* Run `demo/web/serve.sh` to serve a local website. |
37 | | -* Open http://127.0.0.1:8000/. |
| 60 | +## 📜 Acknowledgments |
| 61 | +This project is a port of the [Pathfinder](https://github.com/servo/pathfinder) engine developed by the Servo project. |
0 commit comments