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

Profiler.Begin()/End()をMeshImporterに仕込んだ #1222

Merged
merged 2 commits into from
Sep 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Profiling;
using VRMShaders;

namespace UniGLTF
Expand Down Expand Up @@ -628,6 +629,8 @@ await awaitCaller.Run(() =>
positions = blendShape.Positions.ToArray();
normals = blendShape.Normals.ToArray();
});

Profiler.BeginSample("MeshImporter.BuildBlendShapeAsync");
if (blendShape.Positions.Count > 0)
{
if (blendShape.Positions.Count == mesh.vertexCount)
Expand All @@ -653,11 +656,14 @@ await awaitCaller.Run(() =>
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)
{
Expand All @@ -683,7 +689,9 @@ public static async Task<MeshWithMaterials> BuildMeshAsync(IAwaitCaller awaitCal
}
}

Profiler.BeginSample("Mesh.UploadMeshData");
mesh.UploadMeshData(false);
Profiler.EndSample();

return result;
}
Expand Down