Page 1 of 1

CreateSprite stalls

Posted: Mon Jul 31, 2023 8:14 am
by jamirokwai
Hi there,

working with PB 6.02 ARM, C Backend on my MacBook M2. This code stalls at the CreateSprite()-function.

Code: Select all

InitSprite()
OpenScreen(1280, 800, 32, "bla")
msCurs = CreateSprite(#PB_Any, 64, 64)
Debug mscurs

Re: CreateSprite stalls

Posted: Mon Jul 31, 2023 1:35 pm
by infratec
Also with 5.73 on Intel iMac 27"

So it has nothing to do with C backend.

Re: CreateSprite stalls

Posted: Mon Jul 31, 2023 6:30 pm
by Shardik
jamirokwai's example code indeed doesn't respond anymore after exexcution in the IDE on my iMac 2019 27'' with Intel i5-8500 processor on MacOS 13.5 'Ventura' and PB 6.02 with Asm and C backend. But his code has two shortcomings: it doesn't test the return value of InitSprite() and OpenScreen(). When running this code from PB's help for listing all supported screen resolutions on my Mac hardware, I had to find out that 1280x800 isn't supported:

Code: Select all

InitSprite()

If ExamineScreenModes()
  While NextScreenMode()
    Debug Str(ScreenModeWidth())+"x"+Str(ScreenModeHeight())+"x"+Str(ScreenModeDepth())+"@"+Str(ScreenModeRefreshRate())+"Hz"
  Wend
EndIf

When changing the screen resolution from 1280x800 (unsupported) to 1280x720 (supported), jamirokwai's example runs like a charm!

This modified example displays an error message if InitSprite() or OpenScreen() fails:

Code: Select all

If InitSprite() = 0
  MessageRequester("Error", "InitSprite() failed!")
Else
; If OpenScreen(1280, 800, 32, "bla") = 0 ; Not supported on my iMac 2019 27''!
  If OpenScreen(1280, 720, 32, "bla") = 0 ; Supported on my iMac 2019 27''
    MessageRequester("Error", "OpenScreen() failed!")
  Else
    msCurs = CreateSprite(#PB_Any, 64, 64)
    Debug mscurs
  EndIf
EndIf

Re: CreateSprite stalls

Posted: Mon Jul 31, 2023 7:07 pm
by jamirokwai
Thanks for the info, shardik!

I found 1280x800x60 in the list you also provided the code for.
So, the bug/error lies in OpenScreen()?

Re: CreateSprite stalls

Posted: Mon Jul 31, 2023 7:17 pm
by mrbungle
Confirmed. This may be related to M1/M2 macs.

Re: CreateSprite stalls

Posted: Mon Jul 31, 2023 7:19 pm
by jamirokwai
I changed the code for examining screen modes. After some flickering... See the table. X means, it works.
It's on my MacBook Pro M2.Working modes start with 1920x1200.

Don't know. Is this a bug? Not really...
Or do I really have to check all modes until I find the smallest one working :-(

Code: Select all

InitSprite()
If ExamineScreenModes()
  While NextScreenMode()
    wide = ScreenModeWidth()
    high = ScreenModeHeight()
    If OpenScreen(wide, high, 32, "test") = 0
      Debug "-" + Str(wide)+"x"+Str(high)+"x"+Str(ScreenModeDepth())+"@"+Str(ScreenModeRefreshRate())+"Hz"
    Else
      Debug "x" + Str(wide)+"x"+Str(high)+"x"+Str(ScreenModeDepth())+"@"+Str(ScreenModeRefreshRate())+"Hz"
      CloseScreen()      
    EndIf
  Wend
EndIf

Code: Select all

-960x600x32@120Hz
-960x600x32@60Hz
-960x600x32@59Hz
-960x600x32@50Hz
-960x600x32@48Hz
-960x600x32@47Hz
-1024x640x32@120Hz
-1024x640x32@60Hz
-1024x640x32@59Hz
-1024x640x32@50Hz
-1024x640x32@48Hz
-1024x640x32@47Hz
-1024x665x32@120Hz
-1024x665x32@60Hz
-1024x665x32@59Hz
-1024x665x32@50Hz
-1024x665x32@48Hz
-1024x665x32@47Hz
-1147x716x32@120Hz
-1147x716x32@60Hz
-1147x716x32@59Hz
-1147x716x32@50Hz
-1147x716x32@48Hz
-1147x716x32@47Hz
-1147x745x32@120Hz
-1147x745x32@60Hz
-1147x745x32@59Hz
-1147x745x32@50Hz
-1147x745x32@48Hz
-1147x745x32@47Hz
-1280x800x32@120Hz
-1280x800x32@60Hz
-1280x800x32@59Hz
-1280x800x32@50Hz
-1280x800x32@48Hz
-1280x800x32@47Hz
-1352x845x32@120Hz
-1352x845x32@60Hz
-1352x845x32@59Hz
-1352x845x32@50Hz
-1352x845x32@48Hz
-1352x845x32@47Hz
-1352x878x32@120Hz
-1352x878x32@60Hz
-1352x878x32@59Hz
-1352x878x32@50Hz
-1352x878x32@48Hz
-1352x878x32@47Hz
-1512x945x32@120Hz
-1512x945x32@60Hz
-1512x945x32@59Hz
-1512x945x32@50Hz
-1512x945x32@48Hz
-1512x945x32@47Hz
-1512x982x32@120Hz
-1512x982x32@60Hz
-1512x982x32@59Hz
-1512x982x32@50Hz
-1512x982x32@48Hz
-1512x982x32@47Hz
-1800x1125x32@120Hz
-1800x1125x32@60Hz
-1800x1125x32@59Hz
-1800x1125x32@50Hz
-1800x1125x32@48Hz
-1800x1125x32@47Hz
-1800x1169x32@120Hz
-1800x1169x32@60Hz
-1800x1169x32@59Hz
-1800x1169x32@50Hz
-1800x1169x32@48Hz
-1800x1169x32@47Hz
x1920x1200x32@120Hz
x1920x1200x32@60Hz
x1920x1200x32@59Hz
x1920x1200x32@50Hz
x1920x1200x32@48Hz
x1920x1200x32@47Hz
x2048x1280x32@120Hz
x2048x1280x32@60Hz
x2048x1280x32@59Hz
x2048x1280x32@50Hz
x2048x1280x32@48Hz
x2048x1280x32@47Hz
x2048x1330x32@120Hz
x2048x1330x32@60Hz
x2048x1330x32@59Hz
x2048x1330x32@50Hz
x2048x1330x32@48Hz
x2048x1330x32@47Hz
x2294x1432x32@120Hz
x2294x1432x32@60Hz
x2294x1432x32@59Hz
x2294x1432x32@50Hz
x2294x1432x32@48Hz
x2294x1432x32@47Hz
x2294x1490x32@120Hz
x2294x1490x32@60Hz
x2294x1490x32@59Hz
x2294x1490x32@50Hz
x2294x1490x32@48Hz
x2294x1490x32@47Hz
x2560x1600x32@120Hz
x2560x1600x32@60Hz
x2560x1600x32@59Hz
x2560x1600x32@50Hz
x2560x1600x32@48Hz
x2560x1600x32@47Hz
x2704x1690x32@120Hz
x2704x1690x32@60Hz
x2704x1690x32@59Hz
x2704x1690x32@50Hz
x2704x1690x32@48Hz
x2704x1690x32@47Hz
x2704x1756x32@120Hz
x2704x1756x32@60Hz
x2704x1756x32@59Hz
x2704x1756x32@50Hz
x2704x1756x32@48Hz
x2704x1756x32@47Hz
x3024x1890x32@120Hz
x3024x1890x32@60Hz
x3024x1890x32@59Hz
x3024x1890x32@50Hz
x3024x1890x32@48Hz
x3024x1890x32@47Hz
x3024x1964x32@120Hz
x3024x1964x32@60Hz
x3024x1964x32@59Hz
x3024x1964x32@50Hz
x3024x1964x32@48Hz
x3024x1964x32@47Hz

Re: CreateSprite stalls

Posted: Mon Jul 31, 2023 7:58 pm
by mrbungle
Got it. Seems to be tied to the actual retina resolution vs the scaled resolutions.