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>
* added filter type to draw batch
* c++ implementation of ImageSamplerOptions
* image sampler options now pushes correct for RiveRenderPaint
* wip
* OpenGL uses correct sample options
* now only one filter option that accounts for mip map
* d3d now uses sampler states options
* better way to get the filter option
* added mirror and inverse mirror options
* started using helper functions for retreiving sampler optiojnhs
* workaround for vulkn semaphore issue
* wip
* added filter type to draw batch
* c++ implementation of ImageSamplerOptions
* image sampler options now pushes correct for RiveRenderPaint
* wip
* OpenGL uses correct sample options
* now only one filter option that accounts for mip map
* d3d now uses sampler states options
* better way to get the filter option
* added mirror and inverse mirror options
* started using helper functions for retreiving sampler optiojnhs
* workaround for vulkn semaphore issue
* wip
* undo deleting empty descriptor
* properly packed image options
* removed uneeded checks
* more unit tests
* unreal image_filter_options integration, gm for image filters
* properly implement new draw functions for cgrender
* finish mege conflicts
* merge vulkan sampler options
* cherry-picked vulkan imp into branch
* initial metal
* clang-format
* d3d12 image filter options
* fixed d3d
* clang-format
* fixed mip filter for metal
* made every filter option act as similiar as possible
* addressed pr changes
* fixed tests
* empty commit to fix github
* fix: webgl renderers
* started addressing PR comments
* metal change for pr
* more pr stuff
* final PR address
* shader update per PR request
* rhi updat e
* added gm requested in pr
* made d3d12 work with more then 2000 sampler changes per flush
* pr comments
Co-authored-by: Chris Dalton <chris@rive.app>
Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
Addresses this issue: https://2dimensions.slack.com/archives/C07VD44ASE5/p1739456802968219
Rive's RenderPath steals the memory for the RawPath the runtime builds, which is usually fine apart from cases where we expect to use the RawPath after drawing with it. For example, with inner feather we want to be able to compute the bounds of the RawPath after it has been drawn. If during animation a user turns on inner feathering on a path which has not changed recently, which need to be able to compute its bounds, we can't if the RawPath is now gone.
This also can happen with trim paths and dash paths which are re-trimmed/dashed after having being rendered a few frames. Right now we force rebuild the whole path to re-trim it because we lose the RawPath.
This PR allows the ShapePaintPath to hold on to its RawPath by adding RenderPath::addRawPath. This is optimized memory usage but not having the runtime need to re-alloc the RawPath whenever it animates, but it means we're further from making RenderPaths immutable.
For the future: It'd be good to chat about a long term solution that can accommodate all goals of allocating less memory (prior to this change we were re-allocating RawPath memory every frame when animating), not rebuilding paths as often, and still allow for immutability.
Diffs=
9058a3fdad Add RenderPath::addRawPath (#9038)
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This pull request builds on top of fallback font support on iOS by including the ability to provide fallback fonts based on the styling of the missing character. Currently, the style information only contains weight. This weight is grabbed by calling `getAxisValue`. According to Luigi, this is a linear search, so perhaps there's room for a performance optimization later on.
There is one lower-level C++ change: `gFallbackProc` returns the font for the missing character, in addition _to_ the missing character (as a second parameter). This font will be used to generate the requested styling within the iOS runtime.
This adds a new class property to `RiveFont`: `fallbackFontCallback` (whose name I'm open to changing). This is a block (i.e closure) that will be called when a fallback font is requested. It supplies the styling of the missing character so that, for example, different fonts can be used based on the weight of the missing character. For example usage, see `SwiftFallbackFonts.swift`. This provider is what's used under-the-hood, and utilizes the pre-existing `fallbackFonts` class property
The "trickiest" bit here is the caching. NSDictionary requires equatable / hashable types as keys, and we want to minimize additional generation of a Rive font, so we cache any used fonts in a wrapper type, used as the value. When new fallback fonts are provided, either directly or when a new provider block is set, the cache will be reset. Once the weight is determined, generating the right key is as simple as calling the right initializer, and when set, generating the right value is simple as calling the right initializer with the created Rive font.
Finally, `RiveFactory` was getting a little bloated, so I did a little file cleanup.
This pull requests also includes Android support from #8621
Diffs=
7986d64d83 Support supplying mobile fallback fonts by style with caching (#8396)
Co-authored-by: David Skuza <david@rive.app>
Co-authored-by: Umberto <usonnino@gmail.com>
Co-authored-by: Umberto Sonnino <umberto@rive.app>
Made lite rtti now use compile time hashes that use the name of the class with rtti enabled as the hash string.
Every use of rtti now needs to be a macro. but other then that, usage of lite rtti is unchanged.
Diffs=
2be44a0f45 Deterministic lite rtti (#8349)
Co-authored-by: Jonathon Copeland <jcopela4@gmail.com>
This gives better support for smaller screens and side-by-side windows.
Also standardize the formatting check on GitHub on version 17.
Diffs=
e52e9fff29 Drop the ColumnLimit to 80 for clang-format (#8320)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Also delete TestingWindow::Renderer (it's always tied to the TestingWindow subclass now), and delete the Skia renderers. This drastically speeds up link times.
Diffs=
9b755ed5b Unlink skia from goldens (#7991)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Support for SIMD instructions for unpremult
First checkin, using rive::int16x4 instructions : 1 pixel at a time
Further checkin, using rive::int16x4 instructions : 2 pixels at a time
Last checkin, avoid computation when opaque pixels (assume there will be enough opaque pixels to warrant this)
Thanks to Chris for the SIMD instructions usage in rive
More checkins: move the decode and unpremult to the rive decoder - this requires modifications to build files. The benefits are we are now running tests on this path. However, there are some issues with decoding two images for tests:
"../../test/assets/bad.jpg" ... Apple Preview app cannot open this image, however, the current test says that it should be not null
And
"../../test/assets/bad.png", Apple Preview app can load this images, however, the current test says that it should be null
Diffs=
e992059d6 iOS images unpremult SIMD support (#7875)
Co-authored-by: rivessamr <suki@rive.app>
Add an "xcode" option that generates and builds an xcode workspace.
Add -Wshorten-64-to-32 to non-Xcode builds and fix more warnings.
Diffs=
f0da6a7a0 Add Xcode support to build_rive.sh (#7780)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
@HayesGordon this basically boils down to making sure we use our new TextureHelper.Descriptor when generating a RenderTexture to ensure we're using the right internal GraphicsFormat. The RenderTexture takes a high-level format that Unity then tries to map to a compatible native one. We bypass that by explicitly setting which Texture Format we want, which we can tweak based on backend if necessary.
Diffs=
353cf349b Fix GL rendering with URP. (#6535)
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
Adds an audio engine abstraction (implemented with miniaudio) in Rive. We can selectively replace it with other abstractions later if we find miniaudio isn't well suited everywhere but I'm confident it will be based on flexibility with getting it working in the recorder.
Adds audio support in:
- packages/rive_common
- WASM: rive_audio_wasm.dart
- FFI: rive_audio_ffi.dart
- packages/runtime
- packages/recorder
Subsequent PR will add support in:
- packages/rive_unity
- This is getting meaty enough...
- packages/rive_flutter
- This requires publishing rive_common so I want to make sure this is reviewed and accepted before publishing
- I'd also prefer to merge layout constraints into rive_common before this lands.
Editor features:
- Updated preview window:
<img width="248" alt="CleanShot 2024-01-15 at 14 44 31@2x" src="https://github.com/rive-app/rive/assets/454182/a9588be6-8370-4e22-ab32-af1e9ed71183">
- Preview waveforms in the timeline:
<img width="651" alt="CleanShot 2024-01-15 at 14 44 53@2x" src="https://github.com/rive-app/rive/assets/454182/2710667f-838f-483d-9647-e2bcb9e0237a">
- Subsequent PR will also use threads in web editor build (currently uses a time/frame based decoder to offload ui). I can't do that until I can verify the Shared Memory access is granted once rive_common lands in pub.dev and then we can push to UAT.
Diffs=
73bf11db3 Audio engine (#6454)
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
We decided to use skia from Skia's original repository for the recorder in order to take advantage of some fixes that have been done.
We are using version m113, because newer versions change the API significantly, and it wasn't worth the effort.
Eventually, we'll want to use our renderer for this.
Diffs=
ee0a1ee5d use skia directly from skia repository for recorder (#6359)
Co-authored-by: hernan <hernan@rive.app>
We need to be more robust if a user tries to use mismatched factories and renderers. This PR creates a simple "lite_rtti" utility and applies it to every Render object. The renderers now abort early instead of crashing if they are given a Render object for the wrong renderer.
Diffs=
c357e7aa7 Add a "lite_rtti" utility and use it with Render objects (#6311)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
few bits to sort out
- [x] make our mix of simulator/emulator consistent, settling on emulator
- [x] passing the factory in works great for just in time asset decoding, but its not amazing when you want to decode ahead of time.
- [x] couple of places left to pass this function signature through. (Question) is there a neater way to get this done, feels a bit like we are going back to parameter explosion a bit?
- [x] should do a few examples, i think the complexity grows quite a bit in this one as you add caching, or callbacks
- [x] should get the cached images/fonts to draw on init as well, either warming up cache, or jitting
- [x] examples loading assets from the bundle (also there seem to be actual asset things too? should we use those?!)
- [x] add test
- [x] re-add "preview" project & rev the preview project once this has been deployed. (do this after new ios deploy)
- [x] fix up race condition (see comment)
https://github.com/rive-app/rive/assets/1216025/2c14330f-e8a4-481b-bc27-4807cabe3b82
(simple example, both swift ui and standard)

Diffs=
fabb7f97f Ios out of band (#6232)
Co-authored-by: Gordon Hayes <pggordonhayes@gmail.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Ok, got this passing testes, which I guess is a step in the right direction.
Before changing unique pointers to rcp, we could only use an image once, as soon as we assigned a new image, the old image would get garbage collected. (this is the actual problem we are trying to solve)
This "solves" the problem and allows us to add images to a cache in wasm, and then cycle through the cache, swapping out the render image to be displayed for a given fileAsset. We can replace images & fonts on the fly this way.
Problems:
1. overwriting ref & unref in RenderImage, shows that is being reffed and un-reffed constantly (when viewing the attached file with the viewer). Is that expected? doing something similar for Font does not show up the same. I suspect this is related to how we use images when it comes to rendering, just figured i'd check
2. We dont seem to "leak" anything as detectable by our tests, which is good, but our wasm examples show that neither our fonts nor our render images get collected. presumably thats because we would need to manually tell wasm via js that we want to let go of an image?
Also @csmartdalton @umberto-sonnino & @luigi-rosso it would be great to see what else is concerning.
example file
[just_a_box_with_a_tree.riv.zip](https://github.com/rive-app/rive/files/13042414/just_a_box_with_a_tree.riv.zip)
Diffs=
1506b069c Outofbandcache (#6049)
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Some systems we want to integrate with expect these features.
Diffs=
d65b239c5 Add options to build with rtti and exceptions (#6121)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Draft, as there's a quite a few bits to do, but would be neat to get thoughts on it
it "works" but there are questions.
- [x] clean up commits a bit
- [x] pull out cdn stuff to pr that alone & unblock @umberto-sonnino
- [x] make prettier example, i think something with a few images is going to work well
- [x] sort out cpp api for decoding assets. dart lets you set the image, i think cpp needs to do the same. (rather than make it implement decode as it currently does)
- [x] asyncify?! ( we are not doing this at this point)
- [x] make fonts replaceable
- [x] fonts do not replace after rendering/ sometimes async fonts do not get drawn (will tackle this later, need to add artboard referencers to assets so that we know what needs to be made dirty once they are updated)
- [x] fix tests
- [x] add tests
- [x] test webgl
- [x] figure out caching (pushed off for later pr)
example looks a bit like this:
https://github.com/rive-app/rive/assets/1216025/98bc1eaf-6076-44d2-93ca-a9cc8ea42f9e
but it can look like this if the fonts do not load properly

(to repro ☝️ set latency to 300ms)
to run.
compile wasm
`cd rive/packages/runtime_wasm/wasm` && `./build_all_wasm.sh`
run the example
`cd rive/packages/runtime_wasm/wasm/examples/out_of_band_example` && `npm start` (oh and `npm install` first)
Diffs=
f95f54140 Add out of band loading to rive-wasm (#6017)
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
Our actual framework targets 14, so this won't have any effect on clients.
This also allows us to quit targeting armv7.
And cut out arm64e as well. Let's keep our release lean.
Diffs=
05e1afaf3 Bump the iOS minimum version to 13 on native builds (#5989)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Adds map() and unmap() functions to RenderBuffer, and changes Mesh::draw() to map and update the vertex buffer instead of making a new one.
Also refactors RenderBuffer to just be a blob of data as opposed to an array of elements of fixed size and type. Removes the type-specific factory methods for creating RenderBuffers in favor of a single one that just takes a buffer type and buffer size.
Diffs=
06a187288 Make RenderBuffer mappable (#5907)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Looks like we use slightly different build scripts locally which weren't building with Rive Text!
Diffs=
5034c8612 Build with rive_text from Android Studio (#5681)
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
- [x] worked for macos build.
- [x] worked for docker build.
Diffs=
be33bd1b1 update thumbnailer for text (#5667)
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
We should use `symbols 'On'` instead, which is more compatible with
non-clang, non-gcc build systems, like Visual Studio.
Diffs=
db5688c4a Don't use the '-g' buildoption in premake (#5621)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
draft because i need to get a todo list together.
Adds macos as a target for our ios runtime! Also adds a macos target for our example (which is a different app completely, very minimalistic right now).
<img width="331" alt="CleanShot 2023-05-17 at 20 32 45@2x" src="https://github.com/rive-app/rive/assets/1216025/7a6cadce-9763-41a3-b1a0-6d067dfc3eca">
macos, macos rosetta, macos (designed for ipad), and ios all co existing in peace, from the same runtime project

todo:
- [x] update build scripts to build supporting macos (gotta do this)
- [x] run formatter
- [x] test out builds in forked version of ios? (gotta do this)
- [ ] one more stab at catalyst? (i think we can try that later...)
- [ ] do we need a more comprehensive example setup for macos (I think we can do this later & try to pull zach's examples in)
- [ ] I think we should restructure the ios project, but i think we can do that after this as well (i just think the folder structure/project structure can do with some work, now that we add macos (and should make room for tvos as well)
- [x] probably got tests to fix
- [ ] there's probably a bunch of looking at errors in the debugger and figuring those out, but i would hope that we can deploy with some warnings here too.
catalyst problem:
we get this error:
and the problem is basically that we can target a specific library for macos, but we need one for macos and one for macos catalyst. they share the same architecture, so i dont think we can lipo them into one file...
we could change the compiled binaries before creating the frameworks I guess though? .. maybe something to try..
`/Users/maxwelltalbot/development/rive/rive/packages/runtime_ios/dependencies/debug/librive_skia_renderer_macos.a(cg_factory.o), building for Mac Catalyst, but linking in object file built for macOS, file '/Users/maxwelltalbot/development/rive/rive/packages/runtime_ios/dependencies/debug/librive_skia_renderer_macos.a' for architecture arm64` basically
Diffs=
a9f8a1c5d Macos take2 (#5258)
In profiling Joel we saw that RawPath::reset was causing a lot of re-allocation. We realized the intention of reset in most of Rive code is to actually call rewind, so we renamed it and made other adjustments (like calling RawPath::rewind).
Diffs=
f4046e60b Rename reset to rewind. (#5004)
Adds a global "setup_compiler.lua" file that configures premake to build for Android. Since premake doesn't support specifying a custom compiler, we hack this using "gccprefix".
Also moves a bunch of duplicated windows setup logic into "setup_compiler.lua".
Diffs=
040a27c1c Generate Android builds directly from premake (#4871)
* Always use NEON if building for __aarch64__. NEON is required on arm64.
* Apply Windows build options to librive_skia_renderer when the *target* is Windows (not the host). This fixes Windows building for Android.
Diffs=
331ad0d55 Build cleanups
Update the libpng dependency to compile on windows and start using it
for our golden testing instead of Skia's libpng.
This also requires us to begin using the "PNG_PREFIX" feature in our
Skia build so Skia can continue using its internal copy of libpng.
Diffs=
2538229d6 Use Rive's libpng premake dependency in golden testing