An Old Problem Meets Its Timely Demise
dolphin-emu.org
dolphin-emu.org
On the consoles, the memory formats and layouts were well defined, but the order of operations were not. And indeed, if you tried to draw anything that wasn't a pointless memcpy(src, src, sizeof(src)) while using the framebuffer as a source texture, you would get random, rectangular and z-shaped (morton order) glitches because of out-of-order operations stemming from the aliased source and dest buffers.
However... My goal was a blurry, streaky, screen distortion effect in the weapon trails --to look like the blades were so awesome they caused refraction by cutting the air ;) I found that by sampling the framebuffer from four locations along the weapon's line of motion, the glitches were blurred and streaked out to the point that they really were not objectionable :D
To do the effect according to the spec (and without glitches) I would have had to copy the whole framebuffer to a temp buffer. That would have been simply too expensive for such a small visual difference. What did ship looked great and the framebuffer-feedback feature added effectively zero cost. But, I felt kinda bad for future (now long past) emulator writers who would later try to support my out-of-spec use of the hardware which is simply not allowed by desktop APIs. (AMD's Mantle might expose it. We'll see...)
Unfortunately, the artists tuned the effect to be really subtle and it's hard to see it through the compression. When the axe is on fire, the flames are using the effect to do heat distortion as well.
I don't think the programmers were showing off, just they've become familiar with bits on a level beyond normal. Like how the linux guys are familiar with double star pointers.
On that note I would like to encourage you the reader to contribute to an emulator. They are an intertesting problem space similar to a compiler's backend, but with fewer unit tests.
I do a lot of embedded MCU work, which involves so much bit-twiddling (all IO is through mem-mapped peripherals) that it's spilling over into other work I do.
If I need to shove around a bunch of boolean flags, I'll probably use a int, because the boolean operations required to access the separate bits are basically autonomic at this point for me.
> https://code.google.com/p/dolphin-emu/source/detail?r=ed67d1... #2charsfix