# \`engine.disableUniformBuffers\` is set to false in mobile mode, and cause a bad performance

**URL:** <https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228>\
**Category:** Bugs\
**Tags:** material, performance\
**Created:** [May 30, 2023, 3:37am UTC](https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228 "2023-05-30T03:37:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ling](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/ling/32/29324_2.png) [@ling](https://forum.babylonjs.com/u/ling)\
**Post date:** [May 30, 2023, 3:37am UTC](https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228/1 "2023-05-30T03:37:43Z")

</div>

In mobile mode, it take a long time to render the first frame.(about 7s)

 ![bad](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/2/42b882dbef375f602448e5f5007f1cb803461b6d.png)

With same model file: if I change `engine.disableUniformBuffers` value to `true` manually after I create my engine, it perform good.(about 1s)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/e/ae8ea855db38b66a194afb838fd9eb88db19d62c.png)  
 ![good](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/2/b236270c5b2ab60c2de42c620ab399ad9d683536.png)

Chrome: 113.0.5672.126  
Os: MacBook Pro, Apple M2

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [May 30, 2023, 8:13am UTC](https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228/2 "2023-05-30T08:13:20Z")

</div>

This is probably because of this bug:

[https://bugs.chromium.org/p/chromium/issues/detail?id=1267322&q=getUniformBlockIndex&can=2](https://bugs.chromium.org/p/chromium/issues/detail?id=1267322&q=getUniformBlockIndex&can=2)

However, we should detect Mac OS + Chrome and disable uniform buffers in that case. What can you see when you type `navigator.userAgent` in the console of the browser?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 30, 2023, 8:35pm UTC](https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228/3 "2023-05-30T20:35:35Z")

</div>

@ling can you try to force the Metal backend ? cause it should even be the default now ? I wonder why you still encounter this behavior ?

Also Chrome Macos is meant to disable UBO usage here [Babylon.js/thinEngine.ts at 4d15c1520687524381d760471f39233cab6daae7 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/4d15c1520687524381d760471f39233cab6daae7/packages/dev/core/src/Engines/thinEngine.ts) this is getting stranger.

Yup your navigator.userAgent will help us a great deal.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 30, 2023, 8:42pm UTC](https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228/4 "2023-05-30T20:42:27Z")

</div>

Let me close as a dupplicate of [Babylonjs takes longer to render the first frame on mobile compared to Threejs - #8 by sebavan](https://forum.babylonjs.com/t/babylonjs-takes-longer-to-render-the-first-frame-on-mobile-compared-to-threejs/41213/8)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 30, 2023, 8:42pm UTC](https://forum.babylonjs.com/t/engine-disableuniformbuffers-is-set-to-false-in-mobile-mode-and-cause-a-bad-performance/41228/5 "2023-05-30T20:42:37Z")

</div>

Closed on May 30, 2023, 8:42pm UTC


