Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions renderer/premake5_pls_renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 19 additions & 5 deletions renderer/rive_vk_bootstrap/src/vulkan_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
14 changes: 11 additions & 3 deletions src/command_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> accesLock(
m_stateMachineAccessMutex);
Expand Down