Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: 0 fullscreen modes available on 14inch macbook pro  (Read 7613 times)

0 Members and 1 Guest are viewing this topic.

TDSOJohn

  • Newbie
  • *
  • Posts: 2
    • View Profile
0 fullscreen modes available on 14inch macbook pro
« on: June 28, 2022, 06:56:45 pm »
Hi everyone, not sure if this is the right place to ask, but I'm having a problem with fullscreen mode on the new 14inch macbook pro. If I copy and run the code from the SFML videomode documentation ( https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1VideoMode.php#a6815b9b3b35767d5b4563fbed4bfc67b ) it returns a vector of size 0.
If I try to manually force fullscreen video mode with
mWindow(sf::VideoMode(), "name", sf::Style::Fullscreen)
 
it crashes with error:

The requested video mode is not available, switching to a valid mode

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

I've also tried with a specific VideoMode resolution. Is it possible that no fullscreen videomode is available? Does anyone know how to solve this problem?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #1 on: June 29, 2022, 11:48:37 pm »
That seems rather odd. Do you get any Desktop Modes at least?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

TDSOJohn

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #2 on: June 30, 2022, 12:57:38 pm »
That seems rather odd. Do you get any Desktop Modes at least?

I get:

3024x1964 - 32 bpp

by running sf::VideoMode::getDesktopMode() (which is the correct resolution of my screen).

I'm running a minimal example:

#include <vector>
#include <iostream>

#include <SFML/Window.hpp>


int main()
{

    // Display the list of all the video modes available for fullscreen
    std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes();
    for (std::size_t i = 0; i < modes.size(); ++i)
    {
        sf::VideoMode mode = modes[i];
        std::cout << "Mode #" << i << ": "
                  << mode.width << "x" << mode.height << " - "
                  << mode.bitsPerPixel << " bpp" << std::endl;
    }

    sf::VideoMode defaultMode = sf::VideoMode::getDesktopMode();
    std::cout << defaultMode.width << "x" << defaultMode.height << " - "
              << defaultMode.bitsPerPixel << " bpp" << std::endl;

    sf::Window window(sf::VideoMode(800, 600), "My window");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

I'm able to run any window by creating a specific VideoMode, the only thing that doesn't work is fullscreen.

nelson

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #3 on: October 30, 2022, 05:41:04 am »
I am running into the same problem on an M1 16" MacBook Pro.

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #4 on: November 18, 2022, 11:46:35 am »
I also see exactly the same symptoms on a Macbook Air M2.

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #5 on: November 18, 2022, 12:46:26 pm »
Which versions of macOS are you on?

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #6 on: November 18, 2022, 12:49:48 pm »
I am on the latest, Ventura 13.0.1.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #7 on: November 18, 2022, 01:12:31 pm »
If anyone with a debugger could jump into the SFML code and see whether they're getting any values returned from the macOS functions, it could narrow down the problem: https://github.com/SFML/SFML/blob/2.6.x/src/SFML/Window/OSX/VideoModeImpl.cpp

Additionally, it might also be that the [ulr=https://github.com/SFML/SFML/blob/2.6.x/src/SFML/Window/OSX/cg_sf_conversion.mm#L53]deprecated CGDisplayModeCopyPixelEncoding function[/url] got broken and now the BPP isn't calculated correctly.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #8 on: November 18, 2022, 03:06:56 pm »
I'd be happy to help but cannot step into the call.

I've tried building debug versions of the SFML libraries but cannot seem to get an arm64 build to work.

It's all been a bit trial-and-error by downloading the source running CMake - I can build x86_64 OK, but when I specify arm64 with CMAKE_OSX_ARCHITECTURES it won't work.

If anyone's got any links to notes on how to build SFML correctly on MacOS for arm I'd be grateful - it's likely I've missed some obviously-placed documentation :)

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #9 on: December 10, 2022, 01:56:42 am »
OK, finally got it working (my debugging, that is, not the code!).

in https://github.com/SFML/SFML/blob/2.6.x/src/SFML/Window/OSX/VideoModeImpl.cpp I put some debug output where I suspected the issue was, between lines 64 and 65 (the "continue"). These are the values I see, so it shows all of the modes are skipped because they are being reported as bigger than the desktop.

mode.size.x = 3840, desktop.size.x = 3420, mode.size.y = 2400, desktop.size.y = 2224
mode.size.x = 4096, desktop.size.x = 3420, mode.size.y = 2560, desktop.size.y = 2224
mode.size.x = 4096, desktop.size.x = 3420, mode.size.y = 2664, desktop.size.y = 2224
mode.size.x = 5120, desktop.size.x = 3420, mode.size.y = 3200, desktop.size.y = 2224
mode.size.x = 5120, desktop.size.x = 3420, mode.size.y = 3328, desktop.size.y = 2224
(Empty std::vector of modes returned)

« Last Edit: December 10, 2022, 02:58:13 am by md81544 »

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #10 on: December 11, 2022, 08:12:53 pm »
...and interestingly, if I remove the "continue" in getFullscreenModes() and let it add the "invalid" modes to the return vector, I can successfully get a fullscreen mode going in a test program on MacOS.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #11 on: December 12, 2022, 08:55:06 am »
Is your desktop resolution then smaller than what the OS lets you select, i.e. is your resolution 3420x2224?

In your test program, can you also switch to one of the modes?
The comment makes me think that SFML wouldn't be able to change the resolution.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #12 on: December 12, 2022, 09:01:59 am »
The native resolution of the macbook air M2 I'm using is 2560 x 1664, so is smaller than all the modes reported (I have no external display connected).

In the test program I just let it fall back to an unknown full-screen mode. It did display the "The requested video mode is not available, switching to a valid mode" messge, but it did go to a valid mode. I can experiment later to see which one it lets me select directly, if that helps?

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #13 on: December 12, 2022, 09:14:55 am »
OK, I tried it just now. These are the "invalid" modes I allowed getFullscreenModes() to return with my changes:

Mode #0: 5120x3328 - 32 bpp
Mode #1: 5120x3200 - 32 bpp
Mode #2: 4096x2664 - 32 bpp
Mode #3: 4096x2560 - 32 bpp
Mode #4: 3840x2400 - 32 bpp


and if I select any of these with, e.g.

sf::RenderWindow win(modes[0], "Test", sf::Style::Fullscreen);

then it works fine. The "fallback" I mentioned previously must have been because I chose 800x600 in fullscreen initially, rather than one of the fullscreen modes. So ignore that.

Once in any of those modes, if I do a

sf::CircleShape shape(50.f);

then it displays at the same size, regardless of mode selected, which makes me wonder if I'm getting native resolution, no matter which mode I select.

« Last Edit: December 12, 2022, 09:18:12 am by md81544 »

md81544

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 0 fullscreen modes available on 14inch macbook pro
« Reply #14 on: December 12, 2022, 09:23:19 am »
Actually, if I draw a circle in any of the fullscreen modes with

sf::CircleShape shape(550.f);

then it pretty much fills the vertical space of the fullscreen-ed screen. So does that mean the resolution being used is around 1100 pixels high? Not sure if this sheds any extra light on anything..?

 

anything