# \[Latest Macbook Pro\]\[Metal\]renders blink severely

**URL:** <https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653>\
**Category:** Rendering\
**Tags:** Render, metal, MAC, unreal-engine, question\
**Created:** [March 22, 2017, 12:05pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653 "2017-03-22T12:05:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![LimboSix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LimboSix](https://forums.unrealengine.com/u/LimboSix)\
**Post date:** [March 22, 2017, 12:05pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/1 "2017-03-22T12:05:53Z")

</div>

Hello,

There is a bug when use UE 4.15 on Latest 13inch Macbook Pro with Retina Screen.

Even the basic starter content, the main editor area is blinking all the times if use Metal API on Macbook Pro.

However if I force XCode use opengl to build UE4.15, everything is fine except the warning of deprecation of OpenGL on Mac.

Blink like this (really drive me crazy):

Videos Page:

[http://ue.next.sh/](http://ue.next.sh/)

Videos:

[http://ue.next.sh/ue\_firstperson\_initiative.mp4](http://ue.next.sh/ue_firstperson_initiative.mp4)

[http://ue.next.sh/ue\_firstperson\_move.mp4](http://ue.next.sh/ue_firstperson_move.mp4)

[http://ue.next.sh/ue\_play.mp4](http://ue.next.sh/ue_play.mp4)

Thank you in advance

---

<div class="post-metadata">

**Author:** ![LimboSix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LimboSix](https://forums.unrealengine.com/u/LimboSix)\
**Post date:** [April 6, 2017, 2:19pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/2 "2017-04-06T14:19:53Z")

</div>

Found the malfunctioning part.

When I turn off the Show-\>Lighting Features-\>Indirect Lighting Cache, blink disappears.

When turn on this feature, blink starts.

Now I’m digging into code to locate the problem. If you are bothered by this problem and can not wait, just tun off Indirect Lighting Cache for now to finish all the job unrelated to Indirect Lighting Cache.

 ![133154-indirect_lighting_cache.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/d/93d84008ff5b2261ba28cd219ef476cf1604d8ad.jpeg)

Hit play, if renders still are blinking. Then you can you console command(press ~, then you can input command):

```
ShowFlag.IndirectLightingCache 0

```

then blink stops

* * *

Collateral damage:

After I rebuild lights, blinks starts again. However console command does not work here. And it won’t stop until I reboot UE4 Editor.

I don’t know why, maybe light build progress will build with indirect lighting cache. So the viewport will ignore the show feature settings after it apply the result of light build.

Hope I can find the real solution in time

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [April 6, 2017, 3:04pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/3 "2017-04-06T15:04:50Z")

</div>

Hi LimboSix,

Thank you for submitting a bug report. I have reproduced the issue and logged it as **UE-43725** which you can track on the following link: [Unreal Engine Issues](https://issues.unrealengine.com/). Please be aware that since the issue must be reviewed and prioritized by our development staff, it may be a while before it can be addressed.

-.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [April 6, 2017, 8:32pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/4 "2017-04-06T20:32:46Z")

</div>

There is a known issue with Intel GPU drivers. Try turning Automatic Graphics Switching off in the following location: System Preferences\>Energy Saver\>Automatic Graphics Switching: make sure box is _unchecked._

Let me know if this does not resolve the issue.

---

<div class="post-metadata">

**Author:** ![LimboSix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LimboSix](https://forums.unrealengine.com/u/LimboSix)\
**Post date:** [April 7, 2017, 12:26am UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/5 "2017-04-07T00:26:35Z")

</div>

Thanks. However, my 13inch won’t have that option because it only has one GPU, so it can’t do any switching. The 13 inch only comes with the integrated GPU and no discrete GPU, so it doesn’t have automatic graphics switching option.  
Intel Iris Graphics 550:

```
  Chipset Model:	Intel Iris Graphics 550
  Type:	GPU
  Bus:	Built-In
  VRAM (Dynamic, Max):	1536 MB
  Vendor:	Intel (0x8086)
  Device ID:	0x1927
  Revision ID:	0x000a
  Metal:	Supported
  Displays:
      Color LCD:
        Display Type:	Built-In Retina LCD
        Resolution:	2560 x 1600 Retina
        Pixel Depth:	32-Bit Color (ARGB8888)
        Main Display:	Yes
        Mirror:	Off
        Online:	Yes
        Rotation:	Supported
        Automatically Adjust Brightness:	Yes
        Connection Type:	DisplayPort
```

---

<div class="post-metadata">

**Author:** ![LimboSix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LimboSix](https://forums.unrealengine.com/u/LimboSix)\
**Post date:** [April 7, 2017, 4:30pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/6 "2017-04-07T16:30:19Z")

</div>

I have located one possible line which could lead to this problem.  
In file: `./Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp`  
Line 1319: `!ViewFamily.EngineShowFlags.IndirectLightingCache ||` in method `bool IsRichView(const FSceneViewFamily& ViewFamily);`

When I change this line into `ViewFamily.EngineShowFlags.IndirectLightingCache || ` which force IsRichView to true if IndirectLightingCache is set or move `ViewFamily.EngineShowFlags.IndirectLightingCache || ` into next IF block, rebuild UE4.15 with Xcode. And blink stops.

Why a view is rich if is missing the EngineShowFlags.IndirectLightingCache? Shouldn’t be reversed? Isn’t IndirectLightingCache a rich view feature?

And still, it won’t solve the collateral damage mentioned in the last answer this page. After I rebuild lights, blinks starts again.

Another Question: what happens after I click build light only?

.  
.  
.

PS:

Also there should be several new Clang Diagnostic ignored entries in file `./Engine/Source/Runtime/Core/Public/Mac/MacPlatformCompilerPreSetup.h` after upgrade Xcode to Version 8.3 (8E162). Or it will lead to build failure.

I believe it should be :

`#pragma clang diagnostic ignored "-Wnullability-inferred-on-nested-type"`

`#pragma clang diagnostic ignored "-Wobjc-protocol-property-synthesis"`

`#ifndef PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS`

`#define PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS \ `

` _Pragma("clang diagnostic push") \`

` _Pragma("clang diagnostic ignored \"-Wundef\"") \`

` _Pragma("clang diagnostic ignored \"-Wnull-dereference\"")`

`#endif // PRAGMA_DISABLE_UNDEFINED_IDENTIFIER_WARNINGS`

---

<div class="post-metadata">

**Author:** ![LimboSix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LimboSix](https://forums.unrealengine.com/u/LimboSix)\
**Post date:** [April 8, 2017, 5:28pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/7 "2017-04-08T17:28:15Z")

</div>

**Conclusion:**

If `!ViewFamily.EngineShowFlags.IndirectLightingCache ||`, in file: `./Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp` Line 1319,

is correct, a view is rich if is missing the `EngineShowFlags.IndirectLightingCache`.

 ![133425-wechatimg29.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/c/d/0cd48565d758e47997b20758059e39c190f1cc98.jpeg)

Then something needs to fix in `FPositionOnlyDepthDrawingPolicy` in file `./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp`;

In file`./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp` Line 512,

one of paramter `VertexDeclaration` should take the blame for this bug. Because if I replace this `VertexDeclaration` with `FMeshDrawingPolicy::GetVertexDeclaration()` which directly use method in the base class of `FPositionOnlyDepthDrawingPolicy`, blink stops.

**This time, the collateral damage is also fixed!!! Even after I apply build light only, there is no blink or black screen**

 ![133426-wechatimg30.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/4/7/0474e92ed337fa0dd16c47ada6f684949f075f11.jpeg)

* * *

**Deduction:**

If `!ViewFamily.EngineShowFlags.IndirectLightingCache ||`, in file: ./Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp Line 1319,

is correct.

If set `Result.bStaticRelevance = true;` in File `./Engine/Source/Runtime/Engine/Private/StaticMeshRender.cpp` Line 1225, blink starts no matter what value `Result.bDynamicRelevance` is.

Located in File `/Engine/Source/Runtime/Renderer/Private/SceneVisibility.cpp` Line 1755 function `ComputeAndMarkRelevanceForViewParallel` triggers this bug.

Because if `bStaticRelevance = true` in `StaticMeshRender.cpp`, this will lead to `RelevantStaticPrimitives.AddPrim(BitIndex);` in `SceneVisibility.cpp#Line1495` when `ComputeRelevance` is called.

And then after function `MarkRelevant` is called which makes `MarkMasks[StaticMesh.Id] = MarkMask;`.

But in the end, it is static method `static void ComputeAndMarkRelevanceForViewParallel` fired this two functions, `ComputeRelevance` and `MarkRelevant`.

So in the `ComputeAndMarkRelevanceForViewParallel`, if this bit, `StaticMeshOccluderMap_Word |= (MaskMask & EMarkMaskBits::StaticMeshOccluderMapMask) ? Mask : 0;`, sets, will lead to the bug.

=\> Blink stops if remove Line 931, `bDirty |= Scene->PositionOnlyDepthDrawList.DrawVisible(RHICmdList, View, DrawRenderState, View.StaticMeshOccluderMap, View.StaticMeshBatchVisibility);`, in file `./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp`;

=\> Which leaves us a policy, `FPositionOnlyDepthDrawingPolicy` in the same file `DepthRendering.cpp`.

=\> Finally, `return FBoundShaderStateInput(VertexDeclaration, VertexShader->GetVertexShader(), FHullShaderRHIRef(), FDomainShaderRHIRef(), FPixelShaderRHIRef(), FGeometryShaderRHIRef());`

In file`./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp`

Line 512, one of paramter `VertexDeclaration` should take the blame for this bug. Because if I replace this `VertexDeclaration` with `FMeshDrawingPolicy::GetVertexDeclaration()` which directly use method in the base class of `FPositionOnlyDepthDrawingPolicy`, blink stops.

I know the actual problem may be in `VertexFactory->GetPositionDeclaration()`, however I am gonna stop here waiting for official fixes.

Hope this track can be helpful.

* * *

**For those who can not wait for the official fixes:**

_Please ignore all my other comments and answers above this line in this page_ **In file`./Engine/Source/Runtime/Renderer/Private/DepthRendering.cpp` Line 512, replace `VertexDeclaration` with `FMeshDrawingPolicy::GetVertexDeclaration()`, blink stops!**

_Warning: This replacement isn’t a best solution or even a solution and also may affect other functionality, even though it fixes this bug superficially. Please wait official bug fix if you encounter side effects_

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [April 12, 2017, 1:48pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/8 "2017-04-12T13:48:28Z")

</div>

Thank you for the additional information. I have added this to the bug report.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_902b85b91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_902b85b91](https://forums.unrealengine.com/u/anonymous_user_902b85b91)\
**Post date:** [April 19, 2017, 10:59am UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/9 "2017-04-19T10:59:16Z")

</div>

I have the same problem here with )  
The OS is macOS 10.12.3.

**But the issue remains even I turn off the “Indirect Lighting Cache”.** Is it another issue?

I have this issue only in 4.15.1, when switch back to 4.14.3, things become OK.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcdd396d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcdd396d](https://forums.unrealengine.com/u/anonymous_user_bcdd396d)\
**Post date:** [April 19, 2017, 7:01pm UTC](https://forums.unrealengine.com/t/latest-macbook-pro-metal-renders-blink-severely/388653/10 "2017-04-19T19:01:32Z")

</div>

Thank you for this additional information. I have added it to the bug report (below) UE-43725.
