ameisen / SV-SpriteMaster

SpriteMaster Mod for Stardew Valley
Mozilla Public License 2.0
13 stars 12 forks source link

Flickering White with SDV 1.5 #2

Closed Velgus closed 2 years ago

Velgus commented 3 years ago

Since updating to SDV 1.5, this mod seems to cause the entire game to flicker white briefly under certain conditions. For example, it seems to happen sometimes when switching between menu tabs. This issue goes away when removing SpriteMaster.

Additionally, unrelated but someone on Nexus Mods reported there is a crash issue on the new volcanic island added by 1.5 - can't verify it myself at the moment. Perhaps something needs to be added to the exclusion list.

ameisen commented 3 years ago

Could you please attach a log file from a run where you encounter the flickering?

pXius commented 3 years ago

Since updating to SDV 1.5, this mod seems to cause the entire game to flicker white briefly under certain conditions. For example, it seems to happen sometimes when switching between menu tabs. This issue goes away when removing SpriteMaster.

Apparently common when opening the backpack.

Additionally, unrelated but someone on Nexus Mods reported there is a crash issue on the new volcanic island added by 1.5 - can't verify it myself at the moment. Perhaps something needs to be added to the exclusion list.

Seen reports on reddit as well. Apparently a slow down and then a crash. Sounds like a memory leak. I'll try to replicate and post logs when I get to that section.

ameisen commented 3 years ago

Thank you.

The log is needed so I can confirm that there isn't a hardware-specific issue, a mod-conflict issue, and also to confirm what the issue actually is.

If you could link to the reports on Reddit, that might be helpful.

SpriteMaster does have a diagnostic mode, if you go into the config.toml, make sure that Config.Debug.Logging.LogInfo is set to true.

Velgus commented 3 years ago

Here's a log of a brief game run. I removed all other mods for the test, and just quickly launched a new save file.

The specific places I could repeatedly make it occur are:

There are probably more, but these cause the white flicker 100% of the time, and are easy to reproduce the moment a new game is launched. I played exclusively with your mod on SDV 1.4, so I know this didn't used to be an issue.

[09:54:10 INFO  SMAPI] SMAPI 3.8.1 with Stardew Valley 1.5.1 on Microsoft Windows 10 Pro
[09:54:10 INFO  SMAPI] Mods go here: E:\Games\SteamLibrary\steamapps\common\Stardew Valley\Mods
[09:54:10 TRACE SMAPI] Log started at 2020-12-28T17:54:10 UTC
[09:54:13 DEBUG SMAPI] Starting game...
[09:54:13 TRACE game] NoFpsCap: This feature is not available
[09:54:15 TRACE SMAPI] Loading mod metadata...
[09:54:15 TRACE SMAPI] Loading mods...
[09:54:15 TRACE SMAPI]    SpriteMaster (from Mods\SpriteMaster\SpriteMaster.dll)...
[09:54:15 TRACE SMAPI]       Loading TeximpNet.dll...
[09:54:15 TRACE SMAPI]       Loading Runtime.dll...
[09:54:15 TRACE SMAPI]       Loading Tomlyn.dll...
[09:54:15 TRACE SMAPI]       Loading xBRZ.dll...
[09:54:15 TRACE SMAPI]       Loading Zlib.Portable.dll...
[09:54:15 TRACE SMAPI]       Loading System.Data.HashFunction.Interfaces.dll...
[09:54:15 TRACE SMAPI]       Loading System.Data.HashFunction.Core.dll...
[09:54:15 TRACE SMAPI]       Loading System.Data.HashFunction.xxHash.dll...
[09:54:15 TRACE SMAPI]       Detected game patcher (Harmony.HarmonyInstance type) in assembly SpriteMaster.dll.
[09:54:15 TRACE SMAPI]       Loading SpriteMaster.dll...
[09:54:15 INFO  SMAPI] Loaded 1 mods:
[09:54:15 INFO  SMAPI]    SpriteMaster 0.11.3 by mkukli | Resamples sprites on the fly using xBRZ to improve resolution and crispness.

[09:54:15 INFO  SMAPI] Found 1 mod with warnings:
[09:54:15 INFO  SMAPI]    Patched game code
[09:54:15 INFO  SMAPI]    --------------------------------------------------
[09:54:15 INFO  SMAPI]       These mods directly change the game code. They're more likely to cause errors or bugs in-game; if
[09:54:15 INFO  SMAPI]       your game has issues, try removing these first. Otherwise you can ignore this warning.

[09:54:15 INFO  SMAPI]       - SpriteMaster

[09:54:15 WARN  SpriteMaster] [Entry] config.toml is out of date, rewriting it.
[09:54:15 TRACE SMAPI] Checking for updates...
[09:54:15 TRACE game] setGameMode( 'titleScreenGameMode (0)' )
[09:54:16 TRACE SMAPI] Running on GPU: NVIDIA GeForce RTX 3080
[09:54:16 TRACE SMAPI]    SMAPI okay.
[09:54:16 TRACE SMAPI]    Checking for updates to 1 mods...
[09:54:16 TRACE game] Steam logged on: True
[09:54:16 TRACE game] Initializing GalaxySDK
[09:54:16 TRACE SMAPI]    All mods up to date.
[09:54:16 TRACE game] Requesting Steam app ticket
[09:54:16 TRACE SMAPI] Detecting common issues...
[09:54:16 INFO  SMAPI] Type 'help' for help, or 'help <cmd>' for a command's usage
[09:54:16 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:1080 Y:372 Width:1280 Height:720}
[09:54:16 INFO  SpriteMaster] [Dump] System Information:
[09:54:16 INFO  SpriteMaster] [Dump]    Architecture: x86
[09:54:16 INFO  SpriteMaster] [Dump]    Number of Cores: 8
[09:54:16 INFO  SpriteMaster] [Dump]    Graphics Adapter Name: \\.\DISPLAY1
[09:54:16 INFO  SpriteMaster] [Dump]    Graphics Adapter ID: 8710
[09:54:16 INFO  SpriteMaster] [Dump]    Graphics Adapter Description: NVIDIA GeForce RTX 3080
[09:54:16 TRACE game] Signing into GalaxySDK
[09:54:17 TRACE game] Galaxy auth success
[09:54:17 TRACE game] Galaxy signed in
[09:54:17 TRACE game] Galaxy logged on
[09:54:18 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:1080 Y:372 Width:1280 Height:720}
[09:54:18 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:54:52 TRACE game] setGameMode( 'playingGameMode (3)' )
[09:54:52 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:54:52 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:54:52 TRACE SMAPI] New day task synchronizing...
[09:54:53 TRACE game] DebugOutput: Dandelion was destroyed
[09:54:53 TRACE game] setupEventCommands() registered '131' methods
[09:54:53 TRACE SMAPI] New day task done.
[09:54:53 TRACE SMAPI] Context: before save creation.
[09:54:53 TRACE game] SaveGame.Save() called.
[09:54:53 TRACE game] Saving without compression...
[09:54:54 TRACE game] SaveGame.Save() completed without exceptions.
[09:54:56 TRACE SMAPI] Context: after save creation, starting spring 1 Y1.
[09:54:56 TRACE SMAPI] Context: loaded save 'Test_268854850', starting spring 1 Y1, locale set to en. Single-player.
[09:54:57 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:54:59 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:00 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:02 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:04 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:05 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:06 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:06 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:08 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:11 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:12 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:13 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:14 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:15 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:18 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:22 TRACE game] Disconnected: ClosedGame
[09:55:22 TRACE SMAPI] Disposing...
[09:55:22 TRACE SMAPI] Disposing the content coordinator. Content managers will no longer be usable after this point.

I also double-checked to verify that the issue does not occur without SpriteMaster installed.

ameisen commented 3 years ago
[09:54:57 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:54:59 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:00 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:02 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:04 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:05 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:06 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:06 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:08 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:11 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:12 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:13 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:14 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:15 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}
[09:55:18 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440}

Any idea what was going on there? Looks like the window repeatedly resized to 3440x1440 for some reason.

If no sanity checking was happening higher up, that could cause issues in SpriteMaster since it would potentially cause some assets to purge.

Velgus commented 3 years ago

It may correspond to when the white flickering happens?

I checked a log where I did all the same things but without any mods at all, and those lines still appear (seemingly in line with when I am navigating the menu), but there is no perceivable flickering.

Perhaps 1.5 made certain menu transitions trigger that, and SpriteMaster just makes it have noticeable issues due to the additional processing/purging like you mentioned?

pXius commented 3 years ago

Could it be worth trying with SDV in full-screen instead of full-screen borderless?

Velgus commented 3 years ago

I don't believe SDV has a true fullscreen mode. The only things which show up in the menu are Fullscreen and Windowed, and it was set to Fullscreen during all tests.

Apparently there's some interface bug that is making only 2 things show up at a time for that dropdown. Regardless, it was set to Fullscreen (not "Windowed Borderless") for all the tests.

EDIT: Upon further testing, it looks like setting it to "Windowed Borderless" instead of Fullscreen actually mitigates the white flickering. [14:15:11 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440} still shows up in the log, but the flickering wasn't noticeable when navigating the menu.

image

pXius commented 3 years ago

~I don't believe SDV has a true fullscreen mode. The only things which show up in the menu are Fullscreen and Windowed, and it was set to Fullscreen during all tests.~

Apparently there's some interface bug that is making only 2 things show up at a time for that dropdown. Regardless, it was set to Fullscreen (not "Windowed Borderless") for all the tests.

EDIT: Upon further testing, it looks like setting it to "Windowed Borderless" instead of Fullscreen actually mitigates the white flickering. [14:15:11 TRACE game] Window_ClientSizeChanged(); Window.ClientBounds={X:0 Y:0 Width:3440 Height:1440} still shows up in the log, but the flickering wasn't noticeable when navigating the menu.

image

I was able to reproduce it the same way as well.

The good news is Widowed Borderless is the default for Steam installs. So most people won't run into this specific problem.

For what it's worth, I'm using a RX580 Driver 20.11.2

ameisen commented 3 years ago

Until I investigate deeper, I'm not sure what would cause that. The game does do some... peculiar things with framebuffers which I've had to mitigate already, so it's probably something like that.

ameisen commented 3 years ago

I have the fix in the repository now (85c651b, and it will be in the next build which will hopefully be tonight.)

It was caused by spurious device/window change calls which were confusing the heck out of SpriteMaster. They are now being intercepted and cancelled when they do nothing.

ameisen commented 3 years ago

I didn't get the build out yesterday as I'm dealing with the OOM issues with the new island.

ameisen commented 2 years ago

Fixed long ago.