Post

Replies

Boosts

Views

Activity

makeLibrary doesn’t report warnings on successful compile
I’m working with Metal on iPad Playgrounds and made a simple editor to help craft shaders. Press a button, it tries to make the library, and reports any errors or warnings. The problem is it doesn’t report warnings if the compile was successful. I’m using the version of makeLibrary with a completion handler which passes in both a MTLLibrary? and Error? because the docs specifically say “Both library and error can be non-nil if the compiler successfully generates a library with warnings.” However I’m not seeing that happen, when there’s only warnings the Error parameter is nil. Maybe I’m misunderstanding or using something wrong. Is this a bug or how do I get the warnings on a successful compile? Here’s a demo. It should show 2 warnings but doesn’t because err is nil. Add an extraneous character in source to cause an error and then err is not nil and shows the 2 warnings. import SwiftUI let source = """ #include <metal_stdlib> using namespace metal; float something() {} #warning "foo"; """ struct ContentView: View { var body: some View { Button("test") { guard let device = MTLCreateSystemDefaultDevice() else { return } device.makeLibrary(source: source, options: nil) { lib, err in if err == nil { print("no errors or warnings") } else if let err = err as? MTLLibraryError { print("found errors or warnings") print(err.localizedDescription) } else { print("unknown error type") } } } } } Oh, and this is where it says both library and error can be non-nil https://developer.apple.com/documentation/metal/mtlnewlibrarycompletionhandler
0
0
448
Aug ’23
Playgrounds crashes all the time, what do I do?
IPad Playgrounds has started to routinely crash on me. It started crashing while I was trying to work with protocol meta types, so I thought something about that feature was doing it, but I’ve moved onto other projects, or even brand new ones and Playgrounds keeps crashing. It seems to have something to do with comments. If I’m just editing code it’ll keep going and the preview will update, but if I start to edit a comment I’ll see the compiler begin to spin and it crashes. I can post a video later if needed. I’ve rebooted the device and it’s still crashing. What do I do? If I delete and reinstall Playgrounds will all my projects stay there or do I need to back them up somehow?
7
0
3.3k
May ’22