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

Author Topic: SFML With multi GPU  (Read 7568 times)

0 Members and 1 Guest are viewing this topic.

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
SFML With multi GPU
« on: January 15, 2018, 01:25:31 pm »
Hi,
I got a laptop with intel GPU and nvidia GPU. 
I parametred my .exe to start with the nvidia. 
When i start the RenderWindow in windowed mode, it use my Nvidia card, when the RenderWindow is fullscreen, it use the intel GPU. 
Anyone know how i can fix this ?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #1 on: January 15, 2018, 02:26:17 pm »
Tell your GPU config to use the Nvidia GPU.



Alternatively, if you link sfml-main it will also enforce that the dedicated GPU is used.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #2 on: January 15, 2018, 02:33:19 pm »
This is already the case: 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #3 on: January 15, 2018, 03:13:29 pm »
I'm on the second tab in the image above, where you specify which GPU to use for which program.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #4 on: January 15, 2018, 11:27:27 pm »
I dont know why, but the screenshot doesnt work now. 
I did both, global settings and program settings. 
The weird thing is it start with nvidia gpu in windowed mode.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #5 on: January 15, 2018, 11:28:12 pm »
And how do you know that?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #6 on: January 16, 2018, 12:00:04 am »
Windows 10 added GPU info in the task manager, also in windowed mode i got like 900 fps but only 300 in fullscreen. 
Pics: 


Windowed mode:

FullScreen mode:


And what gpu 0 and gpu 1 correspond to: 

Used same executable for both. 
Using SFML.NET 2.2 in C#
Code that launch the RenderWindow:
Quote
var answere = Console.ReadLine()?.ToLower();
bool windowed = !(answere == "yes" || answere == "y");
var window = windowed ? new RenderWindow(VideoMode.FullscreenModes[2], "Vestige", Styles.Titlebar | Styles.Close) : new RenderWindow(VideoMode.FullscreenModes[0], "Vestige", Styles.Fullscreen);
« Last Edit: January 16, 2018, 12:04:12 am by Kuinox »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #7 on: January 16, 2018, 12:50:12 am »
Do you have multiple monitors?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #8 on: January 16, 2018, 09:52:53 am »
Yes/No 
When i noticed the issue i was only using the monitor of my laptop, and no other monitor was connected. 
When i did the screenshot, i was using a monitor, while my laptop screen was off. 

Also, my colleague have a problem on his new laptop, the Fullscreen mode doesn't cover the screen. 
Pic: 

« Last Edit: January 16, 2018, 10:01:21 am by Kuinox »

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #9 on: January 20, 2018, 07:47:22 pm »
Little up ! More seriously, i dont know if you didn't noticed my reply. 
Side note, a friend have some rendering problem on his mac(on a windows VM), caused by a Texture changement, but we don't have this problem on our Windows. I can have more information on this problem monday.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #10 on: January 20, 2018, 10:23:15 pm »
VMs are not really supported. I mean  they often do weird GPU things or just software renderers.

My notebook runs two GPUs as well and I'm not running into any issues, so I don't know what's happening.

Have you updated your Nvidia and Intel drivers?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #11 on: January 21, 2018, 02:06:35 am »
I'm using constructor latest driver for intel chipset, and the latest nvidia drivers. 
Tomorrow i will try with another laptop to reproduce this. 
Also, as i mentioned in a previous reply, the fullscreen bug on my friend laptop is now "resolved" we didn't changed anything and it fixed itself   :o

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #12 on: January 21, 2018, 12:22:30 pm »
What's "constructor"?

What are the driver version numbers?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kuinox

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: SFML With multi GPU
« Reply #13 on: January 21, 2018, 04:21:22 pm »
I mean the driver provided by HP. 
I'm using the 21.20.16.4542

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SFML With multi GPU
« Reply #14 on: January 21, 2018, 05:58:37 pm »
That Intel driver is pretty much 1 year old and as such not the latest driver, but it may be the latest driver for your HP device. Unfortunately HP (and other vendors) often restrict their users in some weird ways to get the latest updates and then they don't update their special driver versions.

From my point of view this is not really an SFML issue and you might find better help on some general Windows/HP support forum.
I've quickly googled a bit and you're certainly not the only one experiencing issues with the switching. I've seen posts where people mentioned that reinstalling the Nvidia driver helped. Or that some said using the "official" HP drivers instead of the latest Nvidia driver fixed the switching issue.

I ran the following test example on my notebook with 2 GPUs and it either ran on the Intel GPU or the Nvidia GPU depending which one I told it to run on.

#include <SFML/Graphics.hpp>
#include <iostream>

int main()
{
    sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Multi GPU", sf::Style::Fullscreen);
    window.setFramerateLimit(60);

    // load font
    sf::Font font;
    if (!font.loadFromFile("arial.ttf"))
    {
        std::cerr << "Failed to load font!" << std::endl;
        return 1;
    }

    sf::Text text("0", font);
    sf::Clock clock;
   
    while (window.isOpen())
    {
        auto dt = clock.restart();
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
            else if (event.type == sf::Event::KeyReleased)
            {
                if (event.key.code == sf::Keyboard::Escape)
                {
                    window.close();
                }
                else if (event.key.code == sf::Keyboard::Return)
                {
                    window.create(sf::VideoMode::getDesktopMode(), "Multi GPU", sf::Style::Fullscreen);
                }
                else if (event.key.code == sf::Keyboard::Space)
                {
                    window.create(sf::VideoMode::getDesktopMode(), "Multi GPU", sf::Style::Default);
                }
            }
        }

        text.setString(std::to_string(1.f / dt.asSeconds()));

        window.clear();
        window.draw(text);
        window.display();
    }
}
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything