Run parsing of vrm files on a thread pool.

This commit is contained in:
Masataka SUMI
2024-05-21 12:10:21 +09:00
parent 3ec05a2346
commit 48c7c856a3

View File

@@ -52,7 +52,11 @@ namespace UniVRM10
? new RuntimeOnlyAwaitCaller()
: new ImmediateCaller();
using var gltfData = new GlbLowLevelParser(path, await File.ReadAllBytesAsync(path, ct)).Parse();
using var gltfData = await awaitCaller.Run(() =>
{
var bytes = File.ReadAllBytes(path);
return new GlbLowLevelParser(path, bytes).Parse();
});
return await LoadAsync(
gltfData,
canLoadVrm0X,
@@ -96,7 +100,7 @@ namespace UniVRM10
? new RuntimeOnlyAwaitCaller()
: new ImmediateCaller();
using var gltfData = new GlbLowLevelParser(string.Empty, bytes).Parse();
using var gltfData = await awaitCaller.Run(() => new GlbLowLevelParser(string.Empty, bytes).Parse());
return await LoadAsync(
gltfData,
canLoadVrm0X,