Introduction Years ago I started writing a proper shader front-end parser for bgfx and used the Lemon parser generator. It was small, it worked, but I never liked the code it produced. The generated output felt hard to read, and the code that generated the parser also felt alien to me. Every time the grammar changed I had to re-learn the shape of the resulting code. It solved the problem, but…
Introduction Writing fast, portable SIMD (Single Instruction, Multiple Data) code has always been painful - verbose intrinsics, platform differences, and a type system that fights you at every step. After three major iterations, the bx library now has a much more pleasant solution. The bx library has had SIMD support since its initial commit, originally in the form of float4_t. A later major…
Introduction What is bgfx? bgfx is cross-platform / API agnostic - render anywhere, effortlessly - rendering library. It occupies space just like WebGPU native, ANGLE or similar rendering libraries that provide cross-platform rendering. The key difference: bgfx is a mid-level library. Its core concept is a declarative API with draw call ordering via “views” - generalized rendering…
Introduction When developing a profiler, memory tracker, or logger, you need to programmatically access the call stack to trace how a program reached the location where a method is called. Operating systems offer APIs for call stack tracing, but these are often too slow for practical real-time use. This article will try to demystify all ways of obtaining call-stack traces on different platforms,…
I received my first computer, the ZX Spectrum 48K, sometime in 1984. The BASIC prompt that appeared upon booting immediately sparked my fascination with programming. In the first few years, I played games, typed code from books and magazines, and created small programs of my own. From 1994 to 1997, I was captivated by the demoscene, producing demos and sub-4K intros in x86 assembly on PC. Building…
This article was originally published as a gist here. bgfx main API is using basic C++ that looks like C, but it’s C++ enough that can’t be used directly in C projects. C is important as it provides ability to bind API to other languages, and also as sanity check for API design. Every time API changes manual process of process for adding/changing API for C99 bindings was changing…
This article was originally published as a gist here. Prerequisites Before you continue, if you don’t know what IMGUI is don’t bother reading this post, just ignore it, don’t write anything in comments section, etc. If you’re curious about IMGUI see bottom of this post, otherwise continue whatever you were doing, this post it’s not for you. Thanks! If you know what…
This article was originally published as a gist here. After over 20 years working with C/C++ I finally got clear idea how header files need to be organized. Most of the projects in C++ world simply dump everything in .h file, and most of my C++ code was organized this way. Lately I started to separate function declaration from implementation as it was done in C. Now .h headers are exclusevely…
This article was originally published as a gist here. What is Orthodox C++? Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It’s exactly opposite of what Modern C++ suppose to be. Why not Modern C++? Back in late 1990 we were also modern-at-the-time C++ hipsters, and we used latest features. We…
This article was originally published at Carbon Games blog here. This article is provided for archival purposes only. The technology discussed herein is obsolete. Introduction We haven’t posted in a while here, sorry, but we are busy working on the game and porting it to Native Client. Since the beginning we had the intention to make AirMech available on all platforms that our players are running.…
This article was originally published at Carbon Games blog here. One of the most common questions people are asking us is what engine/tech we’re using for AirMech. Well, yesterday we nuked last closed source library from our code base and as of today all the code we’re using is custom in-house or open source. We now have a complete list of open source software we’re using for our game development.…