Reverse engineering the Adreno Vulkan driver

Published on . Filed under programming vulkan debugging android

Being an engine programmer usually means being a bit of a jack of all trades. There’s always something weird going on and you have to be pretty familiar with a bunch of low level details that come in handy in unexpected ways. Recently I went down a somewhat unexpected rabbit hole where those skills came in extremely hand. In an effort to blog more and also because it seems like I was the first to run into this issue, I figured I should sit down and just write about it so future people can benefit from it.

Read post

Resolving Metal GPU timers

Published on . Filed under metal programming

Almost a year ago, with macOS 10.15, Apple finally added GPU timer queries to Metal. The documentation for it is incredibly lacklustre to this day, saying the following about [MTLCounterResultTimestamp timestamp]:

A timestamp.

That’s pretty useless, there’s no unit attached to it!

I actually put down GPU timers on Metal because they were pretty damn broken in general, besides their absolute lack of documentation. For example, they would just crash on Intel. And then they would crash on AMD hardware. It wasn’t until the release of macOS 10.15.5 a few days before Apple announced macOS 11, that GPU timers were actually fixed. The documentation, however, was not updated.

Read post

Fragment shader based interior mapping

Published on . Filed under programming graphics

Seems like everybody is excited about the fake interior mapping in Spiderman these days. Here is a Kotaku video showing them off:

Now, the technique itself is nothing new, it’s been proposed by Joost van Dongen who published a paper about it here. The idea is to divide the space into evenly sized “rooms” and then cast a ray in the fragment shader to figure out whether the ceiling/floor or a wall was hit, and then map a texture on top. It’s super cool because it works without requiring extra geometry, the fragment shader is relatively cheap and easy to implement and like the Kotaku reviewer mentioned; The fact that the window is no longer just flat or a mirror adds depth (hah) to the world.

Read post

Automatic detection of profiling tools

Published on . Filed under programming debugging

Let’s say that you occasionally look at your application with NSight, VTune, or any other profiling tool of choice. Naturally you want to add debug markers into your application, but you might not necessarily ship with them or have them run at all when no profiling tool is attached. You could put them behind a command line flag, but I prefer automatic discovery: One build, when run with NSight, having all the debug markers I need to dissect a frame, and when run without NSight not doing any of that overhead. With X-Plane, there is another layer to that, and that is that specifically for NSight some features have to be disabled since they are making unsupported GL calls.

Read post

The curious case of 'ìe°[^]├UëÕ]Ús UëÕâýj'

Published on . Filed under firedrake programming debugging

11 months ago was the last time I touched firedrake, and last weekend the urge to mess with it caught me again. So I set up WSL, installed all necessary dependencies and opened firedrake. I fired up the last compiled version I had, just to remind myself of where I had left things, and I QEMU was happy to dump my debug printf()’s via the virtual UART into stdout. All was good. Then I compiled firedrake from scratch and it stopped working, or rather, it stopped producing output via the UART. That’s strange, I thought, messed with a couple of things and also stashed all my git changes but no avail; No more output via the UART.

Read post

Page 1 of 3 Older Posts