Language Selection

English French German Italian Portuguese Spanish

Programming: WebAssembly, Mozilla GFX, Qt and Python

Filed under
Development
  • WebAssembly for speed and code reuse

    Imagine translating a non-web application, written in a high-level language, into a binary module ready for the web. This translation could be done without any change whatsoever to the non-web application's source code. A browser can download the newly translated module efficiently and execute the module in the sandbox. The executing web module can interact seamlessly with other web technologies—with JavaScript (JS) in particular. Welcome to WebAssembly.

    As befits a language with assembly in the name, WebAssembly is low-level. But this low-level character encourages optimization: the just-in-time (JIT) compiler of the browser's virtual machine can translate portable WebAssembly code into fast, platform-specific machine code. A WebAssembly module thereby becomes an executable suited for compute-bound tasks such as number crunching.

    Which high-level languages compile into WebAssembly? The list is growing, but the original candidates were C, C++, and Rust. Let's call these three the systems languages, as they are meant for systems programming and high-performance applications programming. The systems languages share two features that suit them for compilation into WebAssembly. The next section gets into the details, which sets up full code examples (in C and TypeScript) together with samples from WebAssembly's own text format language.

  • Mozilla GFX: moz://gfx newsletter #47

    Hi there! Time for another mozilla graphics newsletter. In the comments section of the previous newsletter, Michael asked about the relation between WebRender and WebGL, I’ll try give a short answer here.

    Both WebRender and WebGL need access to the GPU to do their work. At the moment both of them use the OpenGL API, either directly or through ANGLE which emulates OpenGL on top of D3D11. They, however, each work with their own OpenGL context. Frames produced with WebGL are sent to WebRender as texture handles. WebRender, at the API level, has a single entry point for images, video frames, canvases, in short for every grid of pixels in some flavor of RGB format, be them CPU-side buffers or already in GPU memory as is normally the case for WebGL. In order to share textures between separate OpenGL contexts we rely on platform-specific APIs such as EGLImage and DXGI.

    Beyond that there isn’t any fancy interaction between WebGL and WebRender. The latter sees the former as a image producer just like 2D canvases, video decoders and plain static images.

  • The Titler Revamp: QML Producer in the making

    At the beginning of this month, I started testing out the new producer as I had a good, rough structure for the producer code, and was only facing a few minor problems. Initially, I was unclear about how exactly the producer is going to be used by the titler so I took a small step back and spent some time figuring out how kdenlivetitle worked, which is the producer in use.

    Initially, I faced integration problems (which are the ones you’d normally expect) when I tried to make use of the QmlRenderer library for rendering and loading QML templates – and most of them were resolved by a simple refactoring of the QmlRenderer library source code. To give an example, the producer traditionally stores the QML template in global variables which is taken as a character pointer argument (which is, again, traditional C) The QmlRenderer lib takes a QUrl as its parameters for loading the Qml file, so to solve this problem all I had to do was to overload the loadQml() method with one which could accommodate the producer’s needs – which worked perfectly fine. As a consequence, I also had to compartmentalise (further) the rendering process so now we have 3 methods which go sequentially when we want to render something using the library ( initialiseRenderParams( ) -> prepareRenderer( ) -> renderQml( ) )

    [...]

    The problem was resolved (thank you JB) finally and it was not due to OpenGL but it was simply because I hadn’t created an QApplication for the producer (which is necessary for qt producers). The whole month’s been a steep curve, definitely not easy, but, I enjoyed it!

    Right now, I have a producer which is, now, almost complete and with a little more tweaking, will be put to use, hopefully. I’m still facing a few minor issues which I hope to resolve soon and get a working producer. Once we get that, I can start work on the Kdenlive side. Let’s hope for the best!

  • How to Make a Discord Bot in Python

    In a world where video games are so important to so many people, communication and community around games are vital. Discord offers both of those and more in one well-designed package. In this tutorial, you’ll learn how to make a Discord bot in Python so that you can make the most of this fantastic platform.

  • Qt Visual Studio Tools 2.4 RC Released

    The Visual Studio Project System is widely used as the build system of choice for C++ projects in VS. Under the hood, MSBuild provides the project file format and build framework. The Qt VS Tools make use of the extensibility of MSBuild to provide design-time and build-time integration of Qt in VS projects — toward the end of the post we have a closer look at how that integration works and what changed in the new release.

    Up to this point, the Qt VS Tools extension managed its own project settings in an isolated manner. This approach prevented the integration of Qt in Visual Studio to fully benefit from the features of VS projects and MSBuild. Significantly, it was not possible to have Qt settings vary according to the build configuration (e.g. having a different list of selected Qt modules for different configurations), including Qt itself: only one version/build of Qt could be selected and would apply to all configurations, a significant drawback in the case of multi-platform projects.

    Another important limitation that users of the Qt VS Tools have reported is the lack of support for importing Qt-related settings from shared property sheet files. This feature allows settings in VS projects to be shared within a team or organization, thus providing a single source for that information. Up to now, this was not possible to do with settings managed by the Qt VS Tools.

More in Tux Machines

Android Leftovers

cmus – free terminal-based audio player

It took me a few years to appreciate console-based software. Repairing a broken system using the ubiquitous vi text editor was a turning point in my Linux journey. Now I spend a lot of time at the terminal, and listening to music. Best combine the two! When it comes to console-based music software, I really admire musikcube, a wonderful audio engine, library, player and server written in C++. This review looks at an alternative to musikcube. It’s called cmus. It shares many similarities with musikcube. Both are designed to run on a text-only user interface, reducing the resources required to run the application. cmus is written in C. Read more Also: Rclone Browser Fork With Fixes And Enhancements

Android Leftovers

GNU Linux-libre 5.3-gnu

GNU Linux-libre 5.3-gnu sources and tarballs are now available at
<http://www.fsfla.org/selibre/linux-libre/download/releases/5.3-gnu/>.
It didn't require any deblobbing changes since -rc7-gnu, the first
published rc-gnu.  Freesh binaries are already available!, thanks to
Jason Self; others are on the way.


Besides recognizing new false positives (sequences that our blob hunter
would report as suspicious, but that are neither blobs nor requests for
blobs), updating the deblobbing scripts for 5.3 required adjusting
cleaned up drivers for updated blob names, recognizing one new Free
piece of firmware with binary and corresponding sources embedded in the
kernel sources, and disabling blob loading introduced in a few drivers:
QCOM, DRM (HDCP), Allegro-DVT, and Meson-VDEC.

This last one was particularly disappointing: the firmware sources were
supposed to be available from LibreELEC, and though the link to the
alleged sources there is broken, I managed to find the "source" repo
containing them, only to find out the "source" was just a binary blob
encoded in C as an array of char, just like Linux used to do back when I
got involved with Linux-libre.  Oh well...  Request disabled...

If anyone can find Freely-licensed actual source code for that, or for
any other file whose loading we disable, please let us know, so that we
can refrain from disabling its loading.


For up-to-the-minute news, join us on #linux-libre of irc.gnu.org
(Freenode), or follow me (@lxoliva) on Twister <http://twister.net.co/>,
Secure Scuttlebutt, GNU social at social.libreplanet.org, Diaspora* at
pod.libreplanetbr.org or pump.io at identi.ca.  Check my web page (link
in the signature) for direct links.


Be Free! with GNU Linux-libre.
Read more Also: GNU Linux-Libre 5.3 Kernel Arrives for Those Seeking 100% Freedom for Their PCs GNU Linux-libre 5.3 Continues Deblobbing & Dealing With Firmware Trickery