mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-28 19:36:24 +02:00
CAMetalLayer usage from background thread fix
This commit is contained in:
parent
abbb3bb0c3
commit
2d1a357d1b
1 changed files with 4 additions and 6 deletions
|
@ -484,23 +484,21 @@ class Ryujinx {
|
|||
|
||||
|
||||
func repeatuntilfindLayer() {
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
Task { @MainActor in
|
||||
while self.metalLayer == nil {
|
||||
let layer = self.getMetalLayer(nil)
|
||||
|
||||
if layer != nil {
|
||||
DispatchQueue.main.async {
|
||||
self.metalLayer = layer
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
Thread.sleep(forTimeInterval: 0.1)
|
||||
try await Task.sleep(nanoseconds: 100_000_000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@MainActor
|
||||
func getMetalLayer(_ window: OpaquePointer?) -> CAMetalLayer? {
|
||||
var window = window
|
||||
if window == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue