[0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Things that we don't consider worth fixing at this moment.
Post Reply
piron1991
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Oct 24, 2015 10:48 pm
Contact:

[0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Post by piron1991 »

specs:
Laptop Samsung rf511
CPU:Intel Core i5-2410M
GPUs:
1: Intel HD graphics 3000
2:nVidia GeForce GT 540M

Factorio version: 0.12.13


as per title, no matter what fidling i do with game and optimus, only one that is seen and grabbed is GPU no.1(as seen in factorio-current-noForceOGL.log file) but is detecting properly when forceOpenGL option is set to true (logfile factorio-currentForceOGL.log).

Also attaching file DisplayInfo.txt from EnumDisplays posted here https://forums.factorio.com/forum/viewtop ... 11&t=16287
Attachments
DisplayInfo.txt
(4.42 KiB) Downloaded 262 times
factorio-currentForceOGL.log
(1.24 KiB) Downloaded 254 times
factorio-current-noForceOGL.log
(1.29 KiB) Downloaded 252 times

posila
Factorio Staff
Factorio Staff
Posts: 4933
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Game not detecting GPU properly

Post by posila »

Thanks for the report. It is interesting that behavior is different for DirectX and OpenGL. However I have no idea what to change in order to Optimus recognize Factorio as graphics-heavy application. Maybe we should make OpenGL default on Windows. DirectX islot of trouble for us lately. Especially since Windows 10 came out. (Not to blame DirectX or Windows 10; we use DirectX 9 - because of compatibility with WinXP, and it is not big surprise too me that 13 year old API starts making problems on modern hardware)

orzelek
Smart Inserter
Smart Inserter
Posts: 3809
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Game not detecting GPU properly

Post by orzelek »

Would it be possible to actually use DirectX 10?
It could help with all those strange problems. Win XP support is a bit far fetched currently.

posila
Factorio Staff
Factorio Staff
Posts: 4933
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: Game not detecting GPU properly

Post by posila »

We use Allegro graphics library. I search for DirectX 10 or 11 backend for Allegro, but didn't find anything. Even though I would be interested in creating DX11 backend by myself, I am not sure if it is worth it and wouldn't make more sense for us to just use OGL.

piron1991
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Oct 24, 2015 10:48 pm
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by piron1991 »

Well i dug some more for search on optimus APi and found those:
http://developer.download.nvidia.com/de ... licies.pdf
http://docs.nvidia.com/cuda/optimus-dev ... index.html
http://www.opentk.com/node/3144

and good old stack overflow
http://stackoverflow.com/questions/1053 ... us-laptops

and TL;DR those links, you supposedly can just:
1) either link staticly one of those libs:vcamp110.dll, vcamp110d.dll, nvapi.dll, nvapi64.dll, opencl.dll, nvcuda.dll, and cudart*.*.
2)exporting Global Variable NvOptimusEnablement
3)create profile? im not sure about this one from opentk.com

idk how viable any of those are for you but hopefully you find something worthwile:) also if you need testing that out im willing to help with this one

Rseding91
Factorio Staff
Factorio Staff
Posts: 11776
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by Rseding91 »

I don't think it's Factorio's responsibility to determine which GPU to use. Normally in a multi-GPU setup the GPU switching software on the OS determines that - at least in every multi GPU setup I've ever seen that's how it worked.

I've also never seen a multi-GPU setup that worked well. I've always just ended up disabling the lower end one due to bugs around it. You'll probably be better off doing that as well.
If you want to get ahold of me I'm almost always on Discord.

posila
Factorio Staff
Factorio Staff
Posts: 4933
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by posila »

@piron1991: That is not what I had in mind, but the solution with global variable is simple enough (and non-intrusive enough) that we will give it a try. Thank you for finding it for us :D
But I agree with Rseding, that things like this, that are completely outside of standard graphical API and should be handled by graphical driver are not our bugs, but driver issues.

EDIT: I preprared it for 0.12.16. Please let us know if it helps :)

Lee_newsum
Filter Inserter
Filter Inserter
Posts: 433
Joined: Wed Jan 15, 2014 9:41 am
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by Lee_newsum »

One think to add to this wen you go to stem, stem add some "thing" inbetreen the game and the OS. if the games are locked/can not be play with stem this can mack game unplayer, as it all way find the on CPU GPU. i have 4 games like this stoping the CPU GPU fixs 3 of them so it is a good think to fix/ have the plck what one to use.

piron1991
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Oct 24, 2015 10:48 pm
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by piron1991 »

i kinda agree with Rseding91 too but kinda not, thing is laptops doesnt allow disabling intel gpus as their bios are stripped down, and as such i just cant do that, and even if i wouldnt probably do this unless i would want to fry it on yt vids. And optimus was always an issue as early on you as game dev would be forced to cooperate with nvidia to have a profile for game created and hope its gonna be released with next driver iteration, and well even if i could disable i still belive fixing that is worth more than my ability to turn GPU off as it could potentialy improve reception of game when you get on steam from people playing games on laptops too:)

posila i will say how it went as soon as i get my hands on 12.16 as i like playing with mods and having half of memory eaten by intel is not fun :P

cncr04s
Inserter
Inserter
Posts: 27
Joined: Wed Aug 19, 2015 3:58 pm
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by cncr04s »

I've been using .12.2
All the recent versions since that one, the game is very choppy. I'm not sure what they did to make it like that, it's unplayable =(

piron1991
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Oct 24, 2015 10:48 pm
Contact:

Re: [0.12.x] Game not detecting GPU properly when not using opengl

Post by piron1991 »

Reporting on 0.12.16: partial sucess

Game was detected by nvidia this time, but logs still says using Intel gpu, and from quick test it does seem to still use it:(
Attaching log as proof.

And a tought i had when i saw log, is it possible that allegro detects all displays but select first found, and if so is it doable to select best one instead somehow?Like iterate over displays, if nvidia/ati found prioritize it?
Attachments
factorio-current.log
(1.31 KiB) Downloaded 260 times

posila
Factorio Staff
Factorio Staff
Posts: 4933
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Post by posila »

Hmm, hmm ... thanks for the report.

Allegro sees only adapters there are listed in the log:

Code: Select all

   1.444 Available display adapters: 1
   1.444  [0]: \\.\DISPLAY1 - Intel(R) HD Graphics 3000 {0x05, [0,0], 1366x768, 32bit, 60Hz}
Even when running on OpenGL, the available display adapters list shows only the Intel card. I assume Optimus makes some magic when OpenGL is initialized, and makes it run on discrete GPU. Since there is just one adapter, Allegro will pass index 0 to DirectX, which DirectX interprets as "use primary adapter". That should be the most ideal case for Optimus to do its magic. Maybe the problem is that Allegro uses DirectX 9 and when Optimus sees it, it thinks the game is so old even Intel GPU can handle it ;)
Could you download this tool that enumerates all display adapters and see if it lists the nVidia?

By the way, what do you mean by "Game was detected by nVidia"?

Anyway, I won't do any changes to how Allegro selects adapters. I already tried to "improve" on it in 0.12.7 and it was complete disaster. Just use force-opengl :D

piron1991
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Oct 24, 2015 10:48 pm
Contact:

Re: [0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Post by piron1991 »

From what i see its same app that log i already posted in first post:) it shows clearly that:

Code: Select all

*[0]: \\.\DISPLAY1 - Intel(R) HD Graphics 3000 {0x0005 = AttachedToDesktop, PrimaryDevice}
[all availible resolutions]
 [1]: \\.\DISPLAY2 - Intel(R) HD Graphics 3000 {0x8000000 = ModesPruned}
 [2]: \\.\DISPLAY3 - NVIDIA GeForce GT 540M {0x0000 = 0}
so yea, DISPLAY1 is as expected Intel, but on DISPLAY3 theres Nvidia.

And by "nvidia detected it" i meant that theres list of last open apps when you add new profile for games, and before 0.12.16 factorio was not even on it, while now it showed nicely as last played

posila
Factorio Staff
Factorio Staff
Posts: 4933
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Post by posila »

Oh, I long forgot about the first post, sorry for that :D
piron1991 wrote:And by "nvidia detected it" i meant that theres list of last open apps when you add new profile for games, and before 0.12.16 factorio was not even on it, while now it showed nicely as last played
Ah, I see. And if you create profile, can you select there you want to use high performance GPU?

piron1991
Burner Inserter
Burner Inserter
Posts: 6
Joined: Sat Oct 24, 2015 10:48 pm
Contact:

Re: [0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Post by piron1991 »

Yep, i can, actually i made sure its not anything on my side that could be derpy and checked if profile is set properly

Harkonnen604
Filter Inserter
Filter Inserter
Posts: 285
Joined: Thu Jun 09, 2016 5:56 am
Contact:

Re: [0.12.x] [Michal] Game not detecting GPU properly when not using opengl

Post by Harkonnen604 »

OpenGL can be pain in the ass with fullscreen aspects. I know no single game that handles OpenGL correctly under Windows (all Quakes, Riddick, Doom). Many have alt-tab issues. Some have taskbar showing up through them. Some are loosing input while going fullscreen. Even recent Doom is not perfect in this matter. Honestly if not John Carmack fetish for OpenGL, we wouldn't see this API in games at all, it was designed for CAD. It has some modern use though to support Mac gaming, but I think in time Vulcan will finally blow OGL away from gaming scene.

As for multiple adapters and multiple monitors - OS usually picks adapter connected to your primary desktop monitor even if game window is moved to another monitor.

Post Reply

Return to “Won't fix.”

Who is online

Users browsing this forum: No registered users