Vrmac
vello
Our great sponsors
Vrmac | vello | |
---|---|---|
45 | 31 | |
104 | 1,873 | |
- | 11.1% | |
3.6 | 9.4 | |
over 2 years ago | 2 days ago | |
C# | Rust | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Vrmac
-
New Renderers for GTK
Couple times in the past I have implemented GPU-targeted GUI renderers, here’s an example: https://github.com/Const-me/Vrmac?tab=readme-ov-file#vector-... https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/VAA...
2D graphics have very little in common with game engines. The problem is very different in many regards. In 2D, you generally have Bezier and other splines on input, large amount of overdraw, textures coming from users complicate VRAM memory management. OTOH, game engines are solving hard problem which are irrelevant to 2D renderers, like dynamic lighting, volumetric effects, and dynamic environment.
-
Was Rust Worth It?
I think Java is only good for long-running servers.
Java doesn’t support C interop. For many desktop and embedded projects this is a showstopper, here’s an example https://github.com/Const-me/Vrmac/tree/master/VrmacVideo That C# code directly consumes V4L2 and ASIO Linux kernel APIs, and calls unmanaged user-mode DLLs like libfdk-aac.so and liba52-0.7.4.so.
Native stack and value types in C# reduce load on GC, and the number of complicated tricks required from JIT compiler. This in turn helps with startup performance. This is critical for command-line apps, and very desirable for desktop apps.
Another thing missing in Java is intrinsics support, both scalar like popcnt, bitscan, BMI, etc., and SIMD like SSE and AVX.
> Part of Panama
Most real-live C APIs are using function pointers and/or complicated data structures. Here’s couple real-life examples defined by Linux kernel developers who made V4L2 API: [0], [1] The first of them contains a union in C version, i.e. different structures are at the same memory addresses. Note C# delivers the level of usability similar to C or C++: we simply define structures, and access these fields. Not sure this is gonna be easy in Java even after all these proposals arrive.
For a managed runtime, unmanaged interop is a huge feature which affects all levels of the stack: type system in the language for value types, GC to be able to temporarily pin objects passed to native code (making copies is prohibitively slow for use cases like video processing), code generator to convert managed delegates to C function pointers and vice versa, error handling to automatically convert between exceptions and integer status codes at the API boundary, and more. Gonna be very hard to add into the existing language like Java.
> "Vector API" JEP
That API is not good. They don’t expose hardware instructions, instead they have invented some platform-agnostic API and implemented graceful degradation.
This means the applicability is likely to be limited to pure vertical operations processing FP32 or FP64 numbers. The rest of the SIMD instructions are too different between architectures. A simple example in C++ is [2], see [3] for the context. That example is trivial to port to modern C#, but impossible to port to Java even after the proposed changes. The key part of the implementation is psadbw instruction, which is very specific to SSE2/AVX2 and these vector APIs don’t have an equivalent. Apart from reduction, other problematic operations are shuffles, saturating integer math, and some memory access patterns (gathers in AVX2, transposed loads/stores on NEON).
> most of these are not done / not in a stable LTS Java release yet
BTW, SIMD intrinsics arrived to C# in 2019 (.NET Core 3.0 released in 2019), and unmanaged interop support is available since the very first 1.0 version.
[0] https://github.com/Const-me/Vrmac/blob/master/VrmacVideo/Lin...
[1] https://github.com/Const-me/Vrmac/blob/master/VrmacVideo/Lin...
[2] https://gist.github.com/Const-me/3ade77faad47f0fbb0538965ae7...
Projects Panama & Valhalla seems to solve all your complaints:
> Java doesn’t support C interop. For many desktop and embedded projects this is a showstopper, here’s an example https://github.com/Const-me/Vrmac/tree/master/VrmacVideo That C# code directly consumes V4L2 and ASIO Linux kernel APIs, and calls unmanaged user-mode DLLs like libfdk-aac.so and liba52-0.7.4.so.
Part of Panama: check out the "Foreign Function & Memory API" [0]. The official docs here [1] say it is a preview in 21 but it got stabilized in Java 22 (isn't out yet).
> Another thing missing in Java is intrinsics support, both scalar like popcnt, bitscan, BMI, etc., and SIMD like SSE and AVX.
Also part of Panama: see the "Vector API" JEP [2].
> Native stack and value types in C# reduce load on GC, and the number of complicated tricks required from JIT compiler. This in turn helps with startup performance. This is critical for command-line apps, and very desirable for desktop apps.
This is part of Project Valhalla [3], they're adding value types and actual generics, among other things.
That said, most of these are not done / not in a stable LTS Java release yet. We'll see how much better it'll be compared to C# (if at all) once all of these land.
-
Stable Diffusion in pure C/C++
I have minimal experience with Rust. OTOH, programming C++ for living since 2000, with a few gaps when I used other languages like Obj-C and C#.
I agree C++ is very hard to learn if you only have experience with higher-level languages like Python and Scala. I think there’re two reasons for that.
C++ is unsafe. There’s no way around this one, it was designed that way, like C or assembly. Still, with modern toolset it’s not terribly bad. Compilers print warnings, BTW I typically ask them to treat warnings as errors to deliberately fail the build. On Windows, a combination of debug build, debug C runtime, and visual studio debugger helps tremendously. Linux compilers have these sanitizers (address, memory, thread, undefined behavior) which are comparable, they too sacrifice runtime speed for diagnostics and debuggability.
Another reason, the language itself is very complicated, especially the templates. However, just because something is in the language doesn’t mean it’s a good idea to use it. You don’t need to be familiar with that stuff unless doing something very advanced, like customizing the Eigen C++ library. Don’t follow the patterns found in the standard library: unlike your code, that library has good reasons to use that template BS. If instead of templates you do something else, C++ becomes much easier to use, and most importantly other people will still be able to read and understand your code. Another reason to avoid excessive template metaprogramming, it slows down the compiler, because template-heavy code often needs to be in headers as opposed to cpp files.
P.S. If you don’t need extreme levels of performance (defined as “approach the numbers listed in CPU specs”, the numbers are FLOPS or memory bandwidth), and you don’t need the ecosystem too much, consider C# instead of C++. Much faster than Python, often faster than Scala or Java, easy integration with C should you need that (same as Rust, much easier than Python or Java), the only downside is these ~100MB of the runtime. The reputation is weird, but technically the language and runtime are pretty good. For example, here’s a C# library which re-implements a subset of ffmpeg and libavcodec C libraries: https://github.com/Const-me/Vrmac/tree/master/VrmacVideo
-
Media Player Element now available for cross-platform apps everywhere dotnet runs
BTW, I did that too for 32-bit ARM Linux on Raspberry Pi 4, back in 2020: https://github.com/Const-me/Vrmac/tree/master/VrmacVideo Unlike Uno, my implementation doesn’t use libVLC and is written mostly in C#, only audio decoders are in C++. To decode video, I directly consume V4L2 Linux kernel APIs.
-
Ask HN: Those making $0/month or less on side projects – Show and tell
Doing that for decades.
An app for Windows phone, downloaded 140k times: https://github.com/Const-me/SkyFM
Cross-platform graphics library for .NET: https://github.com/Const-me/Vrmac
Recently, offline speech-to-text for Windows: https://github.com/Const-me/Whisper
At this point, I consider side projects like that as a hobby.
-
Minimal Cross-Platform Graphics
I think this needs much more complexity to be useful.
For the rendering, ideally it needs GPU support.
Input needs much more work, here's an overview for Windows: https://zserge.com/posts/fenster/
Windows' Sleep() function has default resolution 15.6ms, that's not enough for realtime rendering, and relatively hard to fix, ideally need a modern OS and a waitable timer created with high resolution flag.
Here's my attempt at making something similar, couple years ago: https://github.com/Const-me/Vrmac
- An MP4 file first draft
-
Cppfront, Herb Sutter's proposal for a new C++ syntax
I agree about Python or PHP.
However, for Java or modern C#, in my experience the performance is often fairly close. When using either of them, very often one doesn’t need C++ to be good enough.
Here’s an example, a video player library for Raspberry Pi4: https://github.com/Const-me/Vrmac/tree/master/VrmacVideo As written on that page, just a few things are in C++ (GLES integration, audio decoders, and couple SIMD utility functions), the majority of things are in C#.
vello
-
Rive Renderer – now open source and available on all platforms
I'm looking forward to doing careful benchmarking, as this renderer absolutely looks like it will be competitive. It turns out that is really hard to do, if you want meaningful results.
My initial take is that performance will be pretty dependent on hardware, in particular support for pixel local storage[1]. From what I've seen so far, Apple Silicon is the sweet spot, as there is hardware support for binning and sorting to tiles, and then asking for fragment shader execution to be serialized within a tile works well. On other hardware, I expect the cost of serializing those invocations to be much higher.
One reason we haven't done deep benchmarking on the Vello side is that our performance story is far from done. We know one current issue is the use of device atomics for aggregating bounding boxes. We have a prototype implementation [2] that uses monoids for segmented reduction. Additionally, we plan to do f16 math (which should be a major win especially on mobile), as well as using subgroups for various prefix sum steps (subgroups are in the process of landing in WebGPU[3]).
Overall, I'm thrilled to see this released as open source, and that there's so much activity in fast GPU vector graphics rendering. I'd love to see a future in which CPU path rendering is seen as being behind the times, and this moves us closer to that future.
[1]: https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/da...
- WebKit Switching to Skia for 2D Graphics Rendering
-
Looking for this. html + css rendering through wgpu.
Dioxus is working on this with blitz. It's leveraging wgpu through the linebender group's Vello renderer. Still in early stages.
-
A note on Metal shader converter
If you're doing advanced compute work (including lock-free data structures), then it's best effort.
https://github.com/linebender/vello/issues/42 is an issue from when Vello (then piet-gpu) had a single-pass prefix sum algorithm. Looking back, I'm fairly confident that it's a shader translation issue and that it wouldn't work with MoltenVK either, but we stopped investigating when we moved to a more robustly portable approach.
-
XUL Layout has been removed from Firefox
There are a number of up-and-coming Rust-based frameworks in this niche:
- https://github.com/iced-rs/iced (probably the most usable today)
- https://github.com/vizia/vizia
- https://github.com/marc2332/freya
- https://github.com/linebender/xilem (currently very incomplete but exciting because it's from a team with a strong track record)
What is also exciting to me is that the Rust GUI ecosystem is in many cases building itself up with modular libraries. So while we have umpteen competing frameworks they are to a large degree all building and collaborating on the same foundations. For example, we have:
- https://github.com/rust-windowing/winit (cross-platform window creation)
- https://github.com/gfx-rs/wgpu (abstraction on top of vulkan/metal/dx12)
- https://github.com/linebender/vello (a canvas like imperative drawing API on top of wgpu)
- https://github.com/DioxusLabs/taffy (UI layout algorithms)
- https://github.com/pop-os/cosmic-text (text rendering and editing)
- https://github.com/AccessKit/accesskit (cross-platform accessibility APIs)
In many cases there a see https://blessed.rs/crates#section-graphics-subsection-gui for a more complete list of frameworks and foundational libraries)
-
Recommended UI framework to draw many 2D lines?
Vello (https://github.com/linebender/vello) which uses wgpu to render Edit: just saw you require images. Vello doesn't support those yet
-
Announcing piet-glow, a GL-based implementation of Piet for 2D rendering
How does this relate to Vello? Both target raw-window-handle for winit compatibility. Vello uses WGPU vs piet-glow using GL.
-
Taffy 0.3: UI layout in Rust, now with css-grid!
It seems like bevy is pretty committed to making it's own UI which uses bevy_ecs to store all the UI data, which Xilem is unlikely to adopt. However, the underlying renderer for Xilem (vello) does already have a bevy integration example, so it's likely that might be able to use Xilem with bevy as a 3rd-party package similar to the existing bevy_egui.
-
Announcing concoct! A cross-platform native UI framework (formerly viewbuilder)
Thanks (: I wish vello was more mature but skia is amazing with how much it supports
-
Canvas API for Bevy?
Unfortunately immediate mode 2d graphics is a bit lacking at the moment. Usually rendering is done with entities. Still, there's Vello which seems very promising, but it's still unstable. There's also bevy_keith but it's a bit outdated (0.8)
What are some alternatives?
nanovg - Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
neutralinojs - Portable and lightweight cross-platform desktop application development framework
nanovg - Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
msdfgen - Multi-channel signed distance field generator
rapidyaml - Rapid YAML - a library to parse and emit YAML, and do it fast.
sokol - minimal cross-platform standalone C headers
troika - A JavaScript framework for interactive 3D and 2D visualizations
ish - Linux shell for iOS
NanoGUI - Minimalistic GUI library for OpenGL
raspotify - A Spotify Connect client that mostly Just Works™
bgfx - Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
libGDX - Desktop/Android/HTML5/iOS Java game development framework