@@ -115,7 +115,7 @@ namespace BabylonNative
115
115
});
116
116
}
117
117
m_isRenderingEnabled = true ;
118
- m_pendingReset = false ;
118
+ m_newEngine = false ;
119
119
}
120
120
121
121
void UpdateMSAA (uint8_t value)
@@ -138,12 +138,7 @@ namespace BabylonNative
138
138
139
139
void RenderView ()
140
140
{
141
- // m_pendingReset becomes true when a resetView call has been performed and no UpdateView has been performed.
142
- // This happens with a fast refresh when the view is not unmounted and it's still available for rendering.
143
- // UpdateView will set back m_pendingReset to false in case the view is unmounted/mounted with Engine.Dispose for example.
144
- // With fast refresh, we have to do that work on the UI/render thread, and UpdateView is not called in that case,
145
- // so RenderView is pretty much the only option. Specifically, it must be done on the UI/render thread and so RenderView is the only hook we have.
146
- if (m_pendingReset)
141
+ if (m_newEngine)
147
142
{
148
143
UpdateGraphicsConfiguration ();
149
144
}
@@ -158,13 +153,17 @@ namespace BabylonNative
158
153
}
159
154
}
160
155
156
+ void Initialize ()
157
+ {
158
+ m_newEngine = true ;
159
+ }
160
+
161
161
void ResetView ()
162
162
{
163
163
if (g_graphics)
164
164
{
165
165
g_nativeCanvas->FlushGraphicResources ();
166
166
g_graphics->DisableRendering ();
167
- m_pendingReset = true ;
168
167
}
169
168
170
169
m_isRenderingEnabled = false ;
@@ -266,11 +265,11 @@ namespace BabylonNative
266
265
std::optional<Babylon::Plugins::NativeXr> m_nativeXr{};
267
266
268
267
Babylon::Graphics::WindowConfiguration m_windowConfig{};
269
- bool m_pendingReset{};
270
268
271
269
std::shared_ptr<bool > m_isXRActive{};
272
270
uint8_t mMSAAValue {};
273
271
bool mAlphaPremultiplied {};
272
+ bool m_newEngine{};
274
273
};
275
274
276
275
namespace
@@ -287,6 +286,10 @@ namespace BabylonNative
287
286
jsiRuntime.global ().setProperty (jsiRuntime, JS_INSTANCE_NAME, jsi::Object::createFromHostObject (jsiRuntime, nativeModule));
288
287
g_nativeModule = nativeModule;
289
288
}
289
+ if (auto nativeModule{ g_nativeModule.lock () })
290
+ {
291
+ nativeModule->Initialize ();
292
+ }
290
293
}
291
294
292
295
void Deinitialize ()
0 commit comments