Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor 2D editor performance on macOS 10.13.x and newer with Intel Graphics #17584

Closed
hmans opened this issue Mar 17, 2018 · 53 comments
Closed

Poor 2D editor performance on macOS 10.13.x and newer with Intel Graphics #17584

hmans opened this issue Mar 17, 2018 · 53 comments

Comments

@hmans
Copy link

hmans commented Mar 17, 2018

Godot version:
3.0.2 for macOS (without C#)

OS/device including version:
MacBook Air 2017, 1,8 GHz i5, 8 GB RAM, Intel HD Graphics 6000

Issue description:
The Godot editor is running quite slowly, best described as "stuck in 15 FPS" (very unscientific, I agree, but that is what it feels like.) This is while working on a very simple 2D game (which I have included for reference.)

The game itself runs smoothly, it's just the editor that is sluggish. It doesn't matter if I'm moving around in the 2D editor or editing code, everything is just relatively unresponsive.

The log output states OpenGL ES 3.0 Renderer: Intel(R) HD Graphics 6000, but the whole thing feels like it's falling back to some sort of fully software-based rendering mode.

(I should add that I'm fully aware that a HD 6000 is no GeForce GTX, but it's not entirely useless, and Godot is running the game on it just fine.)

Steps to reproduce:
Start Godot on a Mac similar to the one described above and edit the attached game (or probably any other game.)

Minimal reproduction project:
SpaceRage2-master.zip

@hmans hmans changed the title Godot 3.0.2 IDE slow-ish on macOS 10.13.3 with Intel HD 3000 Godot 3.0.2 IDE slow-ish on macOS 10.13.3 with Intel HD 6000 Mar 17, 2018
@akien-mga
Copy link
Member

On an HD 3000 as you had mentioned in the title initially I would not be surprised (it barely supports OpenGL 3.3, if at all on macOS), but on an HD 6000 it's indeed surprisingly bad.

@hmans
Copy link
Author

hmans commented Mar 17, 2018

Yeah, the "3000" was a typo.

@ghost
Copy link

ghost commented Mar 17, 2018

Can't confirm this issue on my MacBook Air with MacOS Sierra 10.12.6.
Here everything runs smoothly.

So this could eventually be a problem specific to MacOS High Sierra?

OS/device including version:
OS: MacOS Sierra 10.12.6
MacBook Air 11"
2015
1,6 GHz Intel Core i5
4 GB RAM
Intel HD Graphics 6000

@hmans
Copy link
Author

hmans commented Mar 17, 2018

Addendum to my initial bug report:

When I continually decrease the size of the editor window, there is a noticeable improvement in responsiveness/render speed, moving from the perceived 15 FPS when running in fullscreen all the way to perceived 60 FPS once the window is really, really small.

What kind of performance should I be expecting? I have been (naively; I know nothing about Godot's internals) assuming the IDE would make full use of the graphics chip's rendering capabilities (like it appears to do on Windows). Is this correct?

Either way, if there is any additional information I can provide, please let me know. Sadly I don't have access to other MacBook Airs or same or similar configuration that still run Non-High Sierra to test @Foxcataria's hypothesis.

@gabriel-aranha
Copy link

I have the same MacBook Air and comparing with my windows desktop I can't reproduce this low FPS.
macos

@hmans
Copy link
Author

hmans commented Mar 18, 2018

@aranha92, would you describe your IDE's performance as "perceived 60 FPS"? The best I can get -- only after reducing the window size to less than fullscreen, though -- is something that feels like 30. My biggest problem right now is that I have no idea what kind of performance I should be expecting.

@ghost
Copy link

ghost commented Mar 18, 2018

@hmans, if we imagine some kind of scale where we have 60 FPS for the smoothest reaction of the editor down to 0 FPS where no reaction is present than you normally should expect the full 60 FPS. This should normally be independent of the editor size. So whether it is fullscreen or not, you always should have best performance.

The solution to this issue is really hard to find...did you compile the engine yourself or do you just use the stable release you can download in form of a binary (that's the way I did)? And does this behaviour always occur across every project or is just this specific project?
And what could also be important: Is it only Godot that does not work properly?

@hmans
Copy link
Author

hmans commented Mar 18, 2018

Thanks @Foxcataria, it helps me to know that I actually am dealing with unexpected behavior, and not just being ignorant. :b

did you compile the engine yourself or do you just use the stable release you can download in form of a binary (that's the way I did)?

I'm using the stock binary available from the website.

And does this behaviour always occur across every project or is just this specific project?

I will try some more projects, but I don't remember the editor ever being any kind of smooth on my system.

Is it only Godot that does not work properly?

Overall, things appear to be working fine on this system -- do note that Godot actually plays the game just fine (with the expected 60 FPS, it's a really simple project.) So I doubt this is a general issue of my system.

If there is anything else I can do to help, or anything I could look into, please let me know.

@ghost
Copy link

ghost commented Mar 19, 2018

Hm...that's really strange...
I tried to 'reproduce' the editors behavior with your project one more time, but I was not successful...
So at the moment I don't have any idea of what could cause the problems, sorry :/

@hmans
Copy link
Author

hmans commented Mar 19, 2018

I will try to get my hands on a 2017 MacBook Air that has a fresh High Sierra install (or maybe wipe mine if I find the time to set up everything fresh...) and try again then. Other than that, I don't know what to try next, beyond waiting for that new Vulcan-based renderer that was mentioned on the blog. It's all a bit frustrating :/

@hmans
Copy link
Author

hmans commented Mar 19, 2018

PS. - if you want to close this issue for the time being, please go ahead and do so. I'm happy to reopen it (or create a new one) if I find any leads. I'm not closing it myself since I don't know what your regular process regarding issues like this is.

@hmans
Copy link
Author

hmans commented Mar 20, 2018

Quick question to subscribers to this issue (thanks for sticking around): is there a way to get a FPS debug counter for the Godot IDE (not the running game -- just the IDE)?

@akien-mga
Copy link
Member

Quick question to subscribers to this issue (thanks for sticking around): is there a way to get a FPS debug counter for the Godot IDE (not the running game -- just the IDE)?

Run Godot in verbose mode: godot --verbose.

@hmans
Copy link
Author

hmans commented Mar 20, 2018

Thanks @akien-mga! Unfortunately, the logging appears to stop once I open a project.

When opening the project directly via --verbose -e, I get continued logging, but the output doesn't include FPS information. I only get:

...
load resource: res://assets/ship.png (cached)
load resource: res://scripts/FunkyCam2D.gd (cached)
load resource: res://scenes/Background.tscn (cached)
load resource: res://scenes/RigidPlayer.tscn (cached)
load resource: res://scripts/FunkyCam2D.gd (cached)
EditorSettings Save OK!
Audio Driver CoreAudio average latency: 11ms (frame=512)
Audio Driver CoreAudio average latency: 11ms (frame=512)
Audio Driver CoreAudio average latency: 11ms (frame=512)
...

Getting some editor FPS info would be a great help for trying to further isolate this issue.

@ghost
Copy link

ghost commented Mar 20, 2018

I'm also interested in the way we can get for example FPS information about the editor, because all this information could help to solve problems on an individual specific system when almost nobody can reproduce the issues.

@hmans at the moment I get the same type of output as you showed here. So it seems to be the expected output, but I'm not sure.

@akien-mga
Copy link
Member

It used to be possible but it looks like we removed the feature/bug in #16005.

@akien-mga
Copy link
Member

I've readded an option for it in #17666.

@hmans
Copy link
Author

hmans commented Mar 21, 2018

Thanks! I'll give it a spin as soon as possible.

@hmans
Copy link
Author

hmans commented Mar 24, 2018

A quick update: I've compiled today's master (with #17666 merged in) to do some testing.

While the editor is idle, it's reporting around 105 FPS.

When I interact with my project's Test.tscn -- eg. by dragging around the viewport in the editor -- the FPS drops dramatically, depending on the editor size:

  • When the editor is running at the MBA's built-in screen's full resolution of 1440x900, it drops to around 30 FPS (while I pan/zoom the viewport around.)

  • When it's running at a slightly larger size (after connecting it to an external x1440 monitor; the editor being around 1600x1000 maybe), it drops to around 20 FPS.

While I'm still not sure what kind of performance I should be expecting, I'm definitely not seeing what @Foxcataria suggested in this comment.

I've tried the whole thing with some other projects as well, with the same results.

(I know this probably doesn't bring us close to an answer, but I still wanted to give an update. Thanks @akien-mga for adding --print-fps back in!)

@hmans
Copy link
Author

hmans commented Mar 24, 2018

I'd like to add one more thing: I don't even need to interact with my project's scene to reproduce this on my machine -- it's enough to open the About Godot box and scroll the credits. Same drops in FPS.

screen shot 2018-03-24 at 12 26 56

@hmans
Copy link
Author

hmans commented Jul 4, 2018

Allow me to bump this issue with a quick update:

I'm observing exactly the same issue with the new Blender 2.8 as opposed the currently stable Blender 2.7. I know this isn't terribly scientific, but considering Blender 2.8 touts OpenGL 3.3 support... maybe this could be a hint? (A quick tour of Google didn't reveal any indicators about any sort of incompatibility between OpenGL 3.3 and the Macbook Air model I have, though.)

I know this isn't terribly scientific... I'm posting it on the slim chance that this will maybe connect some dots somewhere and help narrow it down.

@jesselawson
Copy link

I develop on both Windows and Mac and one oddity I have noticed about Macs is that sometimes you will see multiple "Godot" processes lurking in the background, taking up just as much processing power as your editor.

In my case, every time I Play the game from the editor and it launches a window, there's a zombie Godot process lurking around 30-50% CPU usage that wont go away--not even when I close the editor--unless I do pkill -f Godot.

When your editor starts to slow down, open a Terminal window and type in top then hit enter. See what's eating up all your CPU.

@aaronfranke
Copy link
Member

aaronfranke commented Jan 24, 2019

Does this problem occur with 3.0.6 and/or 3.1-beta? Does using the GLES 2 renderer help?

@ignoxx
Copy link

ignoxx commented May 5, 2019

Not sure but may this issue relate to this one?

I'm having this issue in the mentioned link, my IDE feels low fps as well and only updates the screen by clicking and resizing the window. (I'm on Intel HD 620).

If this is not related to this issue, I can create a new issue for that, since i could not find it here.
PS: I'm aware that there is a way to solve this but maybe there is also a way by not downgrading the intel drivers :)

@Calinou
Copy link
Member

Calinou commented May 7, 2019

@IgnasKavaliauskas This should be resolved by updating your driver to the latest version provided by Intel, see #23069 (comment).

That said, that issue doesn't seem to be related to the one reported by OP here.

@hmans
Copy link
Author

hmans commented May 6, 2020

As stated on Twitter, GLES3 vs. 2 doesn't make a difference here.

(Is switching the editor project between these setups using the top-right dropdown enough, or would I need to do something else?)

@lawnjelly
Copy link
Member

lawnjelly commented May 6, 2020

(Is switching the editor project between these setups using the top-right dropdown enough, or would I need to do something else?)

Just switching the top-right dropdown should do it.

By the way, anyone who can build from source can test out the PR above that we are hoping will fix this (the PR is mostly complete).

@hmans
Copy link
Author

hmans commented May 6, 2020

By the way, anyone who can build from source can test out the PR above that we are hoping will fix this (the PR is mostly complete).

I'll give it a whirl.

@hmans
Copy link
Author

hmans commented May 6, 2020

I've tried the PR and given feedback in the PR itself.

For anyone else following this issue here, here's a little video I made to document the choppiness:

https://youtu.be/yhC0xs_MjoI

@lawnjelly
Copy link
Member

Well now it seems reducing GL_LINES didn't help we are somewhat back to square one. Still assuming it is rendering that is the problem, some ideas:

  • Maybe some unsupport feature is causing it to drop back to software rasterizer (I have long distant memories of this being a thing, like decades ago...). If this was the case, then CPU would be sky high.
  • Number of drawcalls as Calinou suggested. Now a contender. I'd be amazed that it would have such an effect on desktop but it is possible, maybe those gridlines are adding up.

I've also suspected something to do with the sleeping and power saving in the editor on Macs, but that doesn't tie in with switching off the ruler speeding it up. It would be nice to get it profiled too. That would show us if anything unexpected is appearing in CPU, and if it is drawcalls the driver typically shows up for a large percentage of time.

@hmans
Copy link
Author

hmans commented May 6, 2020

When doing the "grid drag test" from the video, the editor process seems to sit at around 7-8% CPU, and, according to Activity Monitor, at ~23% GPU, whatever this metric means in the context of macOS. Screenshot:

Screen Shot 2020-05-06 at 17 11 30

When I just let it idle, CPU goes down to 4%-ish, and GPU to 0%. So, yeah, drawcalls?

@hmans
Copy link
Author

hmans commented May 30, 2020

Me again, eep!

I just tried the web-based version of the editor (from this URL) on my Mac, and it's running beautifully (specifically, it doesn't exhibit the performance regression that this issue is about.)

Browser: Microsoft Edge 83.

Maybe this can help you pin things down further.

@lawnjelly
Copy link
Member

lawnjelly commented May 30, 2020

I read something else yesterday (sorry, lost the link) which made me think again that we could be doing something causing it to fall back to a software rasterizer (despite the GL_LINES tests).

Perhaps the WebGL implementation is avoiding this. The number of drawcalls is the same on the web version, so that suggests number of drawcalls is unlikely to be the problem, unless there's some huge difference in that respect (usually drawcalls are more expensive on web, not less!).

That's assuming it is the rendering.

In the Native IDE (Not the browser)

sorry my fault for the confusion 😀
You say in the OP, that the 'game itself runs smoothly' but not the editor. This suggests you may be able to work out what is causing a sudden dropoff in performance in the IDE by adding various features to a blank project.

  • Try creating an empty project and gradually adding 2d(?) features until you get the slowdown. Not necessarily the NUMBER of features, but the type of node, e.g. sprite, polygon, line.
  • It could also be related to something like the framebuffer choice (2d / 3d / 3d effects etc). If you try changing this in the IDE and you get a large difference in performance this could be a clue.

The rendering guys here would use a similar process of detective work to find if a particular feature was causing the slowdown (if we had the test device).

After all the editor is just a Godot project, so it is likely that something being added will dramatically slow the frame rate.

That news though is very encouraging it sounds like a simple change will be all that is needed to fix it. 👍

@hmans
Copy link
Author

hmans commented May 31, 2020

You may be able to figure it out yourself by creating an empty project and gradually adding 2d(?) features until you get the slowdown. Or maybe it's the framebuffer choice (2d / 3d / 3d effects etc). The rendering guys here would probably do similar (if we had the test device).

I'm going to put the web version of the editor under some pressure to see if I can reproduce the issue there.

@lawnjelly
Copy link
Member

lawnjelly commented May 31, 2020

You may be able to figure it out yourself by creating an empty project and gradually adding 2d(?) features until you get the slowdown. Or maybe it's the framebuffer choice (2d / 3d / 3d effects etc). The rendering guys here would probably do similar (if we had the test device).

I'm going to put the web version of the editor under some pressure to see if I can reproduce the issue there.

Me and @clayjohn discussed this yesterday, we weren't sure on what method Edge browser is using for WebGL on mac, whether it is translating WebGL to Metal or going to GLES2 etc. If it is going straight to Metal it might be avoiding driver issues in GLES2. Although WebGL is based on the GLES2 API, it often gets translated to another API (e.g. ANGLE on windows going to directx) rather than mapping 1:1 to GLES2 commands.

So you may not find much by playing with the browser version (although worth a try). Far more relevant is to try running different projects from the native IDE with different UI items, lines (of different thickness), polygons, frame buffer, effects etc, to try and work if one particular aspect is causing a dramatic slowdown (putting it into software rasterizer mode).

@hmans
Copy link
Author

hmans commented May 31, 2020

As a first test, I just kept adding 2D sprites to a scene to see how it would affect the editor's performance, and it did eventually drop down to 30 and later 15 frames per second (I didn't measure these scientifically -- is there a way to have the editor print FPS?)

Screen Shot 2020-05-31 at 11 31 55

Then I deleted the sprites again, and the whole thing went back to peak performance.

As a side note, this was still significantly better than the native Mac version, where even just opening an empty project would give me 8-15 FPS with the grid enabled.

Looking at the simplicity of the scene in the screenshot, I would naively assume that the editor would remain at 60 FPS, but I'm still not sure if I'm simply expecting the wrong thing. (I'm basing this expectation on the simple and very unscientific observation that I'm not seeing any of these performance issues in similar game making tools running on the same machine. I know, it's never that simple... :b)

@hmans
Copy link
Author

hmans commented May 31, 2020

I've now done the same test in Chrome 83 (Mac), and interestingly, the editor remained (mostly) smooth as butter, even with a much higher number of sprites added. Huh.

@hmans
Copy link
Author

hmans commented May 31, 2020

I couldn't test with Firefox since the editor wouldn't even start there, unfortunately (Firefox 76.0.1, Mac).

@hmans
Copy link
Author

hmans commented Jun 6, 2020

Just a quick update that this issue is still around in 3.2.2 Beta 4. (None of the changes made me expect any different, I just wanted to test it anyway.) MBP 13" 2018

@hmans
Copy link
Author

hmans commented Jun 7, 2020

Hey everyone, a quick update on this issue: I dug out an oooolllld Macbook Air from 2011 and started Godot on it, and lo and behold, it did not have the issue; the 2D editor -- with grid enabled -- was just as responsive as the 3D editor (even though overall performance wasn't great. I didn't use --print-fps, but would estimate things at around 45-ish. My own MBP drops down to 10 FPS in the 2D editor.)

Specs of that old machine:

image

Now, I don't know if this is because of the different graphics unit (Intel HD Graphics 3000), or because that Mac was still running High Sierra, but the latter sounds a lot more likely.

@lawnjelly
Copy link
Member

We may have this cracked. Anyone else who can test my build in #39758 would be welcome. 👍

@hmans
Copy link
Author

hmans commented Oct 12, 2020

@lawnjelly I am (extremely!) happy to report that this appears to have solved the issue, yes. 🎉

I created a new GLES3 project, and once the orphan_method setting was set to "Fresh Buffer" (and restarting), everything was buttery smooth. Is this also coming to the GLES2 renderer?

Good work & thank you!

@lawnjelly
Copy link
Member

@lawnjelly I am (extremely!) happy to report that this appears to have solved the issue, yes.

I created a new GLES3 project, and once the orphan_method setting was set to "Fresh Buffer" (and restarting), everything was buttery smooth. Is this also coming to the GLES2 renderer?

Good work & thank you!

Great! 👍

I'm just finishing up the PR now, I have it working for all the 2d stuff, I'm just checking whether the same modification might be beneficial anywhere else (3d, immediate geometry etc). It will be for GLES2 as well.

@akien-mga akien-mga modified the milestones: 4.0, 3.2 Oct 12, 2020
@akien-mga
Copy link
Member

Fixed by #42734.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants