HW-accelerated programs and SheepShaver

About SheepShaver, a PPC Mac emulator for Windows, MacOS X, and Linux that can run System 7.5.3 to MacOS 9.0.4.

Moderators: Cat_7, Ronald P. Regensburg, ClockWise

Post Reply
kataetheweirdo
Apple Corer
Posts: 290
Joined: Sun Feb 01, 2009 4:55 pm

HW-accelerated programs and SheepShaver

Post by kataetheweirdo »

I've been currently thinking of ways (again) of trying to get HW-accelerated apps working in Sheepshaver. There are two particular instructions that are required for communicating between a PPC processor and an external device (graphics cards, SCSI and USB devices, networking cards, etc.). Those instructions are ecowx and eciwx, which Sheepshaver doesn't currently support.

This issue affects applications which use Quickdraw 3D (typically those using 1.6), OpenGL (Apple's official implementation), or any other library which relies heavily on a graphics card (ex.:Pangea SW's later games (Nanosaur, Bugdom, Cro-Mag Rally, Otto Matic)).

It's problematic though, as those two instructions require an External Access Register (EAR, SPR 282 in the PPC documentation). This register is part of the Supervisor Model, while Sheepshaver sticks to User Model registers (and instructions) to make it run at a bearable speed on slower machines. This also requires a TLB, which Sheepshaver lacks. A lot more details on it can be found in this patent.

RPCS3 got around this through a rather hacky method. However, Sheepshaver might need a lot more than this, given the state it's currently at. Also, there's multiple vendors for Mac graphics cards (ATI, Nvidia, Matrox, etc.) and it can be tricky to get actual 3D graphics acceleration for this reason and possibly many others.

It sounds pretty grim, but the easiest thing that I can do is to insert the EAR into the Kepherix CPU core and rewrite it to accompany the hacky method seen above. What do you have to say about this?
User avatar
adespoton
Forum All-Star
Posts: 3454
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HW-accelerated programs and SheepShaver

Post by adespoton »

It seems to me that the best method is probably to externalize the hacky method if possible, to allow for simpler re-tooling in the future when we don't have to worry so much about processor speed; since BII and SS are both as much hack as emulator already, adding one more bit should be fine, as long as it's easy to drop in the proper implementation in its place in the future.

The other bit has to do with hardware support: this has two sides. Since SS really only officially supports one PPC chip, and that came with an ATi Rage 128 IIRC, it seems that that should be the reference spec. Of course, we could just ignore direct hardware, and do an OpenGL mapping to the actual GPU; since all modern GPUs support the original OpenGL 1.2 specs, this should be fine for all software requiring OGL. QuickDraw 3D is niche enough that if we only get partial support via the hack, I don't think many would complain.

If an actual full-on emulation was desired, I think effort would probably be better spent updating the MESS cores, as they're supposed to actually document the hardware instead of get the software stack to run as SS does.
Jorpho
Master Emulator
Posts: 370
Joined: Fri Sep 17, 2004 4:22 am

Re: HW-accelerated programs and SheepShaver

Post by Jorpho »

What's Kepherix? Google knows nothing.

A silly suggestion, but there were 3DFX cards for the Macintosh, weren't there? Bochs and DOSBox are using software Voodoo emulation; perhaps that would be the way to go for QD3D/RAVE?
kataetheweirdo
Apple Corer
Posts: 290
Joined: Sun Feb 01, 2009 4:55 pm

Re: HW-accelerated programs and SheepShaver

Post by kataetheweirdo »

Jorpho wrote:What's Kepherix? Google knows nothing.

A silly suggestion, but there were 3dfx cards for the Macintosh, weren't there? Bochs and DOSBox are using software Voodoo emulation; perhaps that would be the way to go for QD3D/RAVE?
Whoops, I meant to say "Kheperix". Kheperix's code can be found under kpx_cpu and it's the PPC core of the emulator.

Indeed, there were 3DFX cards for the Macintosh.

For Voodoo emulation to work, you'd need the ecowx and eciwx instructions (as with all 3D and/or 2D graphics acceleration cards), the documentation for 3dfx cards and how they work alongside Quickdraw 3D (which would be hard to find, if it can be found at all), and how to tie the Voodoo emulation to the two aforementioned instructions. There would also be the downside of it not quite working with OpenGL 1.2.1 (The Voodoo only goes up to 1.1.3 if I recall, since 1.2.x was released after 3dfx's demise).

Emulating a Voodoo 5 would be the most desirable scenario for QD3D/Rave (although I'd honestly would go with an ATi Rage 128 or better for this, due to better application support for that in later applications), but I wouldn't mind a Voodoo 2 or 3 being emulated.
uyjulian
Apple Corer
Posts: 244
Joined: Fri Aug 27, 2010 1:02 am

Re: HW-accelerated programs and SheepShaver

Post by uyjulian »

Hmm... Does the game interact with the graphics card through the OpenGL extension or to hardware directly? If it's through the OpenGL extension that might make things easier.
kataetheweirdo
Apple Corer
Posts: 290
Joined: Sun Feb 01, 2009 4:55 pm

Re: HW-accelerated programs and SheepShaver

Post by kataetheweirdo »

julialy wrote:Hmm... Does the game interact with the graphics card through the OpenGL extension or to hardware directly? If it's through the OpenGL extension that might make things easier.
More often than not, I think it's usually the former, especially if it's a game made between 2000 and 2003. I know that Cro-Mag Rally and Otto Matic definitely did this, using Apple's own extensions for OpenGL. Not sure about other games.
uyjulian
Apple Corer
Posts: 244
Joined: Fri Aug 27, 2010 1:02 am

Re: HW-accelerated programs and SheepShaver

Post by uyjulian »

Yeah, because redirecting commands to the host is much easier than trying to emulate a graphics card and figuring out how to accelerate it.
User avatar
adespoton
Forum All-Star
Posts: 3454
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HW-accelerated programs and SheepShaver

Post by adespoton »

Pretty much every title from that period by Pangaea and Ambrosia uses Apple's extensions for OpenGL. And that's pretty much every title from that period that I still enjoy playing :)
Jorpho
Master Emulator
Posts: 370
Joined: Fri Sep 17, 2004 4:22 am

Re: HW-accelerated programs and SheepShaver

Post by Jorpho »

I really wish someone would buy Ambrosia and get them to properly re-release all their old games. But we dream about a lot of things here, don't we?
User avatar
adespoton
Forum All-Star
Posts: 3454
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HW-accelerated programs and SheepShaver

Post by adespoton »

That's not going to happen due to how Ambrosia was structured. What they did is have a holding company (Ambrosia) that a number of independent game developers worked for. Very little of the IP was ever actually owned by Ambrosia at the start; it was all held by the developers themselves. Thus, while Ambrosia got the rights to create extension packs for EV:Nova that essentially let it play EV and EVO, the actual code for EV and EVO belonged to the developers... who left Ambrosia and took their IP with them. I think EV:Nova might have been one of the first games that was owned by Ambrosia instead of the devs -- which is why you can still play it on today's hardware (I think?). I doubt the likes of Barrack et al will ever be re-released, unless someone can hunt down the original developers and untangle the mess of who owns which parts, and get all parties to give the OK.
Post Reply