JHRobotics / softgpu

SW and HW accelerated GPU driver for Windows 9x Virtual Machines
MIT License
692 stars 19 forks source link

GPU emulation (maybe)? #25

Open michaeljhkim opened 1 year ago

michaeljhkim commented 1 year ago

Hi! So I was wondering what would happen if you took the voodoo 3 gpu code from 86box or something of the sort, and just implemented that into this thing? It is to my limited understanding that emulating the gpu would cause less issues than trying to maintain a bunch of wrappers and pass through and stuff.

If it turns out that I'm an idiot and it is a whole lot more trouble than what is currently being done, then just ignore what I am saying. Note that I am not trying to get a new thing going or anything, but I just wanted to ask about it in case it was a good idea.

EriolGaurhoth commented 1 year ago

One thing I wish that could be done, somewhat along the lines of what you're saying, is to somehow get the device manager in Windows 98 to think there's an actual voodoo card installed when the references to the .dlls and drivers for the card are the glide wrappers.

This might fix a bunch of games that neither recognize the .dlls in the game's folder nor in the Windows system folder as being sufficient to detecting that the game is 3dfx capable; many games are instead configured to check the device manager to see if a Voodoo card is installed and then gives 3dfx as a rendering option for the game. I believe some of the Need for Speed games are like this - in NFS3, it recognizes the softgpu emulated device as a D3D-only card, which is sufficient for playing the game well, but there are some features (like 1024x768 resolution) that are only available for 3dfx cards.

This might be a VirtualBox issue however, as it doesn't allow for attaching any kind of device (that I'm aware of) that could be spoofed as a 3dfx card, and I'm not sure you can implement that purely through software. Implementing 86box code doesn't make sense here, nor would it be possible since it would have to be somehow compiled into the VirtualBox code itself, not SoftGPU, and it would defeat the entire purpose of passthrough graphics acceleration to have a software-only voodoo.

lorn10 commented 1 year ago

Hi all! Just for the sake of completeness. It was confirmed in #23 that a native D3D9 pass-trough for SoftGPU is in development. This is true at least for Linux based hosts which supports Gallium Nine, the D3D9 API implementation in Mesa.

So this feature will result in a hardware D3D9 GPU support for Windows 9x guests running in a VM. :smiley: And regarding Glide support, - it should be possible to use the nGlide wrapper in that scenario. The nGlide wrapper supports a conversion of Glide to D3D9 and Vulkan.

I can confirm that this works almost perfectly for Wine 8.16 and the epic platformer game Rayman 2: The Great Escape. There is only a registry tweak needed to make nGlide working with Gallium Nine.

EriolGaurhoth commented 1 year ago

So this feature will result in a hardware D3D9 GPU support for Windows 9x guests running in a VM. 😃 And regarding Glide support, - it should be possible to use the nGlide wrapper in that scenario. The nGlide wrapper supports a conversion of Glide to D3D9 and Vulkan.

I can confirm that this works almost perfectly for Wine 8.16 and the epic platformer game Rayman 2: The Great Escape. There is only a registry tweak needed to make nGlide working with Gallium Nine.

Do you know if this would work with dgvoodoo2 as well? I generally prefer it over nGlide, but not sure if it has the requisite features.

lorn10 commented 1 year ago

Unfortunately you cannot use dgvoodoo2 with D3D9. It seems that dgvoodoo2 needs Direct3D 10/11/12. But it might work with super-old dgvoodoo?

Whatever Windows 98/Me only supported Direct3D 9 so any higher version cannot be implemented for them. And regarding Mesa there exist only a native Direct3D 9 API implementation (in the form of Gallium Nine). So also here any support for a higher D3D version makes no sense.

Long story short, - regarding Rayman 2 the nGlide wrapper (in Wine) works almost perfectly fine. :wink: