# ShareMaterialShaderCode causes hitches while streaming levels

**URL:** <https://forums.unrealengine.com/t/sharematerialshadercode-causes-hitches-while-streaming-levels/405029>\
**Category:** Rendering\
**Tags:** loading, asynchronous-asset-l, unreal-engine, streaming, Shaders, question\
**Created:** [September 20, 2017, 7:16am UTC](https://forums.unrealengine.com/t/sharematerialshadercode-causes-hitches-while-streaming-levels/405029 "2017-09-20T07:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user37337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user37337](https://forums.unrealengine.com/u/user37337)\
**Post date:** [September 20, 2017, 7:16am UTC](https://forums.unrealengine.com/t/sharematerialshadercode-causes-hitches-while-streaming-levels/405029/1 "2017-09-20T07:16:49Z")

</div>

After upgrading to 4.16 I’ve enabled the ShareMaterialShaderCode option. This saves over 1GB of Storage and reduces the steam update size about 500MB so I really would like to enable the option. But while streaming levels this option causes hard hitches. It seems that the async loading of levels causes a syncronous loading of the shader so the rendering thread waits for file access (STAT\_Shaders\_RTShaderLoadTime).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_afd92cec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_afd92cec](https://forums.unrealengine.com/u/anonymous_user_afd92cec)\
**Post date:** [September 20, 2017, 9:21am UTC](https://forums.unrealengine.com/t/sharematerialshadercode-causes-hitches-while-streaming-levels/405029/2 "2017-09-20T09:21:28Z")

</div>

Hi,

Yes, in 4.16 and 4.17 shader library uses blocking load when shader is requested by RHI. In 4.18 we reworked that and now it en-queues async load request for shader code when corresponding material is getting loaded, so it does not hitch. If you can’t upgrade to 4.18, I would recommend to load all shader library data into memory at game start if you don’t have memory budget problems 🙂

---

<div class="post-metadata">

**Author:** ![user37337](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user37337](https://forums.unrealengine.com/u/user37337)\
**Post date:** [September 20, 2017, 10:23am UTC](https://forums.unrealengine.com/t/sharematerialshadercode-causes-hitches-while-streaming-levels/405029/3 "2017-09-20T10:23:34Z")

</div>

Thank you very much for this information.

P.S. I cannot accept or answer your post. Please have a look to [\>this question\<](https://answers.unrealengine.com/questions/214932/answerhub-cant-accept-an-answer-or-comment.html)
