Skip to content

Commit ba8e653

Browse files
committed
Update JsRuntimeHost to fix JSI issues
Fix broken move semantics in ExternalTexture Pass command line arguments to google test
1 parent 98a8416 commit ba8e653

8 files changed

Lines changed: 21 additions & 14 deletions

File tree

Apps/UnitTests/Source/App.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
Babylon::Graphics::Configuration g_deviceConfig{};
55

6-
int RunTests(const Babylon::Graphics::Configuration& config)
6+
int RunTests(const Babylon::Graphics::Configuration& config, int argc, char* argv[])
77
{
88
g_deviceConfig = config;
9-
testing::InitGoogleTest();
9+
testing::InitGoogleTest(&argc, argv);
1010
return RUN_ALL_TESTS();
1111
}

Apps/UnitTests/Source/App.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
#include <Babylon/Graphics/Device.h>
44

5-
int RunTests(const Babylon::Graphics::Configuration& config);
5+
int RunTests(const Babylon::Graphics::Configuration& config, int argc, char* argv[]);

Apps/UnitTests/Source/App_Apple.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <Babylon/DebugTrace.h>
33
#include <Metal/Metal.h>
44

5-
int main()
5+
int main(int argc, char* argv[]))
66
{
77
Babylon::DebugTrace::EnableDebugTrace(true);
88
Babylon::DebugTrace::SetTraceOutput([](const char* trace) { NSLog(@"%s", trace); });
@@ -15,5 +15,5 @@ int main()
1515
config.Height = 400;
1616
#endif
1717

18-
return RunTests(config);
18+
return RunTests(config, argc, argv);
1919
}

Apps/UnitTests/Source/App_Win32.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
77
return ::DefWindowProc(hWnd, msg, wParam, lParam);
88
}
99

10-
int main()
10+
int main(int argc, char* argv[])
1111
{
1212
SetConsoleOutputCP(CP_UTF8);
1313

@@ -29,5 +29,5 @@ int main()
2929
OutputDebugStringA("\n");
3030
});
3131

32-
return RunTests(config);
32+
return RunTests(config, argc, argv);
3333
}

Apps/UnitTests/Source/App_X11.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace
1616
constexpr const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
1717
}
1818

19-
int main()
19+
int main(int argc, char* argv[]))
2020
{
2121
XInitThreads();
2222
Display* display = XOpenDisplay(NULL);
@@ -53,5 +53,5 @@ int main()
5353
Babylon::DebugTrace::EnableDebugTrace(true);
5454
Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); });
5555

56-
return RunTests(config);
56+
return RunTests(config, argc, argv);
5757
}

Apps/package-lock.json

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ FetchContent_Declare(ios-cmake
3737
GIT_TAG 4.5.0)
3838
FetchContent_Declare(JsRuntimeHost
3939
GIT_REPOSITORY https://github.com/BabylonJS/JsRuntimeHost.git
40-
GIT_TAG b3dbf370caf560fb5b93936efd4cdf4e990d4d0a)
40+
GIT_TAG 756bf24a179240efcd5e63590133943203546205)
4141
FetchContent_Declare(SPIRV-Cross
4242
GIT_REPOSITORY https://github.com/BabylonJS/SPIRV-Cross.git
4343
GIT_TAG 6abfcf066d171e9ade7604d91381ebebe4209edc)

Plugins/ExternalTexture/Source/ExternalTexture_Shared.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace Babylon::Plugins
6969
DEBUG_TRACE("ExternalTexture [0x%p] AddToContextAsync", m_impl.get());
7070

7171
arcana::make_task(context.BeforeRenderScheduler(), arcana::cancellation_source::none(),
72-
[&context, &runtime, deferred = std::move(deferred), impl = m_impl]() {
72+
[&context, &runtime, deferred = std::move(deferred), impl = m_impl]() mutable {
7373
// REVIEW: The bgfx texture handle probably needs to be an RAII object to make sure it gets clean up during the asynchrony.
7474
// For example, if any of the schedulers/dispatches below don't fire, then the texture handle will leak.
7575
bgfx::TextureHandle handle = bgfx::createTexture2D(impl->Width(), impl->Height(), impl->HasMips(), 1, impl->Format(), impl->Flags());
@@ -84,7 +84,7 @@ namespace Babylon::Plugins
8484
return;
8585
}
8686

87-
arcana::make_task(context.AfterRenderScheduler(), arcana::cancellation_source::none(), [&runtime, &context, deferred = std::move(deferred), handle, impl = std::move(impl)]() {
87+
arcana::make_task(context.AfterRenderScheduler(), arcana::cancellation_source::none(), [&runtime, &context, deferred = std::move(deferred), handle, impl = std::move(impl)]() mutable {
8888
if (bgfx::overrideInternal(handle, impl->Ptr()) == 0)
8989
{
9090
runtime.Dispatch([deferred = std::move(deferred), handle](Napi::Env env) {
@@ -95,7 +95,7 @@ namespace Babylon::Plugins
9595
return;
9696
}
9797

98-
runtime.Dispatch([deferred = std::move(deferred), handle, &context, impl = std::move(impl)](Napi::Env env) {
98+
runtime.Dispatch([deferred = std::move(deferred), handle, &context, impl = std::move(impl)](Napi::Env env) mutable {
9999
auto* texture = new Graphics::Texture{context};
100100
DEBUG_TRACE("ExternalTexture [0x%p] attach %d x %d %d mips. Format : %d Flags : %d. (bgfx handle id %d)", impl.get(), int(impl->Width()), int(impl->Height()), int(impl->HasMips()), int(impl->Format()), int(impl->Flags()), int(handle.idx));
101101
texture->Attach(handle, true, impl->Width(), impl->Height(), impl->HasMips(), 1, impl->Format(), impl->Flags());

0 commit comments

Comments
 (0)