再生中の毎フレームのシーン照会スナップショット割り当てを排除

このコミットが含まれているのは:
routersys committed 2026-07-04 18:25:50 +09:00
1 親 7a2a7e5593
コミット cfa8141424
1ファイル変更
+13 -2
+13 -2
ファイルの表示
@@ -470,8 +470,8 @@ namespace LuaScript
_isFirst = false;
_cachedKey = key;
_cachedQueries = ctx.ObjectQueries.Count == 0 ? [] : [.. ctx.ObjectQueries];
_cachedSceneValueQueries = ctx.SceneValueQueries.Count == 0 ? [] : [.. ctx.SceneValueQueries];
_cachedQueries = SnapshotQueries(ctx.ObjectQueries, _cachedQueries);
_cachedSceneValueQueries = SnapshotQueries(ctx.SceneValueQueries, _cachedSceneValueQueries);
_cachedOutputDesc = outDesc;
_cachedEffectOutput = effectOutput;
@@ -561,6 +561,17 @@ namespace LuaScript
return true;
}
private static T[] SnapshotQueries<T>(IReadOnlyList<T> source, T[] existing)
{
int count = source.Count;
if (count == 0)
return [];
var target = existing.Length == count ? existing : new T[count];
for (int i = 0; i < count; i++)
target[i] = source[i];
return target;
}
private static bool QueriesMatch(SceneObjectQuery[] queries, SceneObjectResolver resolver)
{
for (int i = 0; i < queries.Length; i++)