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

Crashes while trying to get DaggerfallUnity instance #2

Open
KABoissonneault opened this issue Feb 19, 2024 · 3 comments
Open

Crashes while trying to get DaggerfallUnity instance #2

KABoissonneault opened this issue Feb 19, 2024 · 3 comments

Comments

@KABoissonneault
Copy link
Collaborator

I got this player crash

Player(34).log

The relevant part of the callstack is here:

0x00007FFA46D99340 (UnityPlayer) UnityMain
0x00007FFA470CA64C (UnityPlayer) UnityMain
0x00007FFA4715F594 (UnityPlayer) UnityMain
0x0000016FB6FFEE7A (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Object:FindObjectsOfType (System.Type)
0x0000016FB6FFED73 (Mono JIT Code) UnityEngine.Object:FindObjectOfType (System.Type)
0x0000016FB6FFECD3 (Mono JIT Code) UnityEngine.Object:FindObjectOfType<T_REF> ()
0x0000016FDB27B06B (Mono JIT Code) DaggerfallWorkshop.DaggerfallUnity:FindDaggerfallUnity (DaggerfallWorkshop.DaggerfallUnity&)
0x00000170139E8D83 (Mono JIT Code) Monobelisk.TerrainComputer:DispatchAndProcess (UnityEngine.ComputeShader,DaggerfallWorkshop.MapPixelData&,Monobelisk.TerrainComputerParams)
0x00000170139E7F9B (Mono JIT Code) Monobelisk.InterestingTerrainSampler:GenerateSamples (DaggerfallWorkshop.MapPixelData&)
0x00000170139E7D83 (Mono JIT Code) Monobelisk.InterestingTerrainSampler:ScheduleGenerateSamplesJob (DaggerfallWorkshop.MapPixelData&)
...

This is similar to the known DFU crash here: Interkarma/daggerfall-unity#2355

Terrain jobs usually run on a thread different from the main thread, and it's allegedly dangerous to do object lookups from another thread.

The IET code could probably be modified to only lookup the DaggerfallUnity once on creation during gameplay, and use the cached result in those other threads. This also affects Monobelisk.Utility.GetOriginalTerrainHeight(), which also does a DaggerfallUnity object lookup from those dispatch jobs.

It could also be possible to compute properties such as the original terrain height and location rect on terrain promotion from the main thread, rather than during TerrainComputer.DispatchAndProcess

@drcarademono
Copy link
Owner

Hmm. Altering monobolisk's math for terrain generation I've been able to handle, but when it comes to fixing the internal plumbing like this I'd be out of my depth.

@KABoissonneault
Copy link
Collaborator Author

Yeah no worries I'm taking notes for when I eventually wanna rethink this

@John-Leitch
Copy link

@KABoissonneault, is a crash dump available? I'm curious to see if the native frames match Interkarma/daggerfall-unity#2355

drcarademono added a commit that referenced this issue Mar 26, 2024
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

No branches or pull requests

3 participants