steam-audio
steam-audio copied to clipboard
Embree Scenes not removing static meshes and causing crashes on obj saving, testcase provided
When using the scene type IPL_SCENETYPE_EMBREE
, it appears as if data is not actually cleaned up properly leading to an access violation.
{
IPLStaticMesh pStaticMesh = BuildRandomSceneGeometry(pScene, 50);
iplSceneSaveOBJ(pScene, "Scene1.obj");
iplStaticMeshRemove(pStaticMesh, pScene);
iplSceneCommit(pScene);
iplStaticMeshRelease(&pStaticMesh);
}
{
IPLStaticMesh pStaticMesh = BuildRandomSceneGeometry(pScene, 50000);
iplSceneSaveOBJ(pScene, "Scene2.obj"); // Crash
iplStaticMeshRemove(pStaticMesh, pScene);
iplSceneCommit(pScene);
iplStaticMeshRelease(&pStaticMesh);
}
The current work around is to use the IPL_SCENETYPE_DEFAULT
scene type for the time being
Below i've provided a test binary built in debug mode with an attached pdb https://github.com/ogniK5377/steamaudio-issue-repro/releases/tag/SaveObjEmbreeCrash The source for the following test case is provided here too https://github.com/ogniK5377/steamaudio-issue-repro/blob/main/src/SaveObjEmbreeCrash/main.cpp
@ogniK5377 - Thanks for reporting the issue and providing a repro case. We were able to identify and fix the issue internally. Next public release should fix the issue. Thanks.
Regarding the issue itself, we disable or enable static meshes inside Embree as static meshes are removed and added, respectively. A geometry id is issued to new static mesh. We were always using geometry id of 0 when exporting OBJ from Embree Scene instead of using the geometry id of the latest static mesh. This was causing the crash when exporting OBJ 2nd time around.
We've just released Steam Audio 4.1.2, which contains a fix for this issue: https://github.com/ValveSoftware/steam-audio/releases/tag/v4.1.2.