Skip to content
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

nv2a: Re-create surface on anti-aliasing mismatch #654

Conversation

abaire
Copy link
Contributor

@abaire abaire commented Jan 14, 2022

Updates surfaces that are created with one anti-aliasing setting and then written to after the anti-aliasing setting is changed.

Fixes #652

Test
HW Results

Updating to capture the context:

The problem is that the game does 3D rendering to the framebuffer with anti-aliasing enabled, then switches to doing direct CPU writes. xemu creates a SurfaceBinding for the 0x97-based renders, then erroneously continues to use it for the final blit in nv2a_get_framebuffer_surface. In hardware, only AvSetDisplayMode should have an effect on the interpretation of the framebuffer.

@Triticum0
Copy link

Do you think this fix will have any affect on #572 or are they unrelated will retest once this pr merged

@abaire
Copy link
Contributor Author

abaire commented Jan 14, 2022

Do you think this fix will have any affect on #572 or are they unrelated will retest once this pr merged

Looking at that screenshot and video I'd guess there's a different problem, but it's hard to say. In general I'd expect this PR to only fix issues where videos are doubled or quadrupled; I'm not sure if that happens in any games other than Pirates since the conditions to trigger the bug are pretty particular (surface created with AA, then AA disabled but the original surface still used and considered valid by xemu).

Definitely worth testing to verify, and if somebody wants to get a pgraph log w/ https://github.com/mborgerson/xemu/blob/master/hw/xbox/nv2a/debug.h#L32, https://github.com/mborgerson/xemu/blob/master/hw/xbox/nv2a/pgraph.c#L27, and https://github.com/mborgerson/xemu/blob/master/hw/xbox/nv2a/pgraph.c#L28 enabled that'd be helpful.

@Triticum0
Copy link

I should definitely fix NHL 2002 because it's Fmv quadrupled but it flicked back and forth between quadrupled and 1x but i still need to test to confirm if that the case
nhl
nhl 2

@abaire abaire force-pushed the fix/recreate_surface_on_format_mismatch branch from d42c761 to 4a011dd Compare April 27, 2022 14:51
@abaire abaire force-pushed the fix/recreate_surface_on_format_mismatch branch 2 times, most recently from bafe560 to 175b9b7 Compare June 27, 2022 16:49
@abaire abaire marked this pull request as draft June 27, 2022 17:33
@abaire
Copy link
Contributor Author

abaire commented Jun 27, 2022

Looks like this causes Forza to crash with a mismatched color/zeta assert.

I also wrote a test case trying to repro the behavior in Pirates... and found different broken behavior that isn't fixed with the current state of this PR.

@abaire abaire force-pushed the fix/recreate_surface_on_format_mismatch branch from 175b9b7 to c7a9295 Compare June 28, 2022 13:58
@abaire
Copy link
Contributor Author

abaire commented Jul 1, 2022

Closing in favor of #1146.

@abaire abaire closed this Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pirates: The Legend of Black Kat - FMVs are rendered as side-by-side duplicates
2 participants