9 Replies
      Latest reply on Oct 22, 2019 10:10 AM by MKX
      Omnitje Level 1 Level 1 (0 points)

        Hi all,

         

        A metal project of mine suddenly stopped working after upgrading to Xcode11 and iOS13. I found out that this is related to the SKRenderer class and its render(withViewport:commandBuffer:renderPassDescriptor:) method. I use metal to render a 3d environment and use SKRenderer to overlay a UI on top of that. Xcode does not crash or present any error, it just stops drawing/updating after a couple of frames (around 0.5 seconds in) and freezes my screen. This only happens when running the app through Xcode. If I run the app directly from my phone after, it runs just fine. However, this prevents me from using Xcode's debugging tools.

         

        I tried to create a new clean project using SKRenderer and only one scene with one label, but it still freezes. I also tried removing SKRenderer from my rendering setup, this works but obviously I need my SpriteKit UI.

         

        The code where it goes wrong is shown below (i removed all the clutter to only show the essentials).

         

        public init(....) {
        
                  ...
                self.render = SKRenderer(device: OContext.device)
                self.render.scene = aSKScene
            }
        
        open func draw(commandBuffer: MTLCommandBuffer) {
        
                // Draw scene
                let viewport = CGRect(origin: CGPoint.zero, size: self.size)
                self.render.update(atTime: CACurrentMediaTime())
                  // FREEZES BELOW
                self.render.render(withViewport: viewport, commandBuffer: commandBuffer, renderPassDescriptor: self.descriptor)
            }
        
        

         

        When the app freezes and I click on pause within Xcode it shows me:

         

        App > Thread 1 > 0 semaphore_wait_trap

        libsystem_kernel.dylib`semaphore_wait_trap:
            0x1a6442bf8 <+0>: mov    x16, #-0x24
            0x1a6442bfc <+4>: svc    #0x80
        ->  0x1a6442c00 <+8>: ret    
        
        

         

        App > Thread 1 > 15 -[SKRenderer renderWithViewport:commandBuffer:renderPassDescriptor:]

        SpriteKit`-[SKRenderer renderWithViewport:commandBuffer:renderPassDescriptor:]:
            0x1bf1227f4 <+0>:   pacibsp 
            0x1bf1227f8 <+4>:   stp    d11, d10, [sp, #-0x60]!
            0x1bf1227fc <+8>:   stp    d9, d8, [sp, #0x10]
            0x1bf122800 <+12>:  stp    x24, x23, [sp, #0x20]
            0x1bf122804 <+16>:  stp    x22, x21, [sp, #0x30]
            0x1bf122808 <+20>:  stp    x20, x19, [sp, #0x40]
            0x1bf12280c <+24>:  stp    x29, x30, [sp, #0x50]
            0x1bf122810 <+28>:  add    x29, sp, #0x50            ; =0x50 
            0x1bf122814 <+32>:  mov    x20, x3
            0x1bf122818 <+36>:  mov.16b v8, v3
            0x1bf12281c <+40>:  mov.16b v9, v2
            0x1bf122820 <+44>:  mov.16b v10, v1
            0x1bf122824 <+48>:  mov.16b v11, v0
            0x1bf122828 <+52>:  mov    x22, x0
            0x1bf12282c <+56>:  mov    x0, x2
            0x1bf122830 <+60>:  bl     0x1b8139128
            0x1bf122834 <+64>:  mov    x19, x0
            0x1bf122838 <+68>:  mov    x0, x20
            0x1bf12283c <+72>:  bl     0x1b8139128
            0x1bf122840 <+76>:  mov    x20, x0
            0x1bf122844 <+80>:  adrp   x8, 126727
            0x1bf122848 <+84>:  add    x1, x8, #0x9c2            ; =0x9c2 
            0x1bf12284c <+88>:  mov    x0, x19
            0x1bf122850 <+92>:  bl     0x1b81390b8
            0x1bf122854 <+96>:  mov    x29, x29
            0x1bf122858 <+100>: bl     0x1b8139158
            0x1bf12285c <+104>: mov    x21, x0
            0x1bf122860 <+108>: adrp   x8, 126734
            0x1bf122864 <+112>: add    x1, x8, #0x3c1            ; =0x3c1 
            0x1bf122868 <+116>: mov    x0, x19
            0x1bf12286c <+120>: mov    x2, x20
            0x1bf122870 <+124>: bl     0x1b81390b8
            0x1bf122874 <+128>: mov    x29, x29
            0x1bf122878 <+132>: bl     0x1b8139158
            0x1bf12287c <+136>: mov    x23, x0
            0x1bf122880 <+140>: adrp   x8, 126725
            0x1bf122884 <+144>: add    x1, x8, #0x696            ; =0x696 
            0x1bf122888 <+148>: adrp   x2, 163830
            0x1bf12288c <+152>: add    x2, x2, #0x6e0            ; =0x6e0 
            0x1bf122890 <+156>: bl     0x1b81390b8
            0x1bf122894 <+160>: adrp   x8, 129605
            0x1bf122898 <+164>: add    x1, x8, #0xbb7            ; =0xbb7 
            0x1bf12289c <+168>: mov.16b v0, v11
            0x1bf1228a0 <+172>: mov.16b v1, v10
            0x1bf1228a4 <+176>: mov.16b v2, v9
            0x1bf1228a8 <+180>: mov.16b v3, v8
            0x1bf1228ac <+184>: mov    x0, x22
            0x1bf1228b0 <+188>: mov    x2, x23
            0x1bf1228b4 <+192>: mov    x3, x20
            0x1bf1228b8 <+196>: mov    x4, x21
            0x1bf1228bc <+200>: bl     0x1b81390b8
        ->  0x1bf1228c0 <+204>: adrp   x8, 126721
            0x1bf1228c4 <+208>: add    x1, x8, #0x3a5            ; =0x3a5 
            0x1bf1228c8 <+212>: mov    x0, x23
            0x1bf1228cc <+216>: bl     0x1b81390b8
            0x1bf1228d0 <+220>: mov    x0, x23
            0x1bf1228d4 <+224>: bl     0x1b8139118
            0x1bf1228d8 <+228>: mov    x0, x21
            0x1bf1228dc <+232>: bl     0x1b8139118
            0x1bf1228e0 <+236>: mov    x0, x20
            0x1bf1228e4 <+240>: bl     0x1b8139118
            0x1bf1228e8 <+244>: mov    x0, x19
            0x1bf1228ec <+248>: ldp    x29, x30, [sp, #0x50]
            0x1bf1228f0 <+252>: ldp    x20, x19, [sp, #0x40]
            0x1bf1228f4 <+256>: ldp    x22, x21, [sp, #0x30]
            0x1bf1228f8 <+260>: ldp    x24, x23, [sp, #0x20]
            0x1bf1228fc <+264>: ldp    d9, d8, [sp, #0x10]
            0x1bf122900 <+268>: ldp    d11, d10, [sp], #0x60
            0x1bf122904 <+272>: autibsp 
            0x1bf122908 <+276>: b      0x1b8139118
            0x1bf12290c <+280>: mov    x22, x0
            0x1bf122910 <+284>: b      0x1bf122928               ; <+308>
            0x1bf122914 <+288>: mov    x22, x0
            0x1bf122918 <+292>: b      0x1bf122930               ; <+316>
            0x1bf12291c <+296>: mov    x22, x0
            0x1bf122920 <+300>: mov    x0, x23
            0x1bf122924 <+304>: bl     0x1b8139118
            0x1bf122928 <+308>: mov    x0, x21
            0x1bf12292c <+312>: bl     0x1b8139118
            0x1bf122930 <+316>: mov    x0, x20
            0x1bf122934 <+320>: bl     0x1b8139118
            0x1bf122938 <+324>: mov    x0, x19
            0x1bf12293c <+328>: bl     0x1b8139118
            0x1bf122940 <+332>: mov    x0, x22
            0x1bf122944 <+336>: bl     0x1b8138888
            0x1bf122948 <+340>: brk    #0x1
        
        

         

        Next step in the thread shows the render method I posted above.

         

        Anyone else having this issue? What could be the problem?

        • Re: SKRenderer freezes with xcode11 ios13
          jpalaka Level 1 Level 1 (0 points)

          Omnitje,

           

          Im glad I saw your post! I am having the same exact issue! Unfortunetly, I do not have a solution and have been trying to find one for awhile. I actually encountered this issue before when I had installed the iOS 13 beta on my iPhone about a few months ago. I had to revert back to iOS 12 and that solved my solution.

           

          Now, since Apple released iOS 13 (non-beta) I decided to give it another try but still no luck... and I am in the same situation you are in. When i run my program, the application opens and freezes about 0.5 second in. The background music is still playing but the screen is frozen and I cannot initiate any other action. But when I open the application by itself, it works just fine.

           

          This issue definitely has something to do with the overlaySKScene method because when I comment it out and re-run, the scnscene renders just fine! I will continue to search for a solution.

           

          Please please please let me know if you find a solution since your post or end up finding one in the near future. I was thinking about sending a ticket to Apple developers using the code-level support TSI. I'm assuming this is a minor bug within iOS 13 and in that case I'm hoping for an iOS 13 update soon that fixes this issue!

          • Re: SKRenderer freezes with xcode11 ios13
            Jaehyun Kang Level 1 Level 1 (0 points)

            I also have the same experience.
            At first I used xcode 11 gm ver. for my scenekit project, the same symptom happened.
            Because there was no error and crashed, just the screen frozen, I thought it's an error. So I waited for offical version.
            But when I try it using official version, it still happens.

            Anybody who solved this issue, please share your solution.





            • Re: SKRenderer freezes with xcode11 ios13
              MKX Level 1 Level 1 (10 points)

              Would it be possible for anyone to post a working sample project?

              I've very courios to see how this works. thx