From 1a1e3be4f2fcbd5042d86babc5d6c06b02aaf2df Mon Sep 17 00:00:00 2001 From: notargs Date: Mon, 13 Sep 2021 18:11:04 +0900 Subject: [PATCH 1/2] =?UTF-8?q?MeshImporter=E3=81=ABProfiler.BeginSample/E?= =?UTF-8?q?ndSample=E3=82=92=E4=BB=95=E8=BE=BC=E3=82=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs index 3e8f52268..6a742ecda 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs @@ -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 BuildMeshAsync(IAwaitCaller awaitCaller, Func ctx, MeshImporter.MeshContext meshContext) { + Profiler.BeginSample("MeshImporter._BuildMesh"); var (mesh, recalculateTangents) = _BuildMesh(meshContext); + Profiler.EndSample(); if (recalculateTangents) { @@ -676,14 +682,18 @@ namespace UniGLTF await awaitCaller.NextFrame(); if (meshContext.BlendShapes.Count > 0) { + Profiler.BeginSample("Mesh.UploadMeshData"); var emptyVertices = new Vector3[mesh.vertexCount]; foreach (var blendShape in meshContext.BlendShapes) { await BuildBlendShapeAsync(awaitCaller, mesh, meshContext, blendShape, emptyVertices); } + Profiler.EndSample(); } + Profiler.BeginSample("Mesh.UploadMeshData"); mesh.UploadMeshData(false); + Profiler.EndSample(); return result; } From d9ca931c749a34b52438dae8ec57167131d524d4 Mon Sep 17 00:00:00 2001 From: notargs Date: Mon, 13 Sep 2021 18:14:23 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=8F=E5=8B=95?= =?UTF-8?q?=E3=81=8B=E3=81=AA=E3=81=84Profiler=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs index 6a742ecda..3e0601726 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MeshIO/MeshImporter.cs @@ -682,13 +682,11 @@ namespace UniGLTF await awaitCaller.NextFrame(); if (meshContext.BlendShapes.Count > 0) { - Profiler.BeginSample("Mesh.UploadMeshData"); var emptyVertices = new Vector3[mesh.vertexCount]; foreach (var blendShape in meshContext.BlendShapes) { await BuildBlendShapeAsync(awaitCaller, mesh, meshContext, blendShape, emptyVertices); } - Profiler.EndSample(); } Profiler.BeginSample("Mesh.UploadMeshData");