Running games with sufficient GPU hardware acceleration inside a Windows-hosted virtual machine (VM)

manneychin

Member
May 8, 2017
404
1,099
I need to run [porn] games inside a Windows-hosted virtual machine (VM) (via Hyper-V, VirtualBox, VMware Workstation, etc.).

Most games use one of these major rendering APIs: Direct3D, OpenGL or Vulkan. This includes Ren'Py-based games which use OpenGL (Just because Ren'Py is so popular I'll mention that ; out of the many Ren'Py games I've tried over the years, all seemed to run via OpenGL and I wasn't even aware of the DirectX option).
Problem is, these APIs can easily underperform, singlehandedly making games unplayable unless the specific API [major] version being used has good-enough low level access to a GPU via some form of .

This thread is about harvesting experiences from those who've already tried the above, considering that the endeavour is not mainstream, can require a lot of time & other resources and when success is achieved it's often with fragile solutions that are specific to certain needs & hardware so it can't easily be replicated by others.

So, in this particular case your actual experiences would be of great help. What worked and to what extent? Are you using a 2nd GPU passed-through to a VM? Are you using API remoting enabled by the hypervisor?

Here's some information I gathered:
  • Wikipedia says this is the current (API remoting is when the VM uses your main GPU through special/magic drivers):
  • VirtualBox is a popular hypervisor in some circles but when it comes to GPU virtualization it seems to be [very] insufficient for gaming.
    • It .
    • API remoting support is limited to old API versions so it's doubtful even most Ren'Py games will run well while anything based on newer Unreal/Unity versions is unlikely to run at all.
  • VMware Workstation is probably OK for some games but I can't tell how many "some" is.
    • It .
    • It seems to have decent API remoting support.
    • Extra problem with Workstation is $ price vs. benefits.
      • The free VMware Player is likely too limited for most in other key ways.
  • Hyper-V seems to be the best option but "best" may be a strong word.
    • On Windows 10/11 Pro GPU pass-through support is very shady. The feature seems to be for just some special cases.
      • where you don't need a 2nd GPU exclusively assigned to the VM, you can fully and deeply share the main GPU between VMs and host. Again it's unclear how well this works, seems like an exotic configuration which is sure to be fragile and riddled with all kinds of obscure problems you'd be lucky to find someone else on the Internet even asking about and when you do it's just the question with no answers...
    • I'm very confused about API Remoting support in Windows 10/11 Pro. RemoteFX vGPU seems deprecated and instead... ???
  • One very tricky aspect of API Remoting solutions is the apparent complete lack of support for DXVA which to me means that video GPU hardware acceleration is not available in any way over API Remoting. This means video playback (including in Ren'Py games) could easily be visually degraded and/or working like a slide-show making games unplayable depending on how they encode their videos...

I'll ping skwada by including this answer from Jun 2003 from an older thread on a topic that was somewhat similar:
I've tried all the major free virtualization software available for Windows: Hyper-V, Virtual Box, VMWare Player. I'd say Hyper-V is the best by far in terms of performance and features:
  1. Supports GPU pass-through, though it's annoying to enable (neither of the other two support this), and generally has better performance. I think because it is built-in to Windows maybe it has less overhead
  2. Headless mode (i.e. run the VM in the background with no GUI)
  3. Pausing is instantaneous and immediately hides the VM GUI from your screen - I remember VBox taking a while and VMWare is sometimes instant and other times slow as shit
  4. Can create checkpoints of the hard disk (VBox has this, VMWare does not)
  5. Can easily disable networking (my attempts at doing this with the others is fuzzy but remember it being a pain in the ass)
  6. Has a CLI available for custom automation (VBox has this too, VMWare does not for the free version)
The only downside is it requires Windows Pro. If you don't have Pro and aren't willing to buy it (costs literally $2 through the right websites) then VMWare Player was the second best in my exp

Oh yeah word of advice for anyone trying to use Hyper-V: use a Windows Pro image for your guest VM to have support for enhanced mode - it is absolutely necessary to get the best experience
skwada, if you have the time, any comments/details on exactly how you achieved GPU pass-through would be appreciated.

WheresLucifer and Osider, you've also made passing mentions you run games in VMs. Again, if you have the time, how?
You don't have permission to view the spoiler content. Log in or register now.
 
Last edited:

manneychin

Member
May 8, 2017
404
1,099
Hey I used the scripts in the repo you linked to
I read their README and that's one bizarre solution. The scripts use vaguely documented Windows API and the solution overall only works with Parsec (actually seems built around Parsec from ground up.). I'm very curious where it came from originally. Regardless...

Do you notice a significant difference in performance vs. running the games directly on the host?
What game [engines] did you try and did all just work or were there any problems? I'm particularly curious if you tried anything based on DirectX (Unity/UE).
Can you playback videos encoded with h264/avc or h265/hevc in something like MPC-HC (or any other player) with hardware acceleration (DXVA)?
 

AlternateDreams

I'm tired, boss.
Game Developer
Apr 6, 2021
70
234
I mostly use VMWare Workstation and I confirm that it's not ideal (no GPU passthrough).
But in practice all 'small' games work and even some Unreal Engine 5 games, but you need to configure the VM properly (in particular increase the VRAM allocated by VMWare to the max (3GB)).

(I've truncated my answer about KVM/QEMU because it's not available on a Windows host)
 
Last edited:
  • Like
Reactions: manneychin

Osider

RedHead
Donor
Sep 23, 2019
200
298
I need to run [porn] games inside a Windows-hosted virtual machine (VM) (via Hyper-V, VirtualBox, VMware Workstation, etc.).

Most games use one of these major rendering APIs: Direct3D, OpenGL or Vulkan. This includes Ren'Py-based games which use OpenGL (Just because Ren'Py is so popular I'll mention that ; out of the many Ren'Py games I've tried over the years, all seemed to run via OpenGL and I wasn't even aware of the DirectX option).
Problem is, these APIs can easily underperform, singlehandedly making games unplayable unless the specific API [major] version being used has good-enough low level access to a GPU via some form of .

This thread is about harvesting experiences from those who've already tried the above, considering that the endeavour is not mainstream, can require a lot of time & other resources and when success is achieved it's often with fragile solutions that are specific to certain needs & hardware so it can't easily be replicated by others.

So, in this particular case your actual experiences would be of great help. What worked and to what extent? Are you using a 2nd GPU passed-through to a VM? Are you using API remoting enabled by the hypervisor?

Here's some information I gathered:
  • Wikipedia says this is the current (API remoting is when the VM uses your main GPU through special/magic drivers):
  • VirtualBox is a popular hypervisor in some circles but when it comes to GPU virtualization it seems to be [very] insufficient for gaming.
    • It .
    • API remoting support is limited to old API versions so it's doubtful even most Ren'Py games will run well while anything based on newer Unreal/Unity versions is unlikely to run at all.
  • VMware Workstation is probably OK for some games but I can't tell how many "some" is.
    • It .
    • It seems to have decent API remoting support.
    • Extra problem with Workstation is $ price vs. benefits.
      • The free VMware Player is likely too limited for most in other key ways.
  • Hyper-V seems to be the best option but "best" may be a strong word.
    • On Windows 10/11 Pro GPU pass-through support is very shady. The feature seems to be for just some special cases.
      • where you don't need a 2nd GPU exclusively assigned to the VM, you can fully and deeply share the main GPU between VMs and host. Again it's unclear how well this works, seems like an exotic configuration which is sure to be fragile and riddled with all kinds of obscure problems you'd be lucky to find someone else on the Internet even asking about and when you do it's just the question with no answers...
    • I'm very confused about API Remoting support in Windows 10/11 Pro. RemoteFX vGPU seems deprecated and instead... ???
  • One very tricky aspect of API Remoting solutions is the apparent complete lack of support for DXVA which to me means that video GPU hardware acceleration is not available in any way over API Remoting. This means video playback (including in Ren'Py games) could easily be visually degraded and/or working like a slide-show making games unplayable depending on how they encode their videos...

I'll ping skwada by including this answer from Jun 2003 from an older thread on a topic that was somewhat similar:

skwada, if you have the time, any comments/details on exactly how you achieved GPU pass-through would be appreciated.

WheresLucifer and Osider, you've also made passing mentions you run games in VMs. Again, if you have the time, how?
I could recommend see the video of "someordinarygamer" on YouTube that had a subject on this on how to make gpu passthrough.
 
  • Like
Reactions: manneychin

skwada

Newbie
Feb 13, 2020
79
211
I read their README and that's one bizarre solution. The scripts use vaguely documented Windows API and the solution overall only works with Parsec (actually seems built around Parsec from ground up.). I'm very curious where it came from originally. Regardless...
Actually my answer is somewhat misleading; this forum post outlines the actual steps I followed: , I do not use Parsec or most of the files from that repo. It's mainly the script for copying your GPU drivers into the host machine and partitioning the GPU on the host, that's enough to get things working.

Do you notice a significant difference in performance vs. running the games directly on the host?
Yep, night and day difference for games with long animation. Without GPU passthrough, I'd often notice in Ren'py games that renders would be pixelated at first and then as the CPU had a chance to do more passes, the details would fill in. With passthrough, there is no such effect.

What game [engines] did you try and did all just work or were there any problems? I'm particularly curious if you tried anything based on DirectX (Unity/UE).
Mainly Ren'py and various Japanese VN game engines. A lot of JP VN engines use DirectX and I'm pretty sure I've played a few Unity games. As far as I could recall, these games were of similar performance as Ren'Py

Can you playback videos encoded with h264/avc or h265/hevc in something like MPC-HC (or any other player) with hardware acceleration (DXVA)?
Never tested anything like this
 

WheresLucifer

Well-Known Member
Sep 1, 2018
1,235
1,195
I have two VM guests. One is for 3D setup and one is non-3D setup. I would have to find the link that has the explanation for increasing the graphic card to max if possible (max would be 256MB for graphic ram, which it is still too low but manageable). I mostly use the non-3D VM guest, however when I do come across certain AVN, such as "Pandora's Box 2", I had to switch to the 3D VM guest to use check out the AVN.

One of the configuration need to be done either using (1) executing a command with flags and/or (2) tweak one of the VM's configuration file. This is what allow me to use max 256MB RAM setup for the graphic card (mostly for the non-3D guest). Again wish that virtual box would allow more like up to 1GB. For 3D, there is option setting when you go into the setting of that VM to enable the graphic card to 3D. (see attachment)

You don't have permission to view the spoiler content. Log in or register now.

I will try to find the link to the source for you if needed.

** Additional edit - 12MAY2024 **

I may had left out additional points to be aware of. The vCPU/Processors and vRAM/RAM also factors into the performance as well not only based on the graphic RAM/GPU.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

Since there may need additional tweaking over time, however when the AVN/game or any other unknown application been executing that demands more performance. Two two primary factors that may need to be tweak first would be vCPU/Processor and/or vRAM/RAM. Recommend only make one adjustment and determine if the the application performance is better in the Guest VM. If not then revert the change and change the other possible virtual hardware that needs tweak. In some case both vCPU and vRAM may need to be tweak. At this moment, I had found a reasonable balance form VM Guests.

I already rebuild my two VM guests as template/default that is clean installation.
You don't have permission to view the spoiler content. Log in or register now.

I would clone the template VM as a new VM, then tweak the vCPU, vRAM, (If needed enable 3D for graphic card), and disable vNIC. I would use that for anything to be tested or so. Regarding to the application data, you can mount share drive (from the host, as read only) to mount to copy the application data or enable one way clipboard feature to copy application data over from host to VM Guest.

I hosted my virtual machine on my laptop, most people may host their virtual machine on their desktop.

** End of "Additional edit - 12MAY2024" message **

Have a great day and be safe... (y)
 
Last edited:

manneychin

Member
May 8, 2017
404
1,099
Yep, night and day difference for games with long animation. Without GPU passthrough, I'd often notice in Ren'py games that renders would be pixelated at first and then as the CPU had a chance to do more passes, the details would fill in. With passthrough, there is no such effect.
I understood your answer but I wasn't asking if games run better in a VM with a GPU pass-through vs. a VM without.
I was asking how much better games run directly on your Windows PC (the classic way, no VM) vs. in a VM with a GPU pass-through. Meanwhile, I gathered more info. and it seems the penalty for the latter is not significant (at least for porn games) especially if you don't simultaneously run another game in the underlying/host Windows PC.
This conclusion is good enough for me, no need to dig further for now.

What do you use to connect to the VM and actually see the game (i.e. get display out from the VM)?

The github solution from jamesstringerparsec uses Parsec (now I'm also clear why, he's a Parsec employee).
You said you don't use Parsesc. Do you use the Virtual Machine Connection tool (AKA VMConnect) and then switch to full screen or do you connect using something else? To be clear, by Virtual Machine Connection tool I mean this:
You don't have permission to view the spoiler content. Log in or register now.
 

manneychin

Member
May 8, 2017
404
1,099
I have two VM guests. One is for 3D setup and one is non-3D setup. I would have to find the link that has the explanation for increasing the graphic card to max if possible (max would be 256MB for graphic ram, which it is still too low but manageable). I mostly use the non-3D VM guest, however when I do come across certain AVN, such as "Pandora's Box 2", I had to switch to the 3D VM guest to use check out the AVN.

One of the configuration need to be done either using (1) executing a command with flags and/or (2) tweak one of the VM's configuration file. This is what allow me to use max 256MB RAM setup for the graphic card (mostly for the non-3D guest). Again wish that virtual box would allow more like up to 1GB. For 3D, there is option setting when you go into the setting of that VM to enable the graphic card to 3D. (see attachment)

You don't have permission to view the spoiler content. Log in or register now.

I will try to find the link to the source for you if needed.

** Additional edit - 12MAY2024 **

I may had left out additional points to be aware of. The vCPU/Processors and vRAM/RAM also factors into the performance as well not only based on the graphic RAM/GPU.

You don't have permission to view the spoiler content. Log in or register now.

You don't have permission to view the spoiler content. Log in or register now.

Since there may need additional tweaking over time, however when the AVN/game or any other unknown application been executing that demands more performance. Two two primary factors that may need to be tweak first would be vCPU/Processor and/or vRAM/RAM. Recommend only make one adjustment and determine if the the application performance is better in the Guest VM. If not then revert the change and change the other possible virtual hardware that needs tweak. In some case both vCPU and vRAM may need to be tweak. At this moment, I had found a reasonable balance form VM Guests.

I already rebuild my two VM guests as template/default that is clean installation.
You don't have permission to view the spoiler content. Log in or register now.

I would clone the template VM as a new VM, then tweak the vCPU, vRAM, (If needed enable 3D for graphic card), and disable vNIC. I would use that for anything to be tested or so. Regarding to the application data, you can mount share drive (from the host, as read only) to mount to copy the application data or enable one way clipboard feature to copy application data over from host to VM Guest.

I hosted my virtual machine on my laptop, most people may host their virtual machine on their desktop.

** End of "Additional edit - 12MAY2024" message **

Have a great day and be safe... (y)
Thanks for the info!

I'm somewhat surprised your VirtualBox solution works well enough because with VirtualBox the support for 3D acceleration is very outdated and there is NO GPU pass-through. Basically all 3D support depends on how well VirtualBox does API Remoting. One thing that apparently doesn't work through API Remoting is any kind of video acceleration. Which would mean that Ren'Py games playing videos from time to time (for animations) could show some serious performance issues. Again, I'm surprised it works good enough for you.
 

WheresLucifer

Well-Known Member
Sep 1, 2018
1,235
1,195
I did try to test out Hyper-V, not impress with it since limited to what I like to do. Hyper-V reminds me of VMware ESXi, pretty much you need a client to access it to manage it remotely. For Virtualbox and VMware Workstation, you can manage it on standalone of they host.

I was pleased to be able to get the 3D function to work, however there more testing and tweaking I will need to do. At mean time, hopefully each future update from VirtualBox may make some improvement.

For Ren'PY AVN/games, I have not come across any that didnt work well. There may be very few that the performance is not as good, but manageable. For Unity games, might be a big "no-no" since Unity demands more GPU as well possible more RAM.

Since VirtualBox is more of an Open Source project, I am sure there may be number of request for Oracle to improve the GPU tools for the VM, however I do not think there is high demand for that.however that does not prevent me to do additional testing to find alternate method to improve the GPU performance.

Have a great day and be safe... (y)
 
  • Like
Reactions: manneychin

skwada

Newbie
Feb 13, 2020
79
211
I understood your answer but I wasn't asking if games run better in a VM with a GPU pass-through vs. a VM without.
I was asking how much better games run directly on your Windows PC (the classic way, no VM) vs. in a VM with a GPU pass-through. Meanwhile, I gathered more info. and it seems the penalty for the latter is not significant (at least for porn games) especially if you don't simultaneously run another game in the underlying/host Windows PC.
This conclusion is good enough for me, no need to dig further for now.

What do you use to connect to the VM and actually see the game (i.e. get display out from the VM)?

The github solution from jamesstringerparsec uses Parsec (now I'm also clear why, he's a Parsec employee).
You said you don't use Parsesc. Do you use the Virtual Machine Connection tool (AKA VMConnect) and then switch to full screen or do you connect using something else? To be clear, by Virtual Machine Connection tool I mean this:
You don't have permission to view the spoiler content. Log in or register now.
Sorry, misread your original message. Personally I can't tell any performance difference between running on the baremetal host vs. in a VM for the games I've played, but I pretty much exclusively play VNs - never tried RPGM or those 3d games made with Unreal/Unity.

And yep I use vmconnect to access the VM. The most important thing is you need to have enhanced session mode enabled, which iirc is only available if your VM is running Pro or Enterprise Windows.
 
  • Like
Reactions: manneychin

WheresLucifer

Well-Known Member
Sep 1, 2018
1,235
1,195
skwada Only bare-metal virtualization I can think of and worked with is VMware ESX/ESXi. I havent used/tested any other alternate bare-metal virtualization beside VMware. Microsoft Hyper-V usually depends on Microsoft OS that support it, However I know in mid 2010's Microsoft did a light-weight server OS version (I believe it started with Windows 2016) that may support Hyper-V with limited of the GUI on the host, unlike VMware ESXi is a none GUI OS, and even a very light weight UNIX/Linux OS. Otherwise most of other virtualization need to have an OS to host the virtualization platform.

* Additional notes * I cannot recommend anyone to use VMware ESXi due to general users do not need or use it in their daily life or so. I would recommend only the following three: Oracle Virtual Box, VMware Workstation, and/or Microsoft Hyper-V that are available to be installed on their system OS.

Have a great day and be safe... (y)
 
Last edited:

skwada

Newbie
Feb 13, 2020
79
211
skwada Only bare-metal virtualization I can think of and worked with is VMware ESX/ESXi. I havent used/tested any other alternate bare-metal virtualization beside VMware. Microsoft Hyper-V usually depends on Microsoft OS that support it, However I know in mid 2010's Microsoft did a light-weight server OS version (I believe it started with Windows 2016) that may support Hyper-V with limited of the GUI on the host, unlike VMware ESXi is a none GUI OS, and even a very light weight UNIX/Linux OS. Otherwise most of other virtualization need to have an OS to host the virtualization platform.

* Additional notes * I cannot recommend anyone to use VMware ESXi due to general users do not need or use it in their daily life or so. I would recommend only the following three: Oracle Virtual Box, VMware Workstation, and/or Microsoft Hyper-V that are available to be installed on their system OS.

Have a great day and be safe... (y)
When I said baremetal I just meant the host os, i.e. running games directly on the hw with no abstraction
 

manneychin

Member
May 8, 2017
404
1,099
skwada Only bare-metal virtualization I can think of and worked with is VMware ESX/ESXi.
Both ESX and Hyper-V are classified as Type-1, native or bare-metal hypervisors.
VMware Workstation and VirtualBox are Type-2 or hosted hypervisors.

Hyper-V is confusing because it comes packaged in many different ways with its associated "console"/administrative OS but wherever it's enabled and there are .
ESXi always comes with a very minimal footprint (including its console OS) and so it more easily "feels" like a more bare-metal hypervisor no matter how you look at it but both ESXi and Hyper-V have the same level of control on the hardware wherever they run.

Hyper-V "silently" turns the Windows where it's enabled into a special VM (AKA root partition) that retains direct access to most hardware and gains the ability to administer Hyper-V itself. However, any VMs you add will run side by side with the root partition VM, it's just an illusion that the latter is somehow still beneath the VMs you add later.

You can enable Hyper-V on a long list of Windows editions and that's why it "feels" different. On Windows 10/11 it definitely feels like the VMs run on top of the root partition VM but they don't. On Windows Server Standard Edition (or higher) the feeling is the same while on Windows Server Core Edition the feeling is more similar to ESXi because Core is stripped down and you can't run much of anything directly on this edition.