Merge pull request #1222 from notargs/feature/add_profiler

Profiler.Begin()/End()をMeshImporterに仕込んだ
This commit is contained in:
ousttrue 2021-09-14 12:08:05 +09:00 committed by GitHub
commit 20dd002197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Profiling;
using VRMShaders;
namespace UniGLTF
@ -628,6 +629,8 @@ namespace UniGLTF
positions = blendShape.Positions.ToArray();
normals = blendShape.Normals.ToArray();
});
Profiler.BeginSample("MeshImporter.BuildBlendShapeAsync");
if (blendShape.Positions.Count > 0)
{
if (blendShape.Positions.Count == mesh.vertexCount)
@ -653,11 +656,14 @@ namespace UniGLTF
null
);
}
Profiler.EndSample();
}
public static async Task<MeshWithMaterials> BuildMeshAsync(IAwaitCaller awaitCaller, Func<int, Material> ctx, MeshImporter.MeshContext meshContext)
{
Profiler.BeginSample("MeshImporter._BuildMesh");
var (mesh, recalculateTangents) = _BuildMesh(meshContext);
Profiler.EndSample();
if (recalculateTangents)
{
@ -683,7 +689,9 @@ namespace UniGLTF
}
}
Profiler.BeginSample("Mesh.UploadMeshData");
mesh.UploadMeshData(false);
Profiler.EndSample();
return result;
}