Skip to content

Commit 33cdaa7

Browse files
committed
[Patch] Fixed swift concurrency test
1 parent 6e136da commit 33cdaa7

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Sources/UntoldEngine/Mesh/Mesh.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ public struct Mesh {
10651065
}
10661066

10671067
let indexBuffer = allocator.newBuffer(primitive.indexData.count, type: .index)
1068-
primitive.indexData.withUnsafeBytes { rawBuffer in
1068+
_ = primitive.indexData.withUnsafeBytes { rawBuffer in
10691069
memcpy(indexBuffer.map().bytes, rawBuffer.baseAddress!, primitive.indexData.count)
10701070
}
10711071

Sources/UntoldEngine/Systems/GeometryStreamingSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ public class GeometryStreamingSystem: @unchecked Sendable {
748748
TextureStreamingSystem.shared.shedTextureMemory(
749749
cameraPosition: effectiveCameraPosition, maxEntities: 4
750750
)
751-
evictLRU(cameraPosition: effectiveCameraPosition, maxEvictions: 8)
751+
_ = evictLRU(cameraPosition: effectiveCameraPosition, maxEvictions: 8)
752752
}
753753

754754
tileLoadCandidates.sort { lhs, rhs in

Sources/UntoldEngine/Systems/RegistrationSystem.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import CShaderTypes
1313
import Foundation
1414
import MetalKit
15-
import ModelIO
15+
@preconcurrency import ModelIO
1616

1717
@inline(__always)
1818
private func enforceRegistrationMainActor() {
@@ -50,6 +50,10 @@ private final class ResumeOnce: @unchecked Sendable {
5050
}
5151
}
5252

53+
private struct SendableMDLAssetBox: @unchecked Sendable {
54+
let asset: MDLAsset
55+
}
56+
5357
private final class RegistrationRuntimeState: @unchecked Sendable {
5458
let lock = NSLock()
5559
var pendingDestroyCompletions: [() -> Void] = []
@@ -1626,10 +1630,10 @@ public func setEntityMeshAsync(
16261630
Logger.log(message: "[Streaming] '\(filename)': loadTextures() start")
16271631
let textureLoadOK = await withCheckedContinuation { (cont: CheckedContinuation<Bool, Never>) in
16281632
let once = ResumeOnce()
1629-
let assetRef = assetData.asset
1633+
let assetRef = SendableMDLAssetBox(asset: assetData.asset)
16301634
let nameForLog = filename
16311635
DispatchQueue.global(qos: .userInitiated).async {
1632-
assetRef.loadTextures()
1636+
assetRef.asset.loadTextures()
16331637
once.callOnce { cont.resume(returning: true) }
16341638
}
16351639
DispatchQueue.global().asyncAfter(deadline: .now() + 15.0) {

0 commit comments

Comments
 (0)