atteneder / DracoUnity

Draco 3D Data Compression Unity Package
Apache License 2.0
245 stars 38 forks source link

Error in 2021.2.3f1 version for Apple Silicone #34

Closed Prorokus closed 2 years ago

Prorokus commented 2 years ago

The same project works fine when running the Editor version for Intel through Rosetta 2.

But when running the Apple Silicone version and trying to load GLTF with Draco - you get the errors.

Знімок екрана 2021-11-19 о 13 43 11

Unable to load plugin dracodec_unity UnityEngine.StackTraceUtility:ExtractStackTrace () Burst.Compiler.IL.Jit.JitBurstInitializeUtility:ResolveExternalFunctions (System.Collections.Generic.List1<Burst.Compiler.IL.Jit.ExternalFunctionEntry>,Burst.Compiler.IL.Jit.GetExternalFunctionPointerDelegate) Burst.Compiler.IL.Jit.JitCacheLibraryManager:CallBurstInitializeFunction (intptr,Burst.Compiler.IL.Jit.GetExternalFunctionPointerDelegate) Burst.Compiler.IL.Jit.JitCacheLibraryManager/<>c__DisplayClass7_2:<TryGetOrLoadLibrary>b__1 () Burst.Compiler.IL.Jit.JitCacheMethodValue:GetCachedPtrForAssemblies (bool,intptr&) Burst.Compiler.IL.Jit.JitCompiler:CheckAssemblyCache (Burst.Compiler.IL.Jit.JitCompiler/MethodToCompile&,Burst.Compiler.IL.Jit.JitOptions,Burst.Compiler.IL.Jit.JitFunction&) Burst.Compiler.IL.Jit.JitCompiler:CompileMethods (Burst.Compiler.IL.Jit.JitMethodGroupRequest&,Burst.Compiler.IL.Jit.JitCompilationRequestType) Burst.Compiler.IL.Jit.JitCompiler:CompileMethod (Burst.Compiler.IL.Jit.MethodReferenceWithMethodRefString,Burst.Compiler.IL.Jit.JitOptions,Burst.Compiler.IL.Jit.JitCompilationRequestType) Burst.Compiler.IL.Jit.JitCompilerService/CompilerThreadContext:Compile (Burst.Compiler.IL.Jit.JitCompilerService/CompileJob,Burst.Compiler.IL.Jit.JitCompilationRequestType) Burst.Compiler.IL.Jit.JitCompilerService:QueueCompileJob (Burst.Compiler.IL.Jit.JitCompilerService/CompileJob) Burst.Compiler.IL.Jit.JitCompilerService:CompileInternal (string,string,intptr,Unity.Burst.NativeDumpFlags,intptr,intptr,string) Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility/JobScheduleParameters&) Unity.Jobs.IJobExtensions:Schedule<Draco.DracoNative/DecodeJob> (Draco.DracoNative/DecodeJob,Unity.Jobs.JobHandle) (at /Users/bokken/buildslave/unity/build/Runtime/Jobs/Managed/IJob.cs:31) Draco.DracoNative:Init (intptr,int) (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoNative.cs:154) Draco.DracoMeshLoader/<ConvertDracoMeshToUnity>d__9:MoveNext () (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoMeshLoader.cs:428) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<Draco.DracoMeshLoader/DecodeResult>:Start<Draco.DracoMeshLoader/d9> (Draco.DracoMeshLoader/d9&) Draco.DracoMeshLoader:ConvertDracoMeshToUnity (UnityEngine.Mesh/MeshData,intptr,int,bool,bool,int,int,bool,bool) Draco.DracoMeshLoader/d5:MoveNext () (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoMeshLoader.cs:158) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start<Draco.DracoMeshLoader/d5> (Draco.DracoMeshLoader/d5&) Draco.DracoMeshLoader:ConvertDracoMeshToUnity (Unity.Collections.NativeSlice1<byte>,bool,bool,int,int,bool) GLTFast.PrimitiveDracoCreateContext:StartDecode (Unity.Collections.NativeSlice1,int,int) (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/PrimitiveDracoCreateContext.cs:48) GLTFast.GltfImport:PreparePrimitiveDraco (GLTFast.Schema.Root,GLTFast.Schema.Mesh,GLTFast.Schema.MeshPrimitive,GLTFast.PrimitiveDracoCreateContext&) (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:2409) GLTFast.GltfImport/d112:MoveNext () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:2326) System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<GLTFast.GltfImport/d112> (GLTFast.GltfImport/d112&) GLTFast.GltfImport:CreatePrimitiveContexts (GLTFast.Schema.Root) GLTFast.GltfImport/d97:MoveNext () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:1459) System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start<GLTFast.GltfImport/d97> (GLTFast.GltfImport/d97&) GLTFast.GltfImport:Prepare () GLTFast.GltfImport/d80:MoveNext () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:545) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1<bool>:SetResult (bool) GLTFast.GltfImport/<LoadContent>d__81:MoveNext () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:571) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult (bool) GLTFast.GltfImport/d88:MoveNext () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:881) System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult () GLTFast.TimeBudgetPerFrameDeferAgent/d9:MoveNext () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/TimeBudgetPerFrameDeferAgent.cs:70) UnityEngine.UnitySynchronizationContext:ExecuteTasks ()


Unexpected exception Burst.Compiler.IL.CompilerException: Missing external function name: #dllimport:dracodec_unity|DecodeDracoMeshStep1 => method: Draco.DracoNative.DecodeDracoMeshStep1(byte* buffer, int length, Draco.DracoNative.DracoMesh** mesh, void** decoder, void** decoderBuffer) -> int. Reason: Function pointer cannot be IntPtr.Zero

at Burst.Compiler.IL.Jit.JitBurstInitializeUtility.ResolveExternalFunctions (System.Collections.Generic.List`1[T] unresolvedExternalFunctions, Burst.Compiler.IL.Jit.GetExternalFunctionPointerDelegate getExternalFunctionPointer) [0x00158] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCacheLibraryManager.CallBurstInitializeFunction (System.IntPtr libraryPtr, Burst.Compiler.IL.Jit.GetExternalFunctionPointerDelegate getExternalFunctionPointer) [0x000fd] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCacheLibraryManager+<>c__DisplayClass7_2.b__1 () [0x00000] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCacheMethodValue.GetCachedPtrForAssemblies (System.Boolean ensureBurstInitializeHasBeenCalled, System.IntPtr& cachedPtr) [0x0004c] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCompiler.CheckAssemblyCache (Burst.Compiler.IL.Jit.JitCompiler+MethodToCompile& methodToCompile, Burst.Compiler.IL.Jit.JitOptions jitOptions, Burst.Compiler.IL.Jit.JitFunction& cachedFunction) [0x00071] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCompiler.CompileMethods (Burst.Compiler.IL.Jit.JitMethodGroupRequest& request, Burst.Compiler.IL.Jit.JitCompilationRequestType requestType) [0x00209] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCompiler.CompileMethod (Burst.Compiler.IL.Jit.MethodReferenceWithMethodRefString method, Burst.Compiler.IL.Jit.JitOptions jitOptions, Burst.Compiler.IL.Jit.JitCompilationRequestType requestType) [0x00023] in <998e8f9be2fb4d6caf77881c0318d377>:0 at Burst.Compiler.IL.Jit.JitCompilerService+CompilerThreadContext.Compile (Burst.Compiler.IL.Jit.JitCompilerService+CompileJob job, Burst.Compiler.IL.Jit.JitCompilationRequestType requestType) [0x00491] in <998e8f9be2fb4d6caf77881c0318d377>:0

While compiling job: System.Void Unity.Jobs.IJobExtensions/JobStruct`1<Draco.DracoNative/DecodeJob>::Execute(T&,System.IntPtr,System.IntPtr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,System.Int32) at :line 0


DllNotFoundException: dracodec_unity assembly: type: member:(null) Draco.DracoNative+DecodeJob.Execute () (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoNative.cs:867) Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute (T& data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at /Users/bokken/buildslave/unity/build/Runtime/Jobs/Managed/IJob.cs:23)


NullReferenceException: Object reference not set to an instance of an object Draco.DracoNative.CreateMesh (System.Boolean& calculateNormals, System.Boolean requireNormals, System.Boolean requireTangents, System.Int32 weightsAttributeId, System.Int32 jointsAttributeId, System.Boolean forceUnityLayout) (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoNative.cs:514) Draco.DracoMeshLoader.ConvertDracoMeshToUnity (UnityEngine.Mesh+MeshData mesh, System.IntPtr encodedData, System.Int32 size, System.Boolean requireNormals, System.Boolean requireTangents, System.Int32 weightsAttributeId, System.Int32 jointsAttributeId, System.Boolean forceUnityLayout, System.Boolean sync) (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoMeshLoader.cs:366) Draco.DracoMeshLoader.ConvertDracoMeshToUnity (Unity.Collections.NativeSlice1[T] encodedData, System.Boolean requireNormals, System.Boolean requireTangents, System.Int32 weightsAttributeId, System.Int32 jointsAttributeId, System.Boolean forceUnityLayout) (at Library/PackageCache/com.atteneder.draco@4.0.0/Runtime/Scripts/DracoMeshLoader.cs:114) Rethrow as AggregateException: One or more errors occurred. (Object reference not set to an instance of an object) System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <376a33e968974713b24063a1aeb8934c>:0) System.Threading.Tasks.Task1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <376a33e968974713b24063a1aeb8934c>:0) System.Threading.Tasks.Task`1[TResult].get_Result () (at <376a33e968974713b24063a1aeb8934c>:0) GLTFast.PrimitiveDracoCreateContext.CreatePrimitive () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/PrimitiveDracoCreateContext.cs:52) GLTFast.GltfImport.Prepare () (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:1328) GLTFast.GltfImport.LoadRoutine (System.Uri url) (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:536) GLTFast.GltfImport.Load (System.Uri url, GLTFast.ImportSettings importSettings) (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:273) GLTFast.GltfImport.Load (System.String url, GLTFast.ImportSettings importSettings) (at Library/PackageCache/com.atteneder.gltfast@4.4.7/Runtime/Scripts/GltfImport.cs:262) TestGltf.Start () (at Assets/Scripts/TestGltf.cs:8) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.Object state) (at <376a33e968974713b24063a1aeb8934c>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153) UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)


A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.

atteneder commented 2 years ago

@Prorokus Thanks a lot for reporting ❤️

Version 4.0.1 (live soon) will fix this

atteneder commented 2 years ago

fyi: KtxUnity had the same issue. Fixed in 2.0.1