UnityAsyncImageLoader
UnityAsyncImageLoader copied to clipboard
LoadImageAsync fails to generate mipmaps
When trying to load an image using AsyncImageLoader.LoadImageAsync with default LoaderSettings, I get the following error:
"InvalidOperationException: The writeable UNKNOWN_OBJECT_TYPE FilterMipmapJob.outputMipmap is the same UNKNOWN_OBJECT_TYPE as FilterMipmapJob.inputMipmap, two containers may not be the same (aliasing)."
It seems to be related to the jobs that are creating the mipmaps. I can workaround the issue by disabling mipmap generation.
Unity Version: 2021.2.0b4.3123 Personal
I haven't tested with Unity 2021 yet. Probably, some changes with the Jobs System or Burst break filter mipmap job. I will take a look at this later.
Confirming that I'm getting this same behaviour on Unity 2020.3.1f1 Plus. Full stack trace:
InvalidOperationException: The writeable UNKNOWN_OBJECT_TYPE FilterMipmapJob.outputMipmap is the same UNKNOWN_OBJECT_TYPE as FilterMipmapJob.inputMipmap, two containers may not be the same (aliasing).
Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters, System.Int32 arrayLength, System.Int32 innerloopBatchCount) (at <10564ed154d647e194bef4aef8878649>:0)
Unity.Jobs.IJobParallelForExtensions.Schedule[T] (T jobData, System.Int32 arrayLength, System.Int32 innerloopBatchCount, Unity.Jobs.JobHandle dependsOn) (at <10564ed154d647e194bef4aef8878649>:0)
AsyncImageLoader+ImageImporter.ProcessRawTextureData (Unity.Collections.NativeArray`1[T] rawTextureView, System.Int32 mipmapCount) (at Assets/UnityAsyncImageLoader/Runtime/ImageImporter.cs:228)
AsyncImageLoader+ImageImporter+<CreateNewTextureAsync>d__17.MoveNext () (at Assets/UnityAsyncImageLoader/Runtime/ImageImporter.cs:103)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
AsyncImageLoader+<CreateFromImageAsync>d__9.MoveNext () (at Assets/UnityAsyncImageLoader/Runtime/AsyncImageLoader.cs:105)
UnityEngine.Debug:LogException(Exception)
<CreateFromImageAsync>d__9:MoveNext() (at Assets/UnityAsyncImageLoader/Runtime/AsyncImageLoader.cs:108)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetException(Exception)
<CreateNewTextureAsync>d__17:MoveNext() (at Assets/UnityAsyncImageLoader/Runtime/ImageImporter.cs:106)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
@Looooong was this fixed yet, because I'm still getting the same issue
@Looooong was this fixed yet, because I'm still getting the same issue
Sorry, I haven't fixed this yet. PR is welcomed.
@akioCL @nickyonge @ookii-tsuki I published a fix in version 0.1.2. I tested and it works in Unity 2021.2. If you are using Unity 2020 or 2021.1, can you check and see if it works for you as well?
This is fixed, further improved and unit tested.