diff --git a/renderer/premake5_pls_renderer.lua b/renderer/premake5_pls_renderer.lua index 44345a329..46a5ec6f4 100644 --- a/renderer/premake5_pls_renderer.lua +++ b/renderer/premake5_pls_renderer.lua @@ -8,6 +8,14 @@ newoption({ description = 'compile with support for vulkan', }) +-- For Vulkan-only builds on Apple hosts that lack the Metal toolchain (e.g. +-- MoltenVK-backed desktop JVM builds): skips Metal shader libraries, Metal +-- backend sources, and Metal ORE defines. +newoption({ + trigger = 'no_metal', + description = 'exclude the Metal backend and its shader libraries', +}) + -- Internal capability flag opted into by platform packages. newoption({ trigger = '_console_only_ore_vk', @@ -49,7 +57,7 @@ end -- Only active when --with_rive_canvas is enabled. -- RIVE_ORE is defined whenever any ore backend is active, so C++ code can guard -- ore API calls without enumerating every backend. -filter({ 'system:macosx or ios', 'options:with_rive_canvas', 'options:not for_unreal' }) +filter({ 'system:macosx or ios', 'options:with_rive_canvas', 'options:not for_unreal', 'options:not no_metal' }) do defines({ 'ORE_BACKEND_METAL', 'RIVE_ORE' }) end @@ -246,7 +254,7 @@ end makecommand = makecommand .. ' FLAGS="' .. minify_flags .. '"' -if os.host() == 'macosx' then +if os.host() == 'macosx' and not _OPTIONS['no_metal'] then if rive_target_os == 'ios' and _OPTIONS['variant'] == 'system' then makecommand = makecommand .. ' rive_pls_ios_metallib' elseif rive_target_os == 'ios' and _OPTIONS['variant'] == 'emulator' then @@ -412,7 +420,7 @@ do buildoptions({ '-fobjc-arc' }) end - filter({ 'system:macosx or ios', 'options:not nop-obj-c', 'options:not for_unreal' }) + filter({ 'system:macosx or ios', 'options:not nop-obj-c', 'options:not for_unreal', 'options:not no_metal' }) do files({ 'src/metal/*.mm' }) end @@ -424,7 +432,7 @@ do files({ 'src/ore/*.cpp' }) end - filter({ 'system:macosx or ios', 'options:not nop-obj-c', 'options:with_rive_canvas', 'options:not for_unreal' }) + filter({ 'system:macosx or ios', 'options:not nop-obj-c', 'options:with_rive_canvas', 'options:not for_unreal', 'options:not no_metal' }) do files({ 'src/ore/metal/*.mm' }) end diff --git a/renderer/rive_vk_bootstrap/src/vulkan_library.cpp b/renderer/rive_vk_bootstrap/src/vulkan_library.cpp index 3927cf206..ec42e6454 100644 --- a/renderer/rive_vk_bootstrap/src/vulkan_library.cpp +++ b/renderer/rive_vk_bootstrap/src/vulkan_library.cpp @@ -48,17 +48,31 @@ VulkanLibrary::VulkanLibrary(bool* successOut) #endif }; - for (auto* filenameCandidate : libFilenameCandidates) + // Allow embedders (e.g. JVM hosts that extract a bundled MoltenVK to a + // temp directory) to point directly at a Vulkan library. + if (const char* explicitPath = getenv("RIVE_VULKAN_LIBRARY_PATH")) { #ifdef _WIN32 - m_library = LoadLibraryA(filenameCandidate); + m_library = LoadLibraryA(explicitPath); #else - m_library = dlopen(filenameCandidate, RTLD_NOW | RTLD_LOCAL); + m_library = dlopen(explicitPath, RTLD_NOW | RTLD_LOCAL); #endif + } - if (m_library != nullptr) + if (m_library == nullptr) + { + for (auto* filenameCandidate : libFilenameCandidates) { - break; +#ifdef _WIN32 + m_library = LoadLibraryA(filenameCandidate); +#else + m_library = dlopen(filenameCandidate, RTLD_NOW | RTLD_LOCAL); +#endif + + if (m_library != nullptr) + { + break; + } } } diff --git a/src/command_server.cpp b/src/command_server.cpp index 414465842..df0789040 100644 --- a/src/command_server.cpp +++ b/src/command_server.cpp @@ -1758,9 +1758,17 @@ bool CommandServer::processCommands() if (rive::ArtboardInstance* artboard = getArtboardInstance(artboardHandle)) { - if (auto stateMachine = - name.empty() ? artboard->defaultStateMachine() - : artboard->stateMachineNamed(name)) + auto stateMachine = + name.empty() ? artboard->defaultStateMachine() + : artboard->stateMachineNamed(name); + if (stateMachine == nullptr && name.empty()) + { + // Match ArtboardInstance::defaultScene(): fall back + // to the first state machine when the artboard has + // no default set (older editor exports). + stateMachine = artboard->stateMachineAt(0); + } + if (stateMachine) { std::unique_lock accesLock( m_stateMachineAccessMutex);