CarlKenner / dolphin

Dolphin is a GameCube/Wii emulator, allowing you to play games for these two platforms on PC, with improvements.
GNU General Public License v2.0
137 stars 28 forks source link

Click the "Graphics" button during Metroid 1 alters rendering behavior. #9

Closed cegli closed 9 years ago

cegli commented 9 years ago

When just starting the game, the EFB copy clear disabling isn't activated, and there is judder. Hitting the "Graphics" button on the first platform/level causes judder to go away and locks the game to a smooth 75fps, but a copy of Samus appears in the upper left corner of my view disabling EFB Copy clears suddenly starts working again. The Samus EFB copy clear disabling doesn't go away until I restart the game, including if I load an old saved-state where the Samus didn't used to appear the copy clears previously hadn't gotten disabled correctly (only played a couple more minutes afterward).

This can be quickly reproduced by loading a save state on the first platform and then hitting the graphics button.

Ideally it should always run as smooth as after the "Graphics" button is hit, but without the Samus copy in the corner the copy clears disabled correctly, like after the "Graphics" button is hit. This didn't happen in the commit before I merged S3D and your latest work. At that point it was always low frame-rate and choppy, so this is still a big improvement!

CarlKenner commented 9 years ago

I can't replicate this bug. Samus does not appear in the corner since S3D, and shadows are working perfectly. I can't test choppiness on my computer because it is too slow.

cegli commented 9 years ago

Oh weird... I wonder why it happens on mine and Fugazi's computer? I will try and check with Fugazi to see what his configuration is.

CarlKenner commented 9 years ago

I thought it happened on fugazi's computer because he was using the version before S3D was merged, where I do see the bug.

cegli commented 9 years ago

I think I found out why you couldn't replicate it. The Samus only appears if you have "Remove Blank EFB Copy Box" checked. It almost seems like disabling EFB Copies isn't happening until the graphics button is hit. I noticed this is happening in Okami too.

In Mario Kart Wii the behavior is different. If you start with both "Remove Blank EFB Copy Box" and "EFB Copies Disabled" it works fine without hitting the graphics button, and the EFB box is removed. If you start a race with only "EFB Copies Disabled", but not "Remove Blank EFB Copy Box", the black box only appears in one eye, until the Graphics button is hit and then it appears in both eyes.

Something screwy is going on... These tests were all done in D3D by the way.

CarlKenner commented 9 years ago

The Samus appearing isn't a bug, it's a feature (that you added) working exactly the way you designed it to work. The second EFB copy/clear which clears the Samus, is having its clear skipped, because you told it to. So I corrected your bug report.

The reason Mario Kart Wii behaves differently is probably because you added the EFB copy clear disabling to the game's INI file. Did you also set EFBCopyClearDisable to false in metroid's INI file? Because that would explain the behaviour you are seeing, and like it or not, that is how Dolphin is supposed to behave.

Things rendering in only one eye are impossible when it is in stereoscopic 3D mode. At some point it must think it is not in stereoscopic 3D mode and do some rendering that way, and that rendering isn't being cleared. Or there's a problem with changes you or I made to clearing that make them only affect one eye.

You need to pause Visual Studio before opening the graphics option, then look at the contents of g_Config, then unpause, open graphics, pause, and look at the contents of g_Config again to see what has changed.

cegli commented 9 years ago

About the Samus appearing, of course the rendering behavior is expected with the feature enabled, but that's not the point. The point is that it should be there without having to hit the graphics button.

I don't have any of these things set in the game's .ini file. For instance, this is my entire metroid .ini: [RmObjCodes_Enabled] $Remove 16:9 Bars [ActionReplay_Enabled] $Disable Culling of Terrain Outside Camera View $Disable Culling of Special Functions Outside Camera View $Disable Culling of Wallcrawler Swarms Outside Camera View $Disable Culling of Particles Outside Camera View $Disable Culling of Unknown Outside Camera View

My Okami .ini: [RmObjCodes_Enabled] $Broken VR HUD Removal - 1

As you can see, this is still a bug. I'm not sure why you can't reproduce it. I will try and track it down. I've figured it out, see below. It's actually a bug that has been fixed that is causing the new behavior.

Edit: I've found in the debugger that "g_ActiveConfig.bEFBCopyEnable" is starting "true" regardless of what the actual setting is. As soon as "graphics" button is hit, it goes to its correct value. This happens even after I've deleted all my "GameSettings" and dolphin.ini/gfx_dx11.ini/gfx_opengl.ini. This also was happening in the original S3D branch, but not in VR-Hydra 5035.

Edit 2: I've found what happened. The default game's .ini file in the sys/data folder specifies that EFBCopyEnable = True. This was never noticed before, because we had a bug in previous versions where we ignored those values. I can confirm that both 5035 and trunk have the same .ini, but they are loading them differently. I guess the new behavior is the proper behavior, but we will have to adjust .ini files to the right values for VR. Users will be confused that their game is rendering differently than in the past.

I've been thinking, we should have a section in the .ini files for defaults for VR and not VR. For instance, in Okami the game is unplayable without EFBCopyEnable = False and "Remove Blank EFB Copy Box" = True. The Broken VR HUD Removal - 1 code should be on by default as well. We don't want this behavior for non VR.

I will close this, but I guess we should retest games and figure out the .ini files. It is probably best to implement the VR.ini override soon, so we don't have to change the settings for both VR/Non-VR at once, which could get messy quick.

The Mario Kart bug must be a different bug, but it's pretty minor. Too many other bigger ones to worry about for now.

cegli commented 9 years ago

Okay, this has been fixed in https://github.com/cegli/dolphin/commit/8adbef889e14296cebfdd11fa2c1f72193a9a6b6, so this can be closed. Interestingly, this unveiled a new bug where the EFB Copy Square only gets rendered in one eye if "EFBEmulateFormatChanges" = True. Not a big deal, because there is a workaround for now (turn it off). Should be looked at eventually though.

CarlKenner commented 9 years ago

OK. That isn't a bug then, that is the expected behaviour. I don't really agree with the expected behaviour, but that's the way the Dolphin team designed it. Games have default settings that get instantly overwritten when you open the graphics options, even if you don't change anything. Dolphin does actually warn you about that when you start the game, but it might only be via the OSD which I haven't implemented yet in VR. The reason EFB copies are required to be enabled in Metroid Prime is because some of the visors don't work properly without it. In this particular case, the EFB copy is used for the subtle shadow under Samus, which won't be there if you disable EFB copies. And the first EFB copy (that doesn't have its clear skipped) is used for the shadows of terrain objects. I'll have to investigate why games are loading those values differently than before. That is strange. BTW, don't forget that there are two sys/data folders. One in the source code that gets copied into the one in the binary folder whenever the DolphinWX project is rebuilt (but not when your changes don't require DolphinWX to be rebuilt). I agree that we should have VR versions of the settings, but I don't have time to go through and copy all the settings into the VR section, and usually you want/need the settings specified there. So I think it should load the normal game ini settings first, then load the vr game ini settings which can override them.

I'm sure the EFBEmulateFormatChanges bug will be fixed soon, which is the proper way to fix that particular issue. Maybe we need to let the main dolphin team know about it.

Well done tracking that down.

BTW, SafeTexutreCacheColorSamples = 512 is the middle option between Safe and Fast texture caching.