Fast UI Draw is a library that provides a higher performance Canvas interface.

Related tags

GUI fastuidraw
Overview

Fast UI Draw

Fast UI Draw is a library that provides a higher performance Canvas interface. It is designed so that it always draws using a GPU.

In contrast to many common implementations of Canvas drawing, Fast UI Draw has that changes in clipping are very cheap and optimized for GPU's. In addition, Fast UI Draw has, with the GL backend, very few pipeline states. Indeed an API trace of an application using Fast UI Draw will see only a handful of draw calls per frame, even under high Canvas state trashing, and high clip state changes. Indeed, for the GL backend, only one Canvas state change invokes a pipeline state change: changing the blend mode.

In addition, Fast UI Draw gives an application the ability to make their own shaders for custom drawing.

Documentation

Fast UI Draw uses doxygen for documentation, build and view documentation by:

  • make docs
  • xdg-open docs/html/index.html

The documentation is available online here.

GL requirements

The GL backend requires GL version 3.3. To support the blend modes beyond those of Porter-Duff blend modes either GL_EXT_shader_framebuffer_fetch or GL_ARB_shader_image_load_store with one of GL_INTEL_fragment_shader_ordering, GL_ARB_fragment_shader_interlock or GL_NV_fragment_shader_interlock is required.

The GLES backend requires GLES version 3.0. If the GLES version is 3.0 or 3.1, it is strongly recommended that one of the extension GL_OES_texture_buffer or GL_EXT_texture_buffer is present. For GLES 3.0, 3.1 and 3.2, it is strongly recommended for performance to have GL_APPLE_clip_distance or GL_EXT_clip_cull_distance. To support the blend modes beyond those of Porter-Duff blend modes either GL_EXT_shader_framebuffer_fetch or GLES 3.1 with GL_NV_fragment_shader_interlock is required. The Porter-Duff composition modes do not require any extensions though, but the extension GL_EXT_blend_func_extended will improve performance.

Intel GPU's starting in IvyBridge have the extensions support for optimal performance with all blend modes in both GL and GLES for recent enough versions of Mesa. For MS-Windows, the Intel drivers for Intel GPU's also have support for optimal performance with all blend modes.

Building requirements

  • GNU Make
  • g++ (clang should be fine too)
  • freetype
  • flex
  • perl
  • up to date GL (and GLES) headers
    • You need
    • The expected place of those headers is set by setting the environmental variable GL_INCLUDEPATH; if the value is not set, the build system will guess a value. The name of the header files is controlled by the environmental variables GL_RAW_HEADER_FILES for GL and GLES_RAW_HEADER_FILES for GLES. If a value is not set, reasonable defaults are used.
  • SDL 2.0 and SDL Image 2.0 (demos only)
  • doxygen (for documentation)

Building

"make targets" to see all build targets and the list of environmental variables that control what is built and how. On MS-Windows, the helper library NEGL is NOT built by default and on other platforms it is.

MacOS build is possible, but is NOT done with the GL headers that are included in MacOS. Instead copy the needed Khronos headers to /usr/local/include with the tree intact, i.e. copy GL/glcorearb.h from the Khronos registry to /usr/local/include/GL/glcorearb.h and copy KHR/khrplatform.h to /usr/local/include/KHR/khrplatform.h. Then the build process will work (the build system defaults GL_INCLUDEPATH to /usr/local/include on OS-X). Yes, this is a hack.

Running Demos

The demos (naturally) link against the FastUIDraw libraries, thus they need to be in the library path. For Unix platforms, this is done by appending the path where the libraries are located to LD_LIBRARY_PATH. A simple quick hack is to do export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH. All demos have options which can be see by passing --help as the one and only command line option to the demo.

Installing

Doing "make INSTALL_LOCATION=/path/to/install/to install" will install fastuidraw to the named path. Demos are NOT installed! The default value of INSTALL_LOCATION is /usr/local, change as one sees fit. Placement is as follows:

  • INSTALL_LOCATION/lib: libraries
  • INSTALL_LOCATION/lib/pkgconfig: pkg-config files
  • INSTALL_LOCATION/include: header files
  • INSTALL_LOCATION/bin: fastuidraw-config script (and .dll's for MinGW)
  • INSTALL_LOCATION/share/doc/fastuidraw: documentation

Using project

After installation, the script, fastuidraw-config, is available and copied to INSTALL_LOCATION/bin. Use the script to get linker and compile flags for building an application. Alternatively, one can also use pkg-config.

Notes

  • FastUIDraw has the main meat in libFastUIDraw, there are two variants the release and debug version whose pkg-config module names are fastuidraw-release and fastuidraw-debug.
  • The GL backend of FastUIDraw is libFastUIDrawGL, there are two variants the release and debug version whose pkg-config module names are fastuidrawGL-release and fastuidrawGL-debug.
  • The GLES backend of FastUIDraw is libFastUIDrawGLES, there are two variants the release and debug version whose pkg-config module names are fastuidrawGLES-release and fastuidrawGLES-debug.
  • The debug and release versions of the libraries should not be mixed; if you are building for release, then use the release versions and the release flags. If you are building for debug use the debug libraries and the debug flags. One can get the flag values by using either pkg-config or the script fastuidraw-config.

Successfully builds under

Comments
  • Artifacts with shader-based anti-aliasing filling

    Artifacts with shader-based anti-aliasing filling

    Steps to reproduce:

    1. run one of the demos with ./painter-path-test-GL-release fill_alpha=0.5
    2. press f key to toggle filling on
    3. hold [ key until the stroke width is set to 0

    Then one can see the following: artifacts

    opened by ChengCat 31
  • std::min requires #include <algorithm>

    std::min requires #include

    I am not sure if you care about osx at this early stage but i tried to build it and had some errors the first of which

    src/fastuidraw/painter/painter_brush.cpp:268:36: error: no member named 'min' in namespace 'std'; did you mean 'fmin'? static_cast(std::min(im->slack() + 1, ^~~~~~~~ fmin

    This can be resolved by including in painter_brush.cpp (or in painter_brush.hpp)

    opened by xzcvczx 20
  • Possible high cpu usage drawing lines ?

    Possible high cpu usage drawing lines ?

    Trying a test I have previously done with the nanovg library I found that the cpu usage of fastuidraw is about 7 times higher in this particular test. Please see the attached screenshots. Both tests were compiled with gcc 7.4.0 in release mode (-O3) and I am using fastuidraw release libraries.

    The fastuidraw test code is here. The nanovg test code is here.

    It was curious that the fastuidraw cpu load started low but after a few seconds it stabilized in about 29%. Both tests were executed with no major applications running in the machine (only system services).

    Any ideas on how to modify the test to lower fastuidraw cpu load ?

    nanovg_lines fastuidraw_lines

    opened by leonsal 13
  • Reference counting assertion m_p failed

    Reference counting assertion m_p failed

    Hi,

    I build fastuidraw in Linux (Manjaro) and all build processes finished successful but when running demos, all of them failed and write below message to terminal output.

    inc/fastuidraw/util/reference_counted.hpp:194: Assertion 'm_p' failed Aborted (core dumped)

    opened by mohsenti 13
  • Fails to compile on Windows (MinGW64)

    Fails to compile on Windows (MinGW64)

    The makefile does not detect MinGW64 on Windows. After manually overriding compiler detection it fails to link the dll. The link command exceeds the windows command line limit of 8192 characters.

    opened by nidefawl 8
  • C++11 upgrade

    C++11 upgrade

    I saw the post in webkit-dev and started looking fastuidraw. That's super awesome!

    Looking through the code, the use of the boost library is fairly limited. If we can enable C++11, I think we can replace the part of them with the std's ones. For example, threading primitives can be replaced.

    What do you think of using C++11 in the fastuidraw code base?

    opened by Constellation 7
  • benchmarks source codes

    benchmarks source codes

    Hello sorry this isn't issue but can you share source code of your benchmars that you use in your XDC2016 presentation As I would like to see why Qt scenegraph is slower then fast ui draw Thx

    opened by xlazom00 7
  • Fixes required for building under macOS

    Fixes required for building under macOS

    Just to let you know, I built this library with the following fixes under macOS High Sierra:

    • add include for string in 'src/fastuidraw/text/glyph_selector.cpp'
    • replace 'soname' in all the makefiles under make/ with 'install_name'

    The first fix is trivial, the second one not so, I see you have already a CMake build in the process, so that might fix the soname issue also.

    With this at least the base library libFastUIDraw target builds succesfully. The backends I did not get yet compiling due to different GL headers.

    Would be interested in seeing this run on macOS too. Let's see if I get the macOs version running, I see you already had somebody do that on an older version, I'll try that.

    opened by Sakari369 6
  • OSX build fails

    OSX build fails

    Hi, maybe it's not intended to run on OSX but for now the errors look mostly like C++ errors:

    mac-pro:fastuidraw robby$ make demos-GL-release
    c++ -O3 -fstrict-aliasing -Wall -Wextra -Wcast-qual -Wwrite-strings -Iinc `freetype-config --cflags` -std=c++11 -D_USE_MATH_DEFINES -fPIC -c src/fastuidraw/util/static_resource.cpp -o release/src/fastuidraw/util/static_resource.o
    src/fastuidraw/util/static_resource.cpp:52:15: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>,
          std::__1::allocator<char> >'
      std::string sresource_label(presource_label);
                  ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
        class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                    ^
    src/fastuidraw/util/static_resource.cpp:65:15: error: implicit instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>,
          std::__1::allocator<char> >'
      std::string sresource_label(presource_label);
                  ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
        class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                    ^
    In file included from src/fastuidraw/util/static_resource.cpp:21:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:438:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tree:16:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:604:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:258:9: error: implicit instantiation of
          undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
        _T1 first;
            ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:624:16: note: in instantiation of template class
          'std::__1::pair<const std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::vector<unsigned char,
          std::__1::allocator<unsigned char> > >' requested here
        value_type __cc;
                   ^
    src/fastuidraw/util/static_resource.cpp:70:11: note: in instantiation of template class 'std::__1::__value_type<std::__1::basic_string<char,
          std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >' requested here
      if(iter != hoard().m_data.end())
              ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
        class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                    ^
    In file included from src/fastuidraw/util/static_resource.cpp:21:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:438:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__tree:16:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:604:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:258:9: error: implicit instantiation of
          undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >'
        _T1 first;
            ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:625:21: note: in instantiation of template class
          'std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::vector<unsigned char,
          std::__1::allocator<unsigned char> > >' requested here
        __nc_value_type __nc;
                        ^
    src/fastuidraw/util/static_resource.cpp:70:11: note: in instantiation of template class 'std::__1::__value_type<std::__1::basic_string<char,
          std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::vector<unsigned char, std::__1::allocator<unsigned char> > >' requested here
      if(iter != hoard().m_data.end())
              ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iosfwd:193:33: note: template is declared here
        class _LIBCPP_TYPE_VIS_ONLY basic_string;
                                    ^
    4 errors generated.
    make: *** [release/src/fastuidraw/util/static_resource.o] Error 1
    mac-pro:fastuidraw robby$
    ´´´
    
    opened by Robert-M-Muench 6
  • Could not set the background color

    Could not set the background color

    Hi,

    In my tests after generating the drawing commands for several rectangles, the framebuffer is cleared to white, but the background of my window remains black. Please see the screenshot.

    Commands executed after drawing the rectangles:

    ...
    mPainter->end();
    // Make sure we are rendering to the default fraembuffer of GL
    fastuidraw_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
    
    // Clear the framebuffer
    fastuidraw_glClearColor(1.0, 1.0, 1.0, 1.0);
    fastuidraw_glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    
    // blit the contents of m_surface to the default framebuffer with nearest filtering
    mSurface->blit_surface(GL_NEAREST);
    ...
    

    Any ideas of what could be wrong ?

    opened by leonsal 5
  • Build system does not find SDL headers on vanilla Arch Linux

    Build system does not find SDL headers on vanilla Arch Linux

    I have sdl installed but build system does not see includes out of the box. Headers in Arch Linux are in /usr/include/SDL . I modified some "base" makefile to include it in include paths and I got one demo to go through, but then next example complains again :-). Which makefile is proper place to add sdl so the path is included in all demos, lib etc?

    opened by amno1 5
  • How can I compile in 64bit?

    How can I compile in 64bit?

    Windows MSYS2

    The static libs seem to be 32bit, I don't see an obvious way to change it, or any mention of x64 anywhere, but when trying to force a -m64 into the makefile I get "cc1plus.exe: sorry, unimplemented: 64-bit mode not compiled in".

    What's going on? Is this not possible to compile in 64bit mode? Or is my environment messed up?

    opened by MintPaw 1
  • New SPIR SPV_INTEL_vector_compute extension

    New SPIR SPV_INTEL_vector_compute extension

    https://www.phoronix.com/scan.php?page=news_item&px=Intel-IGC-Vector-Backend

    https://github.com/intel/llvm/pull/1612/files

    This could revolutionize 2D rendering performance (and/or efficiency) on Intel igpus (most of the market) so you should keep an eye on it :}

    opened by LifeIsStrange 0
  • Evaluating fastuidraw for VCV Rack

    Evaluating fastuidraw for VCV Rack

    Hello! I'm currently evaluating replacing NanoVG with fastuidraw in VCV Rack v3, scheduled for development in late 2020 and release early 2021. (Yes, we plan that far ahead.) I haven't seen a lot of talk about fastuidraw in the wild, but it looks beautifully designed, and at first glance delivers what it "advertises".

    It would be greatly appreciated if anyone can answer any or all of these questions.

    • Does this project have any funding sources? (Intel funding?)
    • Does this project have a funding sink? (A place where I can throw money for maintainers to solve problems or push the project in some direction)
    • What is the future of this project? NanoVG's maintainer Mikko seems to have moved on, and while NanoVG can be adopted by someone (re-adopted by Mikko) with enough funding, my first impression of fastuidraw is that it may be years ahead of NanoVG's rendering performance and capability.
    • Who maintains this project? @krogueintel or a manager at Intel? I don't see a lot of discussions anywhere, so it seems like most planning is in @krogueintel's mind. (No problem with that at all. VCV operates smoothly this way.)
    • 25-50 of the ~170 plugins for VCV Rack, each maintained by a different developer, call the NanoVG API directly (because I include nanovg.h in the Rack SDK), so functions as simple as nvgRect(vg, x, y, w, h) and as complicated as nvgRadialGradient(vg, cx, cy, innerradius, outerradius, innercolor, outercolor) would need to be wrapped to fastuidraw, to avoid breaking those plugins. Since both libraries attempt to follow HTML5's canvas API loosely, this would probably take at most a week. I guess this isn't a question but just a comment.
    • An open ended question: VCV Rack renders a huge number of paths per frame, and everything else is rendered to framebuffers to reduce this number (which are then rendered as images in the scene graph along with the other non-cached paths). VCV Rack runs on Mac/Windows/Linux and currently has graphics performance problems for users with weaker GPUs (e.g. pretty much any Macbook). Is fastuidraw an appropriate choice this project in your opinion?

    Apologies if I come across as a bit pushy with all these questions.

    opened by AndrewBelt 6
  • State of chromium integration

    State of chromium integration

    Hi! This project is fascinating. I was wondering when will we be able to test it on chromium?

    I've seen no update from this https://groups.google.com/a/chromium.org/forum/m/#!topic/graphics-dev/h6BZF5nPdQw

    Additional questions: Is the chromium integration made with or without skia? Are there new benchmarck since the recent 1.0 release? How much does this compare to blend2d, skia, NV path, direct2d, and webrender performance wise? Are there benchmarcks on power consumption too?

    How much is fastuidraw feature complete? Can it fully implement canvas? SVG? Text ? CSS ?

    Also what is the roadmap? New performance ideas? (Vulkan, AVX 512, OpenMP 5 / openacc?)

    opened by LifeIsStrange 2
Releases(1.0)
Owner
Intel Corporation
Intel Corporation
RmlUi - The HTML/CSS User Interface library evolved

RmlUi - The HTML/CSS User Interface Library Evolved RmlUi - now with added boosters taking control of the rocket, targeting your games and application

Michael R. P. Ragazzon 1.5k Nov 24, 2022
ImTui: Immediate Mode Text-based User Interface C++ Library

ImTui is an immediate mode text-based user interface library. Supports 256 ANSI colors and mouse/keyboard input.

Georgi Gerganov 2.1k Nov 30, 2022
Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids.

Latte is a dock based on plasma frameworks that provides an elegant and intuitive experience for your tasks and plasmoids. It animates its contents by using parabolic zoom effect and trys to be there only when it is needed.

KDE GitHub Mirror 1.3k Nov 30, 2022
win-vind provides a lightweight hybrid UI system of CUI and GUI for Windows

win-vind provides a lightweight hybrid UI system of CUI and GUI for Windows. And everything is inspired by Vim and its plugins. Simply put, it is a Vim-oriented toy box consisting of various useful features.

pit-ray 936 Nov 29, 2022
GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features.

GacUI GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features. Read the LICENSE first

Vczh Libraries 2.1k Nov 25, 2022
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addit

omar 43.5k Nov 26, 2022
ROS_Melodic_Qt_GUI_Template is a Graphical User Interface programmed with Qt framework.

This is a GUI template for ros to control your robot and read data from sensors.

null 28 Nov 15, 2022
AnUI is a powerful Graphical User Interface framework made for people that actually care about design!

What's AuUI ** Project is not finished ** AuUI, an abbreviation for "Actual Understandable User Interface" is a graphical user interface framework to

Goat 4 Jun 17, 2022
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain

This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output.

Micha Mettke 13.5k Dec 1, 2022
A simple/fast stacking box layout library. It's useful for calculating layouts for things like 2D user interfaces.

A simple/fast stacking box layout library. It's useful for calculating layouts for things like 2D user interfaces. It compiles as C99 or C++. It's tested with gcc (mingw64), VS2015, and clang/LLVM. You only need one file to use it in your own project: layout.h.

Andrew Richards 710 Nov 24, 2022
XClicker - Fast gui autoclicker for x11 linux desktops

What is XClicker? XClicker is an open-source, easy to use, feature-rich, blazing fast Autoclicker for linux desktops using x11. Main features Fairly s

Robiot 285 Nov 26, 2022
WMBar is a window manager agnostic status bar that aims to be lightweight, simple, extensible/modular and fast.

WMBar is a window manager agnostic status bar that aims to be lightweight, simple, extensible/modular and fast.

WMBar 1 Nov 27, 2021
A powerful and fast search tool using regular expressions

A powerful and fast search tool using regular expressions

Stefan Küng 1.3k Nov 28, 2022
Fast, flexible and simple GUI.

MyGUI is a cross-platform library for creating graphical user interfaces (GUIs) for games and 3D applications. Website: http://mygui.info/ There you c

null 624 Dec 2, 2022
FLTK - Fast Light Tool Kit - a cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11)

FLTK - Fast Light Tool Kit - a cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11)

The FLTK Team 1k Dec 3, 2022
Elements C++ GUI library

Elements C++ GUI library Introduction Elements is a lightweight, fine-grained, resolution independent, modular GUI library. Elements is designed with

Cycfi Research 2.4k Nov 30, 2022
Simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports.

libui: a portable GUI library for C This README is being written. Status It has come to my attention that I have not been particularly clear about how

Pietro Gagliardi 10.4k Dec 2, 2022
Minimalistic C++/Python GUI library for OpenGL, GLES2/3, Metal, and WebAssembly/WebGL

NanoGUI NanoGUI is a minimalistic cross-platform widget library for OpenGL 3+, GLES 2/3, and Metal. It supports automatic layout generation, stateful

Mitsuba Physically Based Renderer 1.1k Nov 25, 2022
A single-header ANSI C immediate mode cross-platform GUI library

Nuklear This is a minimal-state, immediate-mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed a

Immediate Mode UIs, Nuklear, etc. 6.3k Dec 2, 2022