This adds AsyncPipelineStateManager to the render code, which handles the background processing of draw shader creation (not, at the moment, other shader types...there's no reason those couldn't be added as well, but this seemed the biggest target).
If a given shader has not been compiled yet, we will fall back on an ubershader version with all features enabled
the ubershader version will be compiled synchronously if it does not exist yet
For the D3Ds, this is done with a background thread that compiles the shaders.
GL, however, does not seem to play nice with background threading shader creation. But what it does have is the KHR_parallel_shader_compile extension, which basically lets the driver create threads in the background and thread the shader compilation.
The shader manager, in this case, needs to poll the completion state every time the shader is requested and potentially push the compilation along to the next stage (i.e. once linkProgram has completed, then we can do the rest of our setup)
If KHR_parallel_shader_compile is not supported (for instance, with WebGL on Firefox) then shader compilation will just happen synchronously (I could not find a clear way to thread the GL shader creation, but I would happily add it as a fallback if there is a way)
This change also updates our GLAD loader to version 2.0.8 (from 0.1.36!), which had some API changes.
Co-authored-by: JoshJRive <joshua@rive.app>
Adds support for list items to be rendered on a path when a Follow Path constraint is applied to the Artboard list. Currently, the items will be evenly spaced on the path between 0 and Distance (which is set on the Follow path constraint). For example, with Distance set to 100%, items will be spaced between the start and end of the path. With Distance set to 50%, items will be spaced between the start and half the distance (length) of the path.
feat: Bump clang-format to v19 (#10429) 270034cbcd
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Co-authored-by: Philip Chung <philterdesign@gmail.com>
* updated build script to look for android sdk unreal expects
* proper platform settings for unreal android
* made check golds work with unreal android
Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
* Add profiling macros and optick profiler
* Update premake5_optick.lua
* Added more profiling markers
* Remove microprofiler option for now as not implemented
* Added more markers ro rendering code
* Update Optick build premake only for windows builds
* More build file changes for optick with windows
* Change how optick is built on windows
* Update premake5_v2.lua
* Update build files to use with_optick option
* Added ScopeName macro to appease ASAN
* Push to rekick jobs
* Delete ProfilerMacros.h
* Create profiler_macros.h
* Update path_fiddle.cpp
* Update fiddle_context.hpp
* Update for rename of header
* More header changes
* Update fiddle_context.hpp
* Update profiler_macros.h
* Update for clang format
* Update fiddle_context.hpp
* Update profiler_macros.h
* Update profiler_macros.h
* Changed premake values on Chris' comments
* Removed multiple define fro RIVE_OPTICK and now in rive_build_config.lua
* Added Optick URL and Version to rive_build_config
Co-authored-by: John White <aliasbinman@gmail.com>
* feature: add support for trigger properties from scripted viewmodels
* fix: memory usage test
* feature: adding trigger as an input
* chore: fix warnings
* feature: allow calling trigger fire() from scripts
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This avoids a fullscreen draw to initialize PLS (when the v2 extension
available), and also works around an issue of corruption on PowerVR
Rogue GE8300.
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
A customer requested feature, previously when using node or leaf type nested artboards, we would always render using the fixed artboard size (even if the artboard was set to hug). This modifies the behavior so that if the Artboard is set to hug, we respect that. This also applies to the newly implemented artboard lists when not in layout mode.
Co-authored-by: Philip Chung <philterdesign@gmail.com>
* feature: ability to unload/unregister a module
* feature: complete implementation into rive_native
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This PR adds support for Artboard List items that can be positioned directly using DataBinding by binding to the x & y property values of the Artboard itself. Currently, the behavior is that if the artboard list is a child of a layout, it will apply layout rules, but if its a child of a group or solo, it will allow control of its position through binding.
Co-authored-by: Philip Chung <philterdesign@gmail.com>
* fix: use word joiner instead of line separator for breaks
* fix: whitespace detection bug
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
Rive shaders tend to be long and prone to vendor bugs in the compiler.
Always send down the raw Rive GLSL sources when running on Wagyu/GLES,
which have various workarounds for known issues and are tested
regularly.
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
* Fix race condition in Metal background shader compiler
Setting an atomic variable outside of a std::condition_variable's corresponding mutex and then notifying the condition_variable has a subtle race condition, and the ordering of operations looks like this:
Thread A: acquire mutex
Thread A: check m_shouldQuit // it's false
Thread B: m_shouldQuit = true
Thread B: m_workAddedCondition.notify_all() // nothing is currently waiting on it so this does nothing
Thread A: m_workAddedCondition.wait() // now it's waiting, having just missed the above notification
Now thread A will wait forever because no more notifies to the condition_variable are coming and, in the case of this code, the call to m_compilerThread.join() will also wait forever (since the thread will never quit), so shutting down the renderer will never finish.
Instead, m_shouldQuit should only be set to true while in the mutex (because the check of its value and the subsequent .wait call also happen within the mutex, so this prevents them interleaving). This change fixes this.
* Minor formatting adjustment to make the github workflow tests re-run
Co-authored-by: JoshJRive <joshua@rive.app>
* Added conversion from gamma to linear space for situations where we can't control what our render target format is
* comment update
Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
We need to prevent percent margin from being set on Artboards because percent margin relies on the layout parent's dimensions. Since an Artboard has no parent, it results in an error within Yoga and a crash.
Co-authored-by: Philip Chung <philterdesign@gmail.com>
Adds support for Triggers in Custom Property Groups. This will allow triggers to be keyframed, which can also be bound to ViewModel triggers. Currently an event has to be fired on the timeline in order to fire a ViewModel trigger via a listener.
Co-authored-by: Philip Chung <philterdesign@gmail.com>
* Update unit test scripts to use build_rive.sh
The unit test test.bat and test.sh were doing their own ad-hoc building instead of using build_rive. This updates test.sh to call build_rive.sh for the build. This script could probably be pared down further but I did not want to break any of the existing command line arguments that people are probably using.
Additionally, test.bat did not have up-to-date build flags in it, so now it does a similar Windows development environment setup to build_rive.bat and then calls directly into test.sh, so it won't get out of sync with the main script anymore.
* Additional test.sh changes
- There was a block of code that I could have removed but didn't (made redundant by the call to build_rive)
- Add build_rive's parent directory to the path before calling it (will fix the test failing on Linux)
- Removed the `sh` before build_rive.sh as it does not need to be shell invoked.
* The pr_unit_tests.yaml execution for Mac needed to do a clean furing the asan build
because it had already done a build without asan before, the change to build_rive means that we now catch the premake parameter change (adding asan), and so clean needs to happen for that build to be correct.
* For now, move the build_rive.sh call into the two branches that previously had the build calls (linux, for instance, does not build, which seems incorrect given the github workflow is trying to run it.
* Adding a note to test.sh to describe why the build_rive script is called in the way it is (vs. the obvious way)
* Additional unit test script fixes (unifying windows build further, and some warnings)
- Add the ability to specify a toolset on the command line (i.e. "--toolset=msc") that will get passed along to build_rive (thus making the 'clang' toolset in the windows build only a default)
- Update the unit_test_windows and unit_test_windows_msvc entries in the github unit test workflows to call test.bat now (which required combining the build/run steps, but this matches all the other configurations)
- Also added some additional parameter validation, mainly warnings on ignored/unsupported parameters
Co-authored-by: JoshJRive <joshua@rive.app>
Currently, when items are inside a scroll view, when the scroll view is dragged and released, the item's click event will still trigger its listener if the same item is hovered. This adds a way to disable pointer events. In this implementation, when a scroll drag begins, we set the GestureClickPhase to disabled which prevents clicks from being captured.
Co-authored-by: Philip Chung <philterdesign@gmail.com>
Updating premake introduced a couple issues. Fix them and add a windows
webgpu builder to CI. Also move wagyu extension wrangling down into the
core webgpu renderer so individual clients don't have to think about it.
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
chore: Update audio_preview_generator to use build_rive.sh
Let's keep our premake setup & building all in one place.
Also update peon_audio_worker Dockerfile.
Co-authored-by: Arthur Vivian <arthur@rive.app>
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
It looks like the premake5 "v5.0.0-beta3" tag isn't compatible with
Sequoia 15.4.1. Bump our tag to v5.0.0-beta7 and update the deprecated
features we had been using.
Also fix the script to rebuild if the premake5 binary doesn't exist.
Before it only checked if the parent "premake-core" directory existed,
so if a build had failed previously, build_rive.sh would fail forever
without ever attempting to build premake5 again.
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
* feature: detection of implemented type arguments
* fixing highlight of type union
* feature: custom properties
* feature: working on scripted properties refactor
* feature: working on inputs and outputs
* chore: working on crash
* fix: fixes crash issue with luau
* feat: working on inputs
* chore: allow using old solver
* chore: missed json file
* chore: missing files & cleanup
* chore: missed sriv file
* chore: fixing unused var
* chore: fix read not supported with old solver, and core collision
* fix: use different script update flag
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>