xemu
xemu copied to clipboard
nv2a: Download overlapping VGA framebuffer surfaces
Fixes #1120
Draft as it still needs testing on Vulkan. Edit: Also seems like it deadlocks during the regression suite.
Hey @Triticum0 can you check the other black menu games to see if any are fixed? I believe you thought #584 might be a similar issue, not sure if there were any others.
Retested rolling and seems unrelated. Tested terminator games which freeze and also unrelated. Tested brother in arms and no change. Tomb raid seems to be slow(14fps on 5700x) due to foliage and lighting.
Water reflections seem to be broken and vulkun causes the foliage and lighting to flicker in and out of existence. Not sure if it appear on opengl too. When it dispears performance shots to 60fps. vga overlap properly using to render though things causing the performance issues. Let me know if they is any other games you want me to test
Thanks for testing!
I have some performance improvements for the typical path that I'll push after I figure out the freezing issue I'm seeing with the pgraph regression tests. I suspect there's something wrong with my dev machine, since it's also freezing without this change.
Edit: Looks like the freezing may be related to an nxdk update in the pgraph tester and not my machine or this PR. I'll roll it back and merge in my performance updates soon-ish.
Performance improvements are applied. It's slightly better on my machine, but still pretty bad. I see about 5 host frame updates per CRTC register modification. Also the offset surface draws continue into gameplay; I had hoped that they would just be during the menu sequence. This means that this particular title has many times as many GL surface downloads as typical titles. We may need to consider some alternative approach (e.g., creating a border surface in GPU memory and merging the GL surface created for the guest draws into it to avoid the round trip to RAM and back).
I'm also seeing very rare texture corruption and crashes when testing this game; unclear if they're related to this change or just a separate issue with this title.
What does the texture corruption look like?
Generally a momentary glitch across the entire screen, often with a fairly strong green component to it.
It's not aligned to the rendered geometry, which makes me suspect it's related to grabbing the framebuffer rather than any issue with the guest-side rendering or the game itself. My guess is that the locking I'm doing when downloading the texture is somehow incorrect and the host-side framebuffer texture ends up containing some uninitialized data due to a race condition.
are you taking about this i think.
https://github.com/user-attachments/assets/16b2e105-7db2-418d-ab01-9f3d64ad5d66
It grass meshes and lighting disapearing and reappering here the frame where it missing
looking at previous build i you can see most foliage missing.
Masters
I complete the first mission on opengl, worst performace I got was about 11 fps.
There an issue with water rendering simiar to Prince of Persia series
also saw some z-fighting and a more obvious example of first behavoir in first puzzle room
https://github.com/user-attachments/assets/45625ef5-8844-4dd8-bde4-6a6208375bec
I also got a renderdoc of rolling which i leave in the git issue
are you taking about this i think.
2025-05-22.11-39-06.mp4
Interesting, it is something like that, but on macOS/M3 it manifests as more distinct uninitialized-looking corruption, often over just part of the window.
It grass meshes and lighting disapearing and reappering here the frame where it missing
I did not notice that in my testing, but I do have other weird behavior (will note below)
There an issue with water rendering simiar to Prince of Persia series
I see this on macOS as well.
With my continued changes trying to find a solution I was able to get some new weird behavior when spinning the camera around where there is sometimes a tiling effect with quadrants of the frame retaining old data while others are updated. It seems to happen most frequently when the water starts to come into frame; as you pointed out previously the framerate dips noticeably when the water is rendered. Seen on both macOS/M3 and Linux/GTX1070
Watch the lower left corner:
https://github.com/user-attachments/assets/964427ca-d2bf-4835-83c1-4f441e5a72b7
I also get very weird occasional updates to the ~64 lines at the top of the screen that necessitated this fix in the first place. I would've expected that data to always remain black, but perhaps we're ending up with multiple GL surfaces within the guest framebuffer. I'll look into it.
I also see a bunch (~27 per frame) of nv2a: EMPTY NV097_SET_BEGIN_END instances right at the opening checkpoint. As this is marked as NV2A_UNCONFIRMED it's possible that it should actually be drawing something but isn't.
Also fixes #1121
I just tested this PR and I'm very impressed with it. Only issues I have with it, it's the water has this yellow color in some areas and a small area on the right side of the screen is mirroring a portion of the left side.
I just tested this PR and I'm very impressed with it. Only issues I have with it, it's the water has this yellow color in some areas and a small area on the right side of the screen is mirroring a portion of the left side.
Thanks. The yellow water is probably not related to the issue this PR addresses and will need to be investigated/fixed separately.
The screen mirroring is more concerning. What are your machine specs (GPU, OS, upscale factor in particular)? I'm surprised to see such a problem manifest horizontally.
I've heard that it's possible to get into the game without this PR; if that's the case I'd be very interested in whether these issues show up without this change or if they're somehow artifacts of the surface downloading I'm introducing.
Ok, I tested it with the latest master release and it does have the mirroring issue as well. I tried 1x upscaled and it doesn't fix it. One thing interesting is that the yellow color doesn't appear on master, but it has other issues like the UI elements don't render at all.
CPU: AMD Ryzen 9 6900HX with Radeon Graphics
OS Platform: Windows
OS Version: 24H2
Manufacturer: ATI Technologies Inc.
GPU Model: AMD Radeon RX 6600M
Driver: 4.0.0 Core Profile Context 25.5.1.250417
Shader: 4.60
Ok, I tested it with the latest master release and it does have the mirroring issue as well. I tried 1x upscaled and it doesn't fix it. One thing interesting is that the yellow color doesn't appear on master, but it has other issues like the UI elements don't render at all.
Thanks for checking!
That top image looks similar to the way signed textures are misrendered, but I'm surprised that master behaves differently. I've never actually played the game before, is the second image supposed to be looking at water? Does water look generally correct on master or is it just broken in another way?
CPU: AMD Ryzen 9 6900HX with Radeon Graphics OS Platform: Windows OS Version: 24H2 Manufacturer: ATI Technologies Inc. GPU Model: AMD Radeon RX 6600M Driver: 4.0.0 Core Profile Context 25.5.1.250417 Shader: 4.60
Excellent; I'm wondering if the mirroring is an AMD-specific issue or if it's just something that only happens on certain levels. It also looks like you do not have the corruption I see at the top of the screen on M3, which is interesting.
If you spin the camera around quickly, do portions of the screen lag? If you look at the video I posted above it captures what I see on M3 and Nvidia GPUs.
I never bothered to go beyond the waterfall on the first level, so I'm not sure if some of these problems just go away, or if they don't appear w/ an AMD card.
Does water look generally correct on master or is it just broken in another way?
Now that I double check, the water in master is less waving than this PR. Like more calm if it makes sense. Maybe is not rendering some extra layer of waves?
Excellent; I'm wondering if the mirroring is an AMD-specific issue or if it's just something that only happens on certain levels. It also looks like you do not have the corruption I see at the top of the screen on M3, which is interesting.
It's all the time present. It looks kind of similar to your issue on the top of the screen except mine is on the right side and larger.
If you spin the camera around quickly, do portions of the screen lag? If you look at the video I posted above it captures what I see on M3 and Nvidia GPUs.
Nope, it doesn't.
https://github.com/user-attachments/assets/10915634-a741-43e9-b1b3-73c6152d818b
Hi @abaire, I retested Tomb Raider Legend today and I found out the culprit of the mirror issue... it was the 480p setting. If I use 720p or 1080i the issue doesn't happen. I was using 480p because some games didn't display correctly at 720p like Soul Calibur II. Since I switched to 1080i, I have no aspect ratio issues with any game. I just wish that Xemu had some crop/overscan? setting to remove the top/bottom black bars that some games have: Soul Calibur II, Tomb Raider Legend, Burnout 3, etc.
Interesting, I wonder if the mirroring is due to the same cause as #2254 then. Thanks for letting me know!
... I just wish that Xemu had some crop/overscan? setting to remove the top/bottom black bars that some games have: Soul Calibur II, Tomb Raider Legend, Burnout 3, etc.
For general awareness, there are feature requests for this in #1262 and #1708 (which I see you commented on)
Interesting, I wonder if the mirroring is due to the same cause as https://github.com/xemu-project/xemu/issues/2254 then.
Most likely, yes. Since it only happens on 480p and the issue looks similar.
For general awareness, there are feature requests for this in https://github.com/xemu-project/xemu/issues/1262 and https://github.com/xemu-project/xemu/issues/1708 (which I see you commented on)
Yes, I know. Sadly, there are no open PRs for it. Even Matt said that it would be a nice feature to have.