• Stars
    star
    647
  • Rank 69,297 (Top 2 %)
  • Language
    C
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Vulkan 2D graphics library


vkvg

Vulkan Vector Graphics

vkvg is an open-source 2D graphics library written in C using Vulkan as backend. The API follows the same pattern as Cairo, but new functions and original drawing mechanics may be added.

vkvg is in alpha development stage and the core api is mostly stabilized. All contributions are welcome.

In progress API documentation is available online at http://vkvg.org.

Performance comparison


major libs perf comparison

Current status:

  • Fill (stencil even-odd, non-zero).
  • Stroke.
  • Basic painting operation.
  • Font system with caching operational.
  • Linear/Radial Gradients.
  • Line caps and joins.
  • Dashes.
  • Context should be thread safe, extensive tests required.
  • Image loading and writing with stb lib
  • Test includes svg rendering either with built-in renderer or nanoSVG

Requirements:

  • CMake: version >= 3.16
  • Vulkan: version >= 1.1
  • FontConfig: optional, without fontconfig, use vkvg_load_font_from_path.
  • Freetype: optional, stb_truetype as alternative.
  • Harfbuzz: optional, without complex text shaping may be wrong.
  • GLSLC: spirv compiler, included in LunarG SDK: compile shader to spir-V (building only, optional)
  • xxd: generate headers with precompiled shaders (building only, optional)
  • GLFW: optional, if present tests are built.

if glslc or xxd are not present, a precompiled version of the shaders is stored in the git tree.

Building

#fetch sources from github
git clone --recursive https://github.com/jpbruyere/vkvg.git
cd vkvg
# Create build directory
mkdir build
cd build
# Run CMake configuration
cmake ..

CMake configure options

Core library options:
  • -DVKVG_USE_GLUTESS=true: Use embedded glu tesselator to fill polygones in NON-ZERO mode. If false, a simple ear clipping algorithm is used.
  • -DVKVG_SVG=true: Enable experimental svg renderer. If false, use nanoSVG.
  • -DVKVG_RECORDING=true: Enable experimental draw commands recording infrastructure.
  • -DVKVG_BUILD_DOCS=true: Build documentation if doxygen is found.
Vulkan Features:
  • -DVKVG_ENABLE_VK_SCALAR_BLOCK_LAYOUT=true: Enable VK_EXT_scalar_block_layout that reduce structure padding for gpu.
  • -VKVG_ENABLE_VK_TIMELINE_SEMAPHORE=true: Enable experimental work syncing with VK_KHR_timeline_semaphore instead of Fences.
Text rendering libraries:

Those libraries are enabled by default, but disabled if not found.

  • -DVKVG_USE_FONTCONFIG=true: enable FontConfig to resolve font's names.
  • -DVKVG_USE_FREETYPE=true: enable FreeType to render glyphs, if false glyphs are rendered with stb_truetype.
  • -DVKVG_USE_HARFBUZZ=true: enable harfbuzz for text shaping.
Tests options:
  • -DVKVG_BUILD_TESTS=true: build all tests in the tests forlder.
  • -DVKVG_TEST_DIRECT_DRAW=true: enable drawing directly on the swapchain images.
Debugging options:

If vkvg is compiled with CMAKE_BUILD_TYPE=Debug, several additional options are made available to help debugging:

  • -DENABLE_VALIDATION=true: enable vulkan validation layer.
  • -DENABLE_DBG_UTILS=true: enable various vulkan debug utils extensions features.
  • -DENABLE_RENDERDOC=true: enable renderdoc layer.
  • -DENABLE_WIRED_FILL=true: enable rendering in wired mode, current mode is controled with the global variable vkvg_wired_debug.
  • -DENABLE_PROFILING=true: add -pg to the compile options.
  • -DVKVG_DBG_STATS=true: store various context statistics fetchable with vkvg_device_get_stats()
cmake --build .

A detailed tutorial is available for Windows.

Running tests

Append the -h option to see available command line parameters.

Contributing

See the contribution guide for more information.

Join us on gitter for any question.

Addtitional Credits

Change log

  • v0.2.0
    • radial gradients.
    • better stroke joins handling.
    • png saved in srgb format.
    • doxygen cmake target and style

To Do

  • Use Scissor where possible.
  • Improve stroke algorithms.
  • Radial gradients.
  • Dashed lines.
  • Operators.
  • Optimize vulkan memory allocations by sub-allocating from a single shared memory chunk per type.
  • Optimize command submissions.
  • Test SDF font rendering.
  • Avoid line joins inside curves and arc.
  • Structured unit testing.
  • Perf and memory checks.
  • Code cleanup and comments.
  • Documentations.

More Repositories

1

Crow

C# Rapid Open Widgets
C#
57
star
2

vk.net

Vulkan binding for .net
C#
31
star
3

vkhelpers

Vulkan c helper library
C++
28
star
4

vke.net

Vulkan .net library
C#
13
star
5

vgperf

Vector graphic libraries performances tests
C
6
star
6

shaderc.net

shaderc net binding
C#
5
star
7

VkChess.net

3D Stockfish Chess client powered by Vulkan
C#
4
star
8

vkChess

vulkan stockfish client
C++
4
star
9

speed-dreams

Racing car simulation
C++
4
star
10

glfw-sharp

GLFW3 binding for C#, derived from 'https://github.com/FacticiusVir/SharpVk.git'
C#
3
star
11

Chess

3D Chess client using Stockfish
C#
3
star
12

DRI.net

C# Bindings for the Linux Direct Rendering Infrastructure (DRI)
C#
3
star
13

Doxy2MD

Doxygen XML to GitHub MarkUp converter
C#
2
star
14

GGL

Game GL library
C#
2
star
15

vkvg.net

c# bindings for vkvg
C#
2
star
16

GLStudio

OpenGL studio using Crow toolkit
C#
2
star
17

CrowEdit

Extensible text editor using C.R.O.W. for the interface.
C#
2
star
18

VkCrowWindow

vke application with C.R.O.W. gui enabled
C#
1
star
19

vkbase

vulkan c++ base classes mostly imported from Sacha Willem examples
C++
1
star
20

Opuz

OpenGL puzzle game
C#
1
star
21

MagicCrow

MTG in 3d for extensive crow library testing
C#
1
star
22

libcrow

c rapid open widget
C
1
star
23

CrowIDE

C#
1
star
24

Magic3D

Stupid card game developped for programming skill's improvment
C#
1
star
25

VkvgPainter

C#
1
star
26

vke

C++
1
star
27

vkvg-svg

vkvg svg parser and renderer
C
1
star
28

DllMapCore

native library resolver based on mono dllmap for netcore
C#
1
star
29

XMLToolsLibrary

DTD parser, XML parser, et code generator. Developped for personal learning.
C#
1
star
30

vkvg_minimal_app

minimal vkvg application with glfw
CMake
1
star
31

MonoDevelop.ImageViewer

Image viewer addin for MonoDevelop. Use image preview as icon in project pad, and open image in a simple viewer.
C#
1
star
32

vkmonocrow

mono with crow and cairo bindings embeded in vulkan c app
C
1
star