Fast clears. Oh joy. That was about the joys of the day. Actually it started at 6:30, took Dillon to daycare (who is now flat out on the couch next to me). I was actually quite tired, probably because Jamie didn’t come to bed until 2AM. Yes, fast clears. Fun how these work. Okay, for depth buffers it’s actually pretty good. You have some meta data which say represents a 16×16 block of pixels. That metadata stores the min and max z of that block. So to clear depth you just right max depth to min and min depth to max. Then do your render. Job done, that really all there is to it, no need to clear the whole depth buffer. When the rasteriser writes to it it checks the min/max values against the meta data, so it knows if it can skip the whole tile. Colours are a bit more involved. You clear the meta data. Do your render, this marks the tile as ‘touched’ and fills in any untouched pixels with the clear colour. Then after you have finished you have to run through the metadata and clear any untouched tiles. Job done. Anyway, took quite an age to implement, all working now.
Picked up Dillon. Went to Pump. Laverne stood in as Trudie was away. Did more work. Had an odd and slightly worrying experience tonight, I’ll discuss it in a couple of weeks. More GPU fun tomorrow.