mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] Fixed profiler samplers array out of bounds access at threaded update system. Closes #2981.
This commit is contained in:
parent
8fdbf055f2
commit
370c74edb4
@ -155,7 +155,7 @@ namespace Spine.Unity {
|
|||||||
volatile protected int numExceptionsSet = 0;
|
volatile protected int numExceptionsSet = 0;
|
||||||
protected int usedThreadCount = -1;
|
protected int usedThreadCount = -1;
|
||||||
|
|
||||||
public void DeferredLogException(Exception exc, UnityEngine.Object context, int threadIndex) {
|
public void DeferredLogException (Exception exc, UnityEngine.Object context, int threadIndex) {
|
||||||
exceptions[threadIndex] = exc;
|
exceptions[threadIndex] = exc;
|
||||||
exceptionObjects[threadIndex] = context;
|
exceptionObjects[threadIndex] = context;
|
||||||
numExceptionsSet++;
|
numExceptionsSet++;
|
||||||
@ -287,6 +287,11 @@ namespace Spine.Unity {
|
|||||||
genericSkeletonTasks[t] = new WorkerPoolTask();
|
genericSkeletonTasks[t] = new WorkerPoolTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if ENABLE_THREAD_PROFILING
|
||||||
|
if (profilerSamplerUpdate == null) {
|
||||||
|
profilerSamplerUpdate = new CustomSampler[numThreads];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int t = 0; t < updateDone.Count; ++t) {
|
for (int t = 0; t < updateDone.Count; ++t) {
|
||||||
updateDone[t].Reset();
|
updateDone[t].Reset();
|
||||||
@ -472,6 +477,11 @@ namespace Spine.Unity {
|
|||||||
genericSkeletonTasks[t] = new WorkerPoolTask();
|
genericSkeletonTasks[t] = new WorkerPoolTask();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if ENABLE_THREAD_PROFILING
|
||||||
|
if (profilerSamplerLateUpdate == null) {
|
||||||
|
profilerSamplerLateUpdate = new CustomSampler[numThreads];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int t = 0; t < lateUpdateDone.Count; ++t) {
|
for (int t = 0; t < lateUpdateDone.Count; ++t) {
|
||||||
lateUpdateDone[t].Reset();
|
lateUpdateDone[t].Reset();
|
||||||
@ -638,8 +648,8 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_THREAD_PROFILING
|
#if ENABLE_THREAD_PROFILING
|
||||||
CustomSampler[] profilerSamplerUpdate = new CustomSampler[16];
|
CustomSampler[] profilerSamplerUpdate = null;
|
||||||
CustomSampler[] profilerSamplerLateUpdate = new CustomSampler[16];
|
CustomSampler[] profilerSamplerLateUpdate = null;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>Perform Update at all SkeletonRenderers asynchronously.</summary>
|
/// <summary>Perform Update at all SkeletonRenderers asynchronously.</summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user