Metal Single Pass Downsampler (SPD)
Introduction I’ll walk through my implementation of the Single Pass Downsampler (SPD) algorithm for Apple’s Metal API. SPD is an algorithm for generating mipmaps in a single compute shader pass, as the FidelityFX SPD by AMD. Full source code at the end of the post. What is a Single Pass Downsampler? Traditional mipmap generation requires multiple passes, where each mip level is computed in a separate dispatch with synchronization points between them. This means the GPU must wait for each level to complete, write results to device memory, and then read them back for the next. This results in both memory bandwidth costs and CPU-GPU synchronization overhead from multiple API calls. SPD eliminates this overhead by using threadgroup memory to keep intermediate downsampling results local to the compute threadgroup, allowing all mip levels to be generated without round trips to device memory. SPD can be generalized to be used for any texture, however I implemented it to generate a depth pyramid for occlusion culling. ...
Neural Texture Compression in Metal 4
Introduction This is an implementation of Neural Texture Compression (NTC) which is based on the NVIDIA research paper: Random-Access Neural Compression of Material Textures. I was at the point where I wanted to do texture compression for my custom engine, and after skimming through this research, I was impressed with the compression-quality results. So I went down the rabbit hole of machine learning. This post will serve as extended documentation of MetalNTC and I will try not to re-explain stuff that can be found in the original research, but rather cover details that haven’t been mentioned, to help give you an overview of the whole pipeline of this project. I will discuss positives/negatives and fail cases, as well as use cases of the NTC, since it for now can’t entirely replace traditional texture sampling. ...