(05-19-2009, 09:52 PM)fraserofthenight Wrote: Just out of curiosity, what's the main bottleneck as far as PS2 emulation goes (i.e. floating point, integer, memory bandwidth, etc.)?
The biggest bottleneck is actually just the generally high cycle rates for the multiple CPUs under the hood of the PS2. That is, updating the program counter, handling events, and branching to new locations in the code (jump instructions, exception handlers, etc). And when you have four CPUs running in parallel all needing to have their register and banching states updated continuously, they can just be running :
while( true ) { i++; }
.. and emulation will be pretty slow. In fact many of our speedhack optimizations are designed specifically to target those kind of loops.
The second bottleneck is the VU, as Rama described. SSE and VU's SIMD are fairly incompatible, so we have to do a lot of work to keep VU emulation accurate. The VUs have less overhead from branching and more "doing real work" overhead.
Bottleneck #3 is the GS. This includes both the GS interface and the job the GS plugins must do to render scenes. The problem is that the PS2 uses a fairly low-level design to synthesizing graphics, one which DirectX nor OpenGL were designed to accommodate. That greatly limits the amount of work that can be done using hardware acceleration, and complicates the parts that can be used. Additionally, the GS was designed such that many games will "swizzle" textures in and out of GS ram per-frame, resulting in 600-800 megs of data transferred to the GS per second. Optimizing for that can often be very tricky, since PCs are designed more on the premise of "upload once and use forever" texturing (this being the difference of a GS with 4MB of ram and a typical PC video card with 512Mb to 1gb).