Post

Replies

Boosts

Views

Activity

Reply to SpriteKit framerate drop on iOS 26.0
Thank you for reporting this! I noticed the exact same issue for my games too - performance drop without introducing any changes from my side. Looking forward to seeing this resolved. BTW: how one can get notified when this is resolved? when I click on the feedback link, it says “no feedback was found”. Cheers, Dawid
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Sep ’25
Reply to SpriteKit framerate drop on iOS 26.0
Hi, any updates on this issue? As I said originally, bug report is private so I cannot follow there. From what I observed on my game, it seems that framerate improves, going back to about 60FPS, only during dragging the the finger touching the screen. Then it goes back to 40 when I am not dragging. I made a screen recording of the Metal HUD if anyone wants to take a look: https://streamable.com/l647a7 Maybe touch is making iOS to add more CPU priority to the app? Not sure. If anybody has any ideas how we could trigger this programatically to walk around FPS drop that would be great. Cheers, Dawid
Topic: Graphics & Games SubTopic: SpriteKit Tags:
Sep ’25
Reply to Metal not working in Swift Playgrounds (SSC Scene)
@Graphics and Games Engineer Thanks for the suggestion! I am trying to follow it and trying to compile shaders dynamically, so that I can use them as effects in SwiftUI, but it does not work. What I am doing is this (please don’t mind forced unwrapping): let shaderURL = Bundle.main.url(forResource: "example-swiftui-shaders", withExtension: "txt")! let source = try! String(contentsOf: shaderURL, encoding: .utf8) do { let device = MTLCreateSystemDefaultDevice()! let opt = MTLCompileOptions() opt.enableLogging = true let library = try device.makeLibrary( source: source, options: opt) print("ok", library) } catch { print("error", error) } I am getting a compilation error: Error Domain=MTLLibraryErrorDomain Code=3 "program_source:10:10: fatal error: 'SwiftUI/SwiftUI_Metal.h' file not found #include <SwiftUI/SwiftUI_Metal.h> ^~~~~~~~~~~~~~~~~~~~~~~~~ program_source:10:10: note: did not find header 'SwiftUI_Metal.h' in framework 'SwiftUI' (loaded from '/System/Library/Frameworks') " UserInfo={NSLocalizedDescription=program_source:10:10: fatal error: 'SwiftUI/SwiftUI_Metal.h' file not found #include <SwiftUI/SwiftUI_Metal.h> ^~~~~~~~~~~~~~~~~~~~~~~~~ program_source:10:10: note: did not find header 'SwiftUI_Metal.h' in framework 'SwiftUI' (loaded from '/System/Library/Frameworks') } I took the example shaders from here: https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-metal-shaders-to-swiftui-views-using-layer-effects Shader include this line: #include <SwiftUI/SwiftUI_Metal.h> which is needed in order to be able to use shaders in .layerEffect(). Are there some compilation options one should enable to get this working? Thanks! Dawid
1d
Reply to Metal not working in Swift Playgrounds (SSC Scene)
I made some progress! Or at least I think so, it is still unclear. I simplified the shader code to not include the external library for now: #include <metal_stdlib> using namespace metal; [[ stitchable ]] half4 checkerboard(float2 position, half4 currentColor, float size, half4 newColor) { uint2 posInChecks = uint2(position.x / size, position.y / size); bool isColor = (posInChecks.x ^ posInChecks.y) & 1; return isColor ? newColor * currentColor.a : half4(0.0, 0.0, 0.0, 0.0); } I am going to deal with the missing library later. Now the expanded shader compilation code looks as follows: let shaderURL = Bundle.main.url(forResource: "shaders", withExtension: "txt")! let source = try! String(contentsOf: shaderURL, encoding: .utf8) do { let device = MTLCreateSystemDefaultDevice()! let opt = MTLCompileOptions() opt.enableLogging = true // Those two options are important. opt.libraryType = .dynamic opt.installName = "shaders.metallib" // We need to create MTLLibrary... let library = try device.makeLibrary(source: source, options: opt) // ...that we convert into dynamic library... let dynLib = try device.makeDynamicLibrary(library: library) // ...that we can serialize to disk as metallib file... let tempUrl : URL = .temporaryDirectory.appending( component: dynLib.installName, directoryHint: .notDirectory) try dynLib.serialize(to: tempUrl) // ... that we can finally read as ShaderLibrary let sLib = ShaderLibrary(url: tempUrl) } catch { // } One success is that now MTLLibrary builds successfully, I can confirm checkerboard function is there. So far so good! ShaderLibrary constructor does not complain, but the problem is that it does not work when used in say .colorEffect - everything just hangs, and as I am using Playgrounds, debugging anything is impossible.
1d