programming
Building Content: Scripting With C# 10 Aug 2025
A few weeks ago I wrote about my toy content builder. Today, I'm writing a little bit more about it.
Read more...Dynamic Descriptor Pools 01 Aug 2025
A couple days ago I wrote about my dynamic_buffer
helper which I use to push things like uniform blocks to the GPU without worrying too much about preallocating the exact amount of memory I need at application startup. Here's another helper which I use to make allocating descriptor sets easy.
Don't Forget the Inline! 30 Jul 2025
If you're writing a header file and you're at global or namespace scope, then you almost certainly do not mean to declare bare const
or constexpr
variables.
Dynamic Graphics Buffers 30 Jul 2025
Yesterday, I described a ring buffer allocator suitable for pushing data to a GPU. Today, I'm using that allocator to manage a dynamic buffer suitable for sending things like blocks of uniforms up to the GPU which automatically grows when necessary.
Read more...Ring Buffers 29 Jul 2025
Circular buffers (or queues): super useful, but also hard to implement without getting snagged up on little off-by-one errors in the code that tracks the difference between the used and free regions. So here's a quick overview of the algorithm I use for stuff like dynamic vertex and uniform buffers when I'm doing 3D programming.
Read more...Building Content: Just-In-Time Dependency Graphs 19 Jul 2025
So, I've got a little toy hobby game project that I've been working on for ages, and it has content. And that content has to be built. And building content is very annoying, mostly because it tends to have dependencies that're really hard to quickly extract ahead of time. So... I decided not to, and I built myself a build system that builds the dependency graph and the content at the same time.
Read more...WebGL Index Validation 19 Sep 2013
If you've ever browsed through the WebGL spec, you've likely seen section 6: Differences Between WebGL and OpenGL ES 2.0. Right at the top of that section, we find section 6.1: Buffer Object Binding. That section reads as follows:
Read more...Introducing HenchLua 04 Sep 2013
This is the first of a series of posts on the subject of HenchLua. HenchLua is an implementation of the Lua VM in C#. It's targeted at projects running in otherwise limited .NET contexts, such as web-based Unity games (the Unity plugin, I believe, requires pure verifiable CIL), mobile apps (which are memory-limited and must meet the limitations of Mono's full AOT compiler, or apps that run on the .NET Compact Framework (whose garbage collector has some serious performance issues, as anyone who's written an XNA game targeted at the Xbox can attest).
Read more...Bicubic Filtering in Fewer Taps 23 Oct 2012
This post is based on the technique described in GPU Gems 2, chapter 20, Fast Third-Order Texture Filtering. While that's certainly a good read, I found that the authors skipped over a lot of detail and optimized a little prematurely, making the result rather difficult to parse. If you've read and understood their paper, then this isn't going to be news to you.
Read more...Simple Flip Book Animation in WPF 13 Sep 2012
WPF makes it easy to animate numbers, colors, sizes, and a host of other properties. Unfortunately, it isn't easy to animate an ImageSource
property, which is what we're usually looking for when implementing a flip book animation. The closest we get out of the box is ObjectAnimationUsingKeyFrames, which works, but it's very tedious to set up all of the individual key frame times.
Using Win32 Icons in WPF 09 Aug 2012
Using custom icons can be a little tricky in WPF. It's simple enough if you want to use your application's main icon or an icon file that you can refer to using a pack URI - so long as you do that, everything just works.
Read more...Extracting Icons from PE Files 09 Aug 2012
There are times when you need an icon file, but all you have is an icon resource embedded in a PE (executable) file. Getting at these is a little tricky, since icon files aren't stored as a simple blob in the PE file. In fact, they're split up into a number of different entries. Fortunately, it isn't very hard to combine these entries into an ICO-format data blob which you can then save to file or pass to an API that expects it.
Read more...Working With Win32 Resources in .NET 09 Aug 2012
Most native applications make extensive use of Win32 resources. While the .NET Framework provides a far more useful resource API, it's sometimes necessary to access the old style Win32 resources. Fortunately, this isn't very difficult.
Read more...Visual C#: Phantom Breakpoints 22 Apr 2012
So I've got a large solution with a lot of projects (mostly build tools) and every now and then I would get suspicious phantom breakpoints, meaning that the debugger would break where no breakpoint had been placed. This would usually happen after closing and reopening the project, and it only ever seemed to afflict the executables in my solution - never the libraries.
Read more...