These two definitely seem related. The raw depth buffer in the normal VRAM space is rearranged in a swizzled-like way. This is the raw dump of the depth buffer converted to an 8bpp greyscale:

When viewed through the VRAM+2M window, it looks a bit more organized:

This is clearly a fairly simple structure, with a simple column-wise rearrangement of each 16 pixel (32 byte) strip. When rearranged, it looks as expected:

For reference, the corresponding colour buffer is:

The rearrangement function is
Code: Select all
unsigned swoz(unsigned x)
{
return ((x & 0x100) >> 4) | ((x & 0xf0) << 1) | (x & 0xf);
}
This means it should be pretty efficient to extract the depth buffer in an organized way without lots of CPU effort to rearrange the in-memory organization; the VRAM+2M window does most of the work, and simply copying 32-byte strips with the normal GE copy commands will finish the job.
Now the tricky part is working out how to use this to do depth-map shadows and other effects...