-
-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spy-vs-Spy: Main menu geometry is corrupt #1072
Comments
Vertex shader:
Filtered for the bits that contribute to
Some initial values:
Some values stepping through with the above inputs (in xemu):
|
I see unhandled pgraph commands between 0x1e80 and 0x1e90 in the logs but they only happen after some of the draws. They also happen in a potentially interesting sequence; vertex shader constants start loading at 0x60 (96, the start of the typical user-configurable constant range), then 0x1e80,84,88,8c, 90, then constants continue loading at 0x7D (125). |
I did investigated this game last year with no progress. but your finding are meaningful. |
ok, after a quick reverse engineering and study, here I have some findings.
|
Interesting, though if that's the case I'm now even more confused about what it does... The transform program that is loaded in the frame is 14 slots, though it's possible that there's a longer program that was loaded earlier during the startup sequence that I didn't capture in my pgraph trace. I suppose it is possible that such a shader could be set up to write to the c registers or it could be populating some output that isn't set by the 14 slot shader above, but the constants used by the 14 slot shader are all explicitly set, and the input values are also explicitly set via |
The shaders could be loaded independently. User can assign the starting slot dusting each load. |
Yeah, that's what I assumed as well. I did a more extensive trace (took a bit as I had to write a utility to convert from pgraph trace to nv2a-vsh asm) and it is explicitly loading a context setting program:
Unfortunately this will be non-trivial to implement as we don't have a good way to emulate writable c-registers. It looks like all of the important registers other than c[125] would be modified by this shader and thus may not match the values being used by xemu. The other constants are all set before the LAUNCH is invoked. |
Damn you’re quick! |
did you press the START and check the in game renderings? the in game renderings uses to have similar issues, should be fixed as well. |
Title
https://xemu.app/titles/5454007c/#Spy-vs-Spy
Bug Description
Note: This is an intentional dup of the generic #309 and #537 so I have a place to put my game-specific analysis.
The main menu in Spy Vs Spy renders with highly distorted geometry, most of the draws are clipped entirely due to the fact that the w component of the programmable vertex shader is very negative.
E.g., one of the screen space vertices:
{320.7315979004, 253.5145263672, 49013.19921875, -100978.4765625}
Expected Behavior
The menu should not be corrupted, and draws should generally be unclipped and projected properly.
xemu Version
Happens in 0.7.39 and has apparently been happening for a long time (or forever), at least since 0.6.2
System Information
CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
OS Platform: Linux
OS Version: Ubuntu 21.10
Manufacturer: NVIDIA Corporation
GPU Model: NVIDIA GeForce GTX 1070/PCIe/SSE2
Driver: 4.0.0 NVIDIA 470.129.06
Shader: 4.00 NVIDIA via Cg compiler
Additional Context
The game uses S32K mode for the vertex positions, which is not something I've come across before. I wrote a quick test to validate xemu's behavior and it seems to align with what I see in HW, so there's something else going on here.
The text was updated successfully, but these errors were encountered: