xemu-project / xemu

Original Xbox Emulator for Windows, macOS, and Linux (Active Development)
https://xemu.app
Other
2.75k stars 275 forks source link

nv2a: Add Vulkan renderer #1701

Open mborgerson opened 2 months ago

mborgerson commented 2 months ago

Issues:

Note to testers:

Triticum0 commented 2 months ago

WTF, how long have you been working on this render? Also need any help test give me a shout and i be happy to help.

HadetTheUndying commented 2 months ago

Hey Matt, i haven't been around in awhile but is it possible to bundle moltenVK with this or is there any interest in porting to Metal API as well? I'll do some testing on my vacation next week.

Lagahan commented 2 months ago

Significantly improved performance in Mercenaries (2x scaling, Windows, 7800x3d, 4090) OGL 1x render scale couldn't hit 60fps in this scene, nvm 2x!

OGL: (RTSS' fps & frametime measurements freak out when fps drops below fullspeed) Screenshot 2024-07-23 001258 Vulkan: Screenshot 2024-07-23 001123

Spidy123222 commented 2 months ago

Hey Matt, i haven't been around in awhile but is it possible to bundle moltenVK with this or is there any interest in porting to Metal API as well? I'll do some testing on my vacation next week.

There is interest just will take some work as there is stuff needed to be changed to work under moltenvk. Probably won't be in the pr but we will have to see.

Lagahan commented 2 months ago

Assertion when entering gameplay in Black (1x scale): image

Similar assertion in Red Dead Revolver when changing scaling to 4x (1-3x are fine) image

rizaumami commented 2 months ago
~$ xemu
xemu_version: 0.7.130-13-gaa73f217d4
xemu_branch: pr-1701
xemu_commit: aa73f217d4f71f8d73d8a6f08d730a4cac728299
xemu_date: Tue Jul 23 11:58:15 AM UTC 2024
xemu_settings_get_base_path: base path: /home/anu/.local/share/xemu/xemu/
xemu_settings_get_path: config path: /home/anu/.local/share/xemu/xemu/xemu.toml
CPU: 
OS_Version: Debian GNU/Linux trixie/sid
GL_VENDOR: Intel
GL_RENDERER: Mesa Intel(R) Arc(tm) Graphics (MTL)
GL_VERSION: 4.6 (Core Profile) Mesa 24.1.3-2
GL_SHADING_LANGUAGE_VERSION: 4.60
Created QEMU launch parameters: xemu -machine xbox,bootrom=/mnt/data/Software/XEMU/Boot ROM image/mcpx_1.0.bin,kernel-irqchip=off,avpack=hdtv -device smbus-storage,file=/home/anu/.local/share/xemu/xemu/eeprom.bin -bios /mnt/data/Software/XEMU/BIOS/Complex_4627.bin -m 128 -drive index=0,media=disk,file=/mnt/data/Software/XEMU/ogxhd.img,locked=on -drive index=1,media=cdrom,file=/mnt/data/Software/XEMU/Halo - Combat Evolved/Halo - Combat Evolved.iso -display xemu -device usb-hub,port=1,ports=4 
WARNING: Image format was not specified for '/mnt/data/Software/XEMU/ogxhd.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
Enabled instance extensions:
- VK_KHR_surface
- VK_KHR_xlib_surface
- VK_KHR_get_physical_device_properties2
- VK_KHR_external_semaphore_capabilities
- VK_KHR_external_memory_capabilities
Available physical devices:
- Intel(R) Arc(tm) Graphics (MTL)
- llvmpipe (LLVM 17.0.6, 256 bits)
Selected physical device: Intel(R) Arc(tm) Graphics (MTL)
- Vendor: 8086, Device: 7d55
- Driver Version: 24.1.3
xemu: ../hw/xbox/nv2a/pgraph/vk/instance.c:450: select_physical_device: Assertion `r->device_props.limits.maxPushConstantsSize >= vsh_attr_values_size' failed.
Aborted
rizaumami commented 2 months ago

Artifact when using Vulkan renderer. \ OpenGL works fine, except for no HUD in Halo 2.

simplescreenrecorder-2024-07-24_13.30.35.webm

AppImage log. ``` ~$ ./xemu-v0.7.131-33-g81b72e79bc-x86_64.AppImage xemu_version: 0.7.131-33-g81b72e79bc xemu_branch: xemu_commit: 81b72e79bcbdbb42a65e9df7041f67a487c4ab25 xemu_date: Wed Jul 24 05:31:08 UTC 2024 xemu_settings_get_base_path: base path: /home/anu/.local/share/xemu/xemu/ xemu_settings_get_path: config path: /home/anu/.local/share/xemu/xemu/xemu.toml CPU: OS_Version: Debian GNU/Linux trixie/sid GL_VENDOR: Intel GL_RENDERER: Mesa Intel(R) Arc(tm) Graphics (MTL) GL_VERSION: 4.6 (Core Profile) Mesa 24.1.3-2 GL_SHADING_LANGUAGE_VERSION: 4.60 Created QEMU launch parameters: ./xemu-v0.7.131-33-g81b72e79bc-x86_64.AppImage -machine xbox,bootrom=/mnt/data/Software/XEMU/Boot ROM image/mcpx_1.0.bin,kernel-irqchip=off,avpack=hdtv -device smbus-storage,file=/home/anu/.local/share/xemu/xemu/eeprom.bin -bios /mnt/data/Software/XEMU/BIOS/Complex_4627.bin -m 128 -drive index=0,media=disk,file=/mnt/data/Software/XEMU/ogxhd.img,locked=on -drive index=1,media=cdrom,file=/mnt/data/Software/XEMU/Halo_2.iso -display xemu -device usb-hub,port=1,ports=4 WARNING: Image format was not specified for '/mnt/data/Software/XEMU/ogxhd.img' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. Enabled instance extensions: - VK_KHR_surface - VK_KHR_xlib_surface - VK_KHR_get_physical_device_properties2 - VK_KHR_external_semaphore_capabilities - VK_KHR_external_memory_capabilities Available physical devices: - Intel(R) Arc(tm) Graphics (MTL) - llvmpipe (LLVM 17.0.6, 256 bits) Selected physical device: Intel(R) Arc(tm) Graphics (MTL) - Vendor: 8086, Device: 7d55 - Driver Version: 24.1.3 Enabled device extensions: - VK_KHR_external_semaphore - VK_KHR_external_memory - VK_KHR_external_memory_fd - VK_KHR_external_semaphore_fd - VK_EXT_custom_border_color - VK_EXT_provoking_vertex - VK_EXT_memory_budget ```
System spec. ``` ~$ inxi -SG System: Host: sid Kernel: 6.9.10-amd64 arch: x86_64 bits: 64 Desktop: Cinnamon v: 6.0.4 Distro: Debian GNU/Linux trixie/sid Graphics: Device-1: Intel Meteor Lake-P [Intel Arc Graphics] driver: i915 v: kernel Device-2: SenseTek FHD Camera driver: uvcvideo type: USB Display: x11 server: X.Org v: 21.1.11 with: Xwayland v: 24.1.0 driver: X: loaded: modesetting unloaded: fbdev,vesa dri: iris gpu: i915 resolution: 2880x1920~120Hz API: EGL v: 1.5 drivers: iris,swrast platforms: gbm,x11,surfaceless,device API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.1.3-2 renderer: Mesa Intel Arc Graphics (MTL) ```
mborgerson commented 2 months ago

@rizaumami Can you please try the latest build and see if that resolves your issue

rizaumami commented 2 months ago

@rizaumami Can you please try the latest build and see if that resolves your issue

Still have the same issue in 0.7.131-34-ged26a2383d.

mborgerson commented 2 months ago

@rizaumami Can you please try the latest build and see if that resolves your issue

rizaumami commented 2 months ago

@rizaumami Can you please try the latest build and see if that resolves your issue

Still have the issue in 0.7.131-36-g5d49845579 It's not only in a game but also in the Microsoft dashboard, so not game issue. The orangish colour in Halo 2 is different issue (#952?)

simplescreenrecorder.webm

Triticum0 commented 2 months ago

James Bond 007: From Russia with Love has Visual artifact on vulkan xemu-2024-07-24-23-16-42

Switching to opengl back to vulkan fixes the issue but need a proper fix

also are some performance issue at certain areas that shouldn't be so demand but way better that opengl

Triticum0 commented 2 months ago

Breakdown exhibit worse performance on vulkan than opengl Vulkan 20f/15ps Opengl 30/25fps

Triticum0 commented 2 months ago

also seen that some game namely crazy taxi 3. have visible seams which aren't present on opengl opengl xemu-2024-07-25-00-10-23 Vulkan xemu-2024-07-25-00-10-31

Triticum0 commented 2 months ago

Total Immersion racing sound volume bars and car stat bars are not rendered on vulkan correctly. vulkan xemu-2024-07-25-13-48-30 xemu-2024-07-25-14-04-01

opengl xemu-2024-07-25-13-48-36 xemu-2024-07-25-14-04-09

Mechanism8 commented 2 months ago

Unreal Championship 2 crashes on Vulkan after loading the match (regardless of resolution scaling) xemu1

thatsprettygood commented 2 months ago

https://github.com/xemu-project/xemu/issues/109#issuecomment-750730004

Regarding performance: Vulkan does offer a lot of flexibility but, based on my experimental work, GL is more than capable of reaching xemu performance targets.

Is this still true?

mborgerson commented 2 months ago

@thatsprettygood

Is this still true?

GL is still capable, depending on the machine and driver vendor; and xemu GL renderer still has room for perf improvement.

mborgerson commented 2 months ago

@Mechanism8

Unreal Championship 2 crashes on Vulkan after loading the match

Thanks for testing. This affects a few games (screenshots above) and will be fixed

mborgerson commented 2 months ago

@HadetTheUndying

is it possible to bundle moltenVK with this or is there any interest in porting to Metal API as well? I'll do some testing on my vacation next week.

Yes, definitely. I've already done some initial work on this. moltenVK won't work out of the box, we'll need to rework some things (eg geometry shaders and some other GL compat extensions). It will happen soon(ish) after initial Windows/Linux support

Triticum0 commented 2 months ago

If your going to rewrite pvideo for vulkan you might want to look fixing these issue also #1197 some might not be pvideo related also abaire half finished contributions .

Also antz extreme racing missing intro videos

Triticum0 commented 2 months ago

Work size group issue also affects Syberia and Jade Empire

Fixed

Triticum0 commented 2 months ago

games which have worse performace on vulkan

mborgerson commented 2 months ago

@Triticum0

Work size group issue also affects Syberia and Jade Empire

Should be fixed

Blackbird88 commented 2 months ago

Getting this error in Crash Bandicoot:WotC image

Triticum0 commented 2 months ago

The Jade empire character select screen does not render correctly in Vulkan also affects ingame background textures. Vulkan xemu-2024-07-27-09-54-15 xemu-2024-07-27-09-59-27

Opengl xemu-2024-07-27-09-54-46

mborgerson commented 2 months ago

@Blackbird88

Getting this error in Crash Bandicoot:WotC

Thanks, fixed

Triticum0 commented 2 months ago

kung fu chaos doesn't render on vulkan switch from opengl to vulkan fixes the issue though back out to menu and restarting the mission will casue it to happen again

Vulkan

xemu-2024-07-27-21-49-12

Opengl xemu-2024-07-27-21-49-20

Lagahan commented 2 months ago

Confirming workgroup sizes now fixed on Black & RDR New issue with Mercenaries minimap/HUD: Screenshot 2024-07-27 232837

Dovey79 commented 2 months ago

AMD 5900hx built in vega AMD 23.5.1 video driver Win 10

Performance drop across all games 20-50%. Examples:

Outrun2 opengl 40fps / vulkan 30fps DOA3 opengl 59fps / vulkan 32fps GTA-VC opengl 23fps / vulkan 13fps Halo2 opengl 29fps /vulkan 20fps Soul cal2 opengl 59fps / vulkan 40fps

Keep up the good work :)

Wdub888 commented 2 months ago

I tested this in a low end laptop and yeah there is some performance drop in some games. For example in NBA Live 2005 there is a 12fps lock.

Opengl: Screenshot (9)

Vulkan: Screenshot (10)

ehw commented 2 months ago

Phantasy Star Online: Episode 1 & 2 doesn't render the skybox properly.

PR (0.7.131-95-g34a0890dae) (Vulkan): image

PR (0.7.131-95-g34a0890dae) (OpenGL): image

One thing I noticed is that performance is hugely improved in games where even a slight adjustment to internal resolution causes the frame rate to tank. Games like Sega GT 2002 was one such game where even 2x on a GeForce 3080 is enough to cut the framerate by a 1/3rd. With the Vulkan renderer, you can reach 60FPS at 4x. Very good stuff. :)

OpenGL (4x): image

Vulkan (4x): image

Amazing job!

mborgerson commented 2 months ago

@Lagahan

Confirming workgroup sizes now fixed on Black & RDR New issue with Mercenaries minimap/HUD

Should be fixed now

mborgerson commented 2 months ago

@Triticum0

The Jade empire character select screen does not render correctly in Vulkan also affects ingame background textures.

Looks fixed now based on report on Discord. Please confirm

mborgerson commented 2 months ago

@ehw

Phantasy Star Online: Episode 1 & 2 doesn't render the skybox properly.

Can you try latest and see if this is fixed

mborgerson commented 2 months ago

@Triticum0

Total Immersion racing sound volume bars and car stat bars are not rendered on vulkan correctly.

kung fu chaos doesn't render on vulkan switch from opengl to vulkan fixes the issue though back out to menu and restarting the mission will casue it to happen again

Can you check if these issues are still happening on latest

ehw commented 2 months ago

@ehw

Phantasy Star Online: Episode 1 & 2 doesn't render the skybox properly.

Can you try latest and see if this is fixed

No change, still broken. The skybox shows a piece of the actual skybox texture with no distortion, it was doing that before however. The skybox moves so that's why it's a bit different in this shot.

image

Dovey79 commented 2 months ago

Total immersion is tricky. Doesn't boot very well the one time it did boot the volume bars were the same. Didn't get a screenshot. Sorry.

GTA VC Screenshot 2024-07-30 225117

GTA SA Screenshot 2024-07-30 225634

GTA 3 Game option blur off is washed out colours but blur on is good. Screenshot 2024-07-30 230614 Screenshot 2024-07-30 230659

Great improvements so far. Really nice work

ehw commented 2 months ago

Black Stone: Magic & Steel

The opening FMV doesn't display video with the Vulkan backend. It works with OpenGL even switching between the two while the game is running. This game uses Bink video.

OpenGL: image

Vulkan: image

Forza Motorsport also has the same bug on it's Microsoft Studios FMV but I don't think Forza uses Bink video.

Group S Challenge also has the same bug on it's FMVs. Not sure what codec it uses.

Futurama also has the same issue with it's FMVs. They seem to display the first frame of the video in Vulkan but only OpenGL plays the entire thing.

Triticum0 commented 2 months ago

Had the same issue above with Total immersion can't boot to the game. even tested with different versions of the emulator as well as different hard drive and had no luck going to redump the game it to see if it the issue. If not have to create an issue for it.

With jade empire make it in game thought texture seem to flicker in and out of Existence and shadow not rendered. thought shadow on opengl and also broken.

Vulkan xemu-2024-07-30-23-39-22

Opengl xemu-2024-07-30-23-40-18

Lasty kung fu chaos has no change to the last build I tested

Lagahan commented 2 months ago

@Lagahan

Confirming workgroup sizes now fixed on Black & RDR New issue with Mercenaries minimap/HUD

Should be fixed now

Yep fixed!

ehw commented 2 months ago

Gauntlet: Dark Legacy:

The effect that plays when you press the A button on hints/messages in game displays incorrectly in the Vulkan backend but works in the OpenGL one. It's as if the effect plays behind the window and doesn't affect what's in front. You can easily test this by standing near the barrier at the hub level, and just wait for the message to pop up. As long as you stand in the spot that spawns the messages, it will pop up every few seconds or so.

OpenGL: image

Vulkan: image

This game also doesn't display any FMVs properly. I'm not sure what codec they use.

ehw commented 2 months ago

Group S Challenge:

There are shadow issues on the cars both in the car select menu and in game that aren't present in the OpenGL renderer:

OpenGL: image image

Vulkan: image image

The FMVs display in the OpenGL renderer but not in the Vulkan one. Only the sound plays.

AzurikRiseOfPerathia commented 2 months ago

Azurik Vulkan and very good optimization ! Can now go from State to Playable! If Vulkan applies in V0.7.132

There are still some random crashes and lags that look like loading lags! Also like before the laggy cutscenes too!

Version V0.7.131-100-g29ecda6242

Vulkan: 2024-07-31_013242

OpenGL: 2024-07-31_013316

Extra-Laggy Zone Vulkan: 2024-07-31_013414

OpenGL: 2024-07-31_013433

Fabxx commented 2 months ago

Splinter cell double agent meter does not render properly with lastes vk branch.

GL:

https://github.com/user-attachments/assets/7de4a60b-7643-4516-8d3c-2d68c6f421f2

VK:

https://github.com/user-attachments/assets/969c0554-b098-4054-a130-c6a44361c127

System info:

CPU: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz OS Platform: Linux OS Version: Debian GNU/Linux 12 (bookworm) Manufacturer: NVIDIA Corporation GPU Model: NVIDIA GeForce RTX 3060/PCIe/SSE2 Driver: 4.0.0 NVIDIA 550.78 Shader: 4.00 NVIDIA via Cg compiler

branch details:

Version: 0.7.131-103-ge4fd029318 Branch: feat/vulkan Commit: e4fd02931858197950b17648852a1fea8af6d6be Date: mer 31 lug 2024, 07:35:18, UTC

Wdub888 commented 2 months ago

Replay performance issues in NBA 2K5 is in much better state in vulkan than opengl (tested in low end machine). but there is some flickering when you play in team courts that isn't present in opengl. OpenGL: Screenshot (14) Vulkan: Screenshot (20)

mborgerson commented 2 months ago

@ehw

Phantasy Star Online: Episode 1 & 2 doesn't render the skybox properly.

Can you try latest and see if this is fixed

No change, still broken. The skybox shows a piece of the actual skybox texture with no distortion, it was doing that before however. The skybox moves so that's why it's a bit different in this shot.

Can you try latest and see if this is fixed

ehw commented 2 months ago

@ehw

Phantasy Star Online: Episode 1 & 2 doesn't render the skybox properly.

Can you try latest and see if this is fixed

No change, still broken. The skybox shows a piece of the actual skybox texture with no distortion, it was doing that before however. The skybox moves so that's why it's a bit different in this shot.

Can you try latest and see if this is fixed

Fixed! Thank you! I forgot to mention that while I played through the game a little bit I noticed there were some other textures that looked stretched in certain areas but it only affected very specific parts on the map geometry. This seems to fix it though.

ehw commented 2 months ago

I forgot to ask. I know it might not be appropriate to ask for additions here, but I wanted to ask if you could add a keyboard shortcut and/or a toggle under View to switch between the backends. This would make testing and comparing OpenGL/Vulkan easier so you don't have to go into the settings menu to select it, or take screenshots and compare them separately. This will help find smaller differences between the two backends by switching back and forth in real time. It's not super important, but I wanted to ask just in case the thought hasn't occurred before.

I went through my whole library of games (which is around 80 or so) to find graphical issues and I couldn't find anymore. Anything else might require some thorough playthroughs for me. :)

mborgerson commented 2 months ago

@ehw

add a keyboard shortcut and/or a toggle under View to switch between the backends

Sure

I went through my whole library of games (which is around 80 or so) to find graphical issues and I couldn't find anymore. Anything else might require some thorough playthroughs for me. :)

Thanks, everyone's testing has been helpful