Pages

Saturday, May 15, 2010

Restartable Blocks

Michael Abrash (an assembly guru) coined that term in his book Graphics Programming Black Book.
Restartable blocks; that is, reading a chunk of data, operating on the data until it runs out, suspending the operation while more data is read in, and then continuing as though nothing had happened.

I've used that technique many times in the past. As an example, in one of my projects I had to serialize and deserialize a tree structure. I didn't use a 3rd party library at the time to do the job for me and loading small data packets from a hard disk, in a loop, isn't quite efficient. Anyway, the routine "loadNode()" was using restartable blocks. It was loading let's say 1000 data records from a file on a buffer, in one read, and it'd return only one node at a time; sort of a generator routine.

teaser:
With Quake, Carmack realized, he wanted both a programmer who could work with his engine and someone who could experiment with his early work. Romero had once assumed both roles. With the distractions of Doom's success, it seemed to Carmack, he would assume neither.

[...] For the programming, there was no one better in Carmack's mind than the veteran coder Michael Abrash. It was Abrash's book on power graphics programming for computers that Carmack and Romero had used to learn  how to program the graphics for their earlier games.
[Masters of Doom: How Two Guys Created an Empire and Transformed Pop Culture]

No comments:

Post a Comment