Page MenuHome

macOS viewport lagging
Closed, ResolvedPublicBUG


System Information
Operating system: macOS Mojave
Graphics card:
NVIDIA GeForce GT 650M 1024 MB
Intel HD Graphics 4000 1536 MB

Blender Version
Broken: Blender 2.80 Beta, 2018-12-31
Hash : 4d795cee4938
Branch : blender2.7

Short description of error
Intense lags (not fluid) when moving, grabbing object, sculpting, on this computer with the 2.8 Blender Beta. Even with only a cube on the scene.
These lags doesn't exist on the 2.79 version and on older Macbooks I have.

Exact steps for others to reproduce the error
Sculpting, grabbing objet, moving in the scene. Lags (not fluid) pretty much everywhere.

Event Timeline

Sebastian Parborg (zeddb) lowered the priority of this task from 90 to 30.Jan 24 2019, 4:04 PM

Is this still an issue with the latest blender beta?

Still an issue (2019-01-23 23:36 / Hash:7f77961f1c38) on my MacBook on macOS Mojave / NVIDIA GeForce GT 650 M 1024MB and INTEL HD Graphics 4000 1536 MB.

Can you attach the output of --debug-gpu (as a file) and also try --debug-gpu-force-workarounds and see if that helps?

Can you attach the output of --debug-gpu (as a file) and also try --debug-gpu-force-workarounds and see if that helps?

Don't know how to achieve that. Can you explain me ? Thanks

I'm really sorry Sebastian but I'm not really good at this kind of tech things... Don't understand even with the documentation. --' Hope I could understand !

Do you have any experience using the terminal?

Nop never --'
But If you give me the right code to enter, I could maybe help you !
Sorry !

Ok, open up the terminal.

The three basic commands you need to know is:

cd Change Directory

ls List Directory (contents)

pwd Print name of current/Working Directory

Open up the terminal and type pwd

It probably tell you that you are in your home directory.

Use cd to navigate to the directory were you installed blender 2.8. (Use cd <folder-name-here> to move into <folder-name-here>, cd .. to move up a folder)
Use ls to list the files and folders in the current directory

After you navigated to the folder you got in the .zip file of the blender beta, simply type ./ in the terminal and blender should start.

Now you can pass arguments to blender ./ --debug-gpu.

You can use > to save the output to a file: ./ --debug-gpu > output.txt

Here's the file !
Hope it will help you to fix that bug !
Sorry for the wait, I tried to do the command a few times and didn't work. !

There doesn't seem to be anything odd in the output.

@Clément Foucault (fclem) any ideas? I think this might be hard to fix as I doubt any of the developers will be able to reproduce this.

We had some similar reports. Using debug print was making the lag vanish.

@Camille (Ekiwnox) Can you try launching blender using :

./ --debug-value 23

Hi Clément, I already changed the value to 23 directly on blender and it was really smooth. Can try again through de Terminal if it's different.
Tell me how I can help you ! :-)

Sebastian Parborg (zeddb) raised the priority of this task from 30 to Normal.

Is there an other issue I should merge this into?

Still an issue on the 2.90 2019-02-08 !
Does anyone need some help to find where the lags come from ? :-o

Brecht Van Lommel (brecht) renamed this task from Lagging to macOS viewport lagging.Mar 19 2019, 10:50 AM

Basically there is a "missing" glFlush (or glFinish) somewhere that seems to create a performance issue on those macs. But without access to the faulty hardware I cannot know where to put it. Or I can put it at random and hope for the best...

Brecht Van Lommel (brecht) triaged this task as High priority.Mar 25 2019, 12:14 PM

Have not confirmed the issue myself, but marking as high priority since this has been reported many times.

Since I seem to have some of the faulty hardware, I did some research on this issue.

It appears that the window compositor skips some of the application's rendered frames when there's a high demand on GPU resources. I observed that this behavior happens when the amount of workload is enough to saturate the GPU (i.e., below 60fps), meaning once it hits below 60fps, the performance deteriorates faster than it should. Unfortunately, the exact mechanism is unknown. It might be based on GPU queue pressure because we've seen that the --debug-value 23 option, which introduces full CPU/GPU synchronization via glFinish, seems to alleviate the issue.

macOS 10.14.4 switched NSOpenGLView to a Metal-based implementation, so Instruments now can be used to diagnose OpenGL presentation issues.

This is how it looks like on an ideal condition:

"GPU 1 (Unknown)" shows the OpenGL commands generated by Blender. The rendered image is blitted into a swapchain image ("GPU 1 (Blit)"). Finally, the image is displayed to the screen ("Display 2"). The color of rectangles indicates relationship between command buffer execution and presented frames. Thus in this example, all rendered frames are presented as expected.

The chart turns into something like this as the frame time rises:

The frame time is roughly 16ms (measured by the distance between blit operations), so it would look smooth *if* all frames were displayed. However, as shown in "Display 2", two thirds of the frames (the green and blue ones) were simply not presented.

There are numerous ways to present OpenGL contents, some of which are described in a Google Chrome design document:

  • NSOpenGLView — This is what Blender currently does.
  • NSOpenGLView with CALayer backing — No improvements were seen. Not sure how this is different from this option since NSOpenGLView is backed by CALayer by default anyway.
  • CAOpenGLLayer — Uses a pull-style API, thus inapplicable

I tried another option and found it effective:

  • CAMetalLayer — The issue was non-existent. This is similar to what NSOpenGLView does under the hood (as of macOS 10.14.4) except for using a public API. It's unknown why this option gives a better result. As shown in the following chart, display updates are now completely synchronized with the rendering of Blender's window:

Thanks a lot for the investigation! I guess ideally we could find a simpler fix, but if that's difficult this seems reasonable.

Could you submit this for code review?

There seems to be mixed space and tabs indentation.

From the patch, it seems this requires bumping the minimum supported macOS version from 10.9 to 10.11? That's probably fine and something we already wanted to do.

@Tomoaki Kawada (yvt) That's some impressive work you did here! Did you try a simpler approach first? like adding glFlush at some places to see if it fixes it. (this should not have performance implication).

Adding glFinish would definitely decrease performance but maybe that's a lesser evil.

In the end, if adding a base Metal layer is the only solution I don't have any objection.

@Brecht Van Lommel (brecht) Submitted here: D4619

@Clément Foucault (fclem) I didn't try glFlush because finding the right place to insert seemed impossible (it would be probably timing-dependent, assuming there's one). Another thing I tried was adding [CATransaction commit] after [m_openGLContext flushBuffer] (motivated by the internal implementation of CAMetalLayer), which only had a mediocre effect.

just adding confirmation that i see this lag as well, and it moves very smoothly with

--debug-value 23

Machine Specs:
macOS 10.14.3 (18D109)
MacBook Pro (Retina, 15-inch, Mid 2015)
2.8 GHz Intel Core i7
16 GB 1600 MHz DDR3
AMD Radeon R9 M370X 2048 MB
Intel Iris Pro 1536 MB

LuisG (LuisG) added a subscriber: LuisG (LuisG).EditedMar 31 2019, 11:58 AM

Hi, same problem here. Viewport rotation, panning and zooming is smooth in 2.79 but lags terribly in 2.8 (with same scene loaded in both). Disabling grid and axis display in Overlays alleviates this problem, but overall it never reaches the smoothness of 2.79

macOS 10.14.4
Macbook Pro (Retina 15-inch, late 2016)
2.6 GHz Intel Core i7
16 GB 2133 MHz LPDDR3
Radeon Pro 450 2 GB

For me it's the same as LuisG describes.

My specs:
macOS 10.13.6 (High Sierra)
iMac (Retina 5K, 27 inch, late 2015)
3,2 GHz Intel Core i5
32 GB 1867 MHz DDR3
AMD Radeon R9 M380 2048 MB

can some one send me the D4619 patched blender 2.8 file, i am having trouble with "make" part.

Furkan (furkan161) added a comment.EditedApr 13 2019, 11:02 PM

okey i tried D4619 path but it did not worked for me

Operating system: mac os
Graphics card: Radeon Pro 555 2 GB

Blender Version 2.8

lag and freeze problem while changing segments on add "uv sphere"

@Furkan (furkan161) I think it’s a pretty normal and OS-independent behavior that it lags a lot when creating a mesh with a large number of elements. D4619 addresses a specific issue in macOS’s presentation path and doesn’t magically make everything faster.

Is this patch going to be implemented in the main 2.8 version available for download on the Blender website?. I'm downloading each new build on a daily basis, but so far, the issue with the viewport lag doesn't seem to be fixed yet.

Yes, we will review it and commit a solution for this bug, should not be too long.

I am running the latest version of Blender on my MacBook Pro and I still have the same issue, the viewport jumps from smooth to laggy constantly.

MacBook Pro (Retina, 15-inch, Late 2013)
Operating system: macOS Mojave (10.14.4)
Processor: 2.3 GHz Intel Core i7
Memory: 16 GB 1600 MHz DDR3
Graphics card 1: Intel Iris Pro 1536 MB
Graphics card 2: NVIDIA GeForce GT 750M with 2GB of GDDR5 memory and automatic graphics switching

Same on macOS Mojave !
Macbook Pro Retina Mid 2012
2.3 GHz Intel Core i7
8 GB 1600 MHz DDR3

I still have this lag with the last version of Blender. Today I tried to rallback to the 2.79 and I was impressed how smooth is the old version... :-(

Brecht Van Lommel (brecht) changed the task status from Unknown Status to Resolved.Jun 2 2019, 1:08 PM

@Tomoaki Kawada (yvt)'s solution was committed now, which hopefully resolves all the issue here.

For me, the lag is still there with the newest version:

Date: 2019-07-10 15:05
Hash: bb7b741d2f1c

It occurs when an object (even the default cube) is selected and the Overlays/Object/Outline Selected checkbox is checked.
If the overlay is disabled or the cube is deselected, the lag disappears.

Here is my system info from my previous comment:
macOS 10.13.6 (High Sierra)
iMac (Retina 5K, 27 inch, late 2015)
3,2 GHz Intel Core i5
32 GB 1867 MHz DDR3
AMD Radeon R9 M380 2048 MB

I have the same issue. It does not exist in 2.79b, but it persists in both the 2.8 official release and the 2.8.1 build from 2019-08-21 (Hash 3d8f1586973b).
2011 Macbook Pro
OS: Mac OS High Sierra 10.13.6
CPU: 2.2 GHz Intel Core i7 2720 QM
GPU: Intel HD 3000, AMD HD 6750M

There appears to be an issue where OS X will not automatically switch from the integrated to discrete GPU when Blender launches.
There is a workaround for this problem: disable automatic graphics switching in OS X System Preferences.

When I switch to only using the discrete GPU, I have no performance issues whatsoever. However, if I let the system decide, it defaults to the low-power HD 3000 integrated GPU. When that happens blender's performance is abysmal, even on the default scene. (It also causes rendering errors in Eevee, which I believe are related to incompatibilities with the HD 3000 GPU, but those are a totally different issue).

Harley (qxoko) added a subscriber: Harley (qxoko).EditedOct 7 2019, 12:22 PM

I am also experiencing the same issue, even after the above patch.

Date: 07.10.19
Version: 2.80.75 Stable Release

(I apologise, I do not know where to find the 2.80 hash string)

MacBook Pro (15-inch, 2018)
macOS Mojave 10.14.6
6 Core 2.2 GHz Intel Core i7
16 GB 2400 MHz DDR4
Radeon Pro 555X 4 GB + Intel UHD Graphics 630 1536 MB

The solution I have discovered is that Blender 2.8 runs entirely lag/jitter-free on any monitor whose scaling factor is set to "Default for display", regardless of the actual resulting scale factor of the screen. For instance, my MacBook's built-in display's "Default" setting is somewhere around 150%, while my external monitor's "Default" is the standard 100%. On both monitors, at these values, Blender runs completely smoothly.

Setting one screen to a non-default scale factor will cause Blender to lag only on that monitor. Dragging the app over (without restarting) to the default-scale monitor and manipulating the viewport is then lag-free. Returning Blender to the non-default monitor reinstates the lag.

Whatever macOS considers "Default for display" for each monitor seems to correlate directly with Blender's viewport lag when displayed on it.

Edit: In the latest experimental build at writing - hash 54a9649e2636 - the issue is lessened but appears to persist. The same scaling behaviour I have described above also persists.

I can reproduce the same behavior as @Harley (qxoko)

Date: 12.19.19
Version: 2.81 2019-11-20

MacBook Pro (15-inch, 2018)
macOS Mojave 10.14.6
6 Core 2.9 GHz Intel Core i9
32 GB 2400 MHz DDR4
Radeon Pro 560X 4 GB + Intel UHD Graphics 630 1536 MB

I can reproduce the same issues with non-"Default" display scaling in System Preferences. What's odd is this never affected Blender 2.79 on the same hardware.

I also can reproduce the same behavior as @Harley (qxoko)

Date: 23.06.20

MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)
macOS Catalina 10.15.5
2,3 GHz Dual-Core Intel Core i5
8 GB 2133 MHz LPDDR3
Intel Iris Plus Graphics 640 1536 MB

The issue happen on 2.8x release on non 100% display scaling. It doesn't happen on Blender 2.79 with same hardware and display scaling configuration