D3D and metal both have an opposite sense of Y when rendering to an
offscreen texture. This knowledge used to be baked into the shaders, but
that makes it difficult to correctly get triangle windings when we're
using face culling. This PR instead moves this knowledge of the Y
direction into variables by negating the Y viewport uniforms when
necessary.
This change also exposed an issue in minify.py where HLSL semantic names
were getting collisions because they are NOT case sensitive. So this
change also updates minify.py to not use lower case letters in
"@exported" names.
Diffs=
623766365 Remove the 'EMIT_OFFSCREEN_VERTEX' macro in PLS (#5615)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
This animation wasn't ending up on the right frame when quickly moving the cursor left->right. This was an error with update cycle order of the text modifier group vs the text object itself. The modifier group needs to always update before the text object!
@JcToon showed this issue to me in the office today...
https://github.com/rive-app/rive/assets/454182/76692e1d-e670-4324-a8ac-8c8ce0748e52
Diffs=
b17671130 Fixing modifier ranges not updating on the right frame. (#5623)
Since we removed our use of PathComposer and are recomputing our metrics path in FollowPathConstraint, a dependency order bug was resulting in the constrained component being updated BEFORE its follow path constraint. Since we generate our path in FollowPathConstraint.update, this meant the constrained component wasn't getting an up to date path. This resulted in unexpected behavior in the editor, such as https://github.com/rive-app/rive/issues/5569.
Diffs=
d1f8710f5 Fix dependency order issues for Follow Path (#5595)
Allows setting the origin at the baseline:
<img width="1086" alt="CleanShot 2023-07-13 at 15 25 54@2x" src="https://github.com/rive-app/rive/assets/454182/eab10c64-75f0-4272-a5d5-3eedb92dbf7e">
It also changes how the text moves when line spacing is changing, keeping the text aligned to the origin (no swimming origin).
Drafting to allow tests to run, want to add the runtime (c++) component to this.
Diffs=
8e82475b8 Baseline Origin (#5577)
This ensures that only whole frames are displayed. Good for ensuring the frames you see in the editor are what is shown at runtime and for creating more stop-motion like effects efficiently.

Diffs=
8b49fcbc5 Add option to quantize time to whole frames of framerate. (#5578)
three commits
1 - updated the generator
2 - ran generator against core
3 - ran generator against core runtime
i tried to remove all the changes that are not the comment change
Diffs=
1292ebe56 Code generator fixes alternative (#5584)
Now that we have two coverage components per pixel, it's cleaner to use the second, which is otherwise unused for fills.
Diffs=
4587a3d1d Use v_edgeDistance.y to differentiate between PLS strokes and fills (#5582)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
The PLS code has started to devolve into chaos. This PR is a start at attempting to de-spaghettify some of it.
It also fixes a bug that got introduced in bae069339. That PR assumed that interior triangulation did not write contour records to the GPU, but that's false. "outerCurve" patches still need a contour record in order to get the pathID.
Diffs=
60296f34f PLS cleanups (#5580)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
RawPath used to discard empty segments from lineTo/quadTo/cubicTo. However, it was still possible produce empty segments when transforming a path, and RawPath didn't catch those.
This change adds a simple utility, RawPath::pruneEmptySegments(), and passes the responsibility on to the client for using this method when necessary (including after a transform).
Diffs=
bae069339 Stop automatically pruning empty segments in RawPath (#5557)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Need to fix the caret with small line heights and check something odd re: bounding boxes in Flutter Web but want to start running tests.
Diffs=
2d2d8c413 Line Height & Paragraph Spacing (#5552)
Finally ready! Some highlights:
- Text objects own TextModifierGroups
- A TextModifierGroup defines a set of operations (Modifiers) to perform on ranges of the whole Text object.
- The ranges are defined by TextModifierRanges which are owned by TextModiferGroups. Each TextModifierGroup can have multiple TextModifierRanges, meaning that the set of Modifiers will perform on the final selection defined by TextModifierRanges.
- TextModifierRanges select portions of the text in a Text object based on rules that define the strength of the selection. The strength of multiple TextModifierRanges can be blended together meaning selection strength can be above 1 and below 0 (optionally clamped).
- There are three fundamental modifications:
1. Transform where glyphs are individually transformed by a matrix
2. Paint where glyphs are drawn with different paint (currently only opacity is supported, but later Fill and Stroke will be too).
3. Shape where a selection can have shaping properties (currently variable axes later also font size) changed. This is the most complex one as it requires [two pass shaping](ef2d0d3ca3/packages/runtime/src/text/text.cpp (L578-L598)).
Diffs=
8086bdbf9 Runtime modifiers (#5512)
Restoring the propertyKeys for follow path constraint since they were already being used by animators.
Diffs=
5a18c89bd Swap propertyKeys between follow path and text core defs (#5543)
Not sure how the previous PR didn't fail with the core def conflicts. Maybe something else got merged in the meantime?
Also changed offset to default to false to be consistent with other constraints.
Diffs=
942bb8c94 Fix conflicting core key ids and set follow path offset to default false (#5541)
Adds origin to text object that works just like the origin of a parametric path. It can be moved in freeze mode too. Adds support in the editor, Flutter runtime, and C++ runtime.
Diffs=
9b8dacbac Adding origin to text. (#5533)
Adds a drawing mode for large paths that:
1. Subdivides the curves into sections spanning no more than 16 segments.
2. Draws the outer curves using the existing PLS algorithm.
3. Triangulates the path interior into non-overlapping triangles and draws them separately.
In addition to simply eliminating overdraw, these interior triangles:
1. Can be drawn without raster ordered synchronization (since they don't overlap).
2. Don't have to update the coverage buffer (since we know each fragment is the final one for the path at that pixel).
Both of these properties lead to savings in a PC environment that uses read/write textures for pixel local storage (45 fps -> 78 fps on the Rope.riv at 3840x2241).
Apple Silicon also benefits from these changes, even though we can't turn off raster ordering there and the coverage updates should have been much cheaper in a tiled rendering architecture (375 fps -> 525 fps on the Rope.riv at 3200x2102).
Diffs=
16c4503b8 Implement interior triangulation for PLS (#5515)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
We were set up to have different uniform buffers for every draw, but it makes more sense to just put all the info into a single shared buffer.
Diffs=
0796b5c1c Consolidate uniforms into a single buffer (#5447)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Fixes an issue I introduced when adding the features functionality. I imported harfbuzz from our text header which causes all downstream users to need to know where the harfbuzz includes are. This isn't necessary and slows down the compiler too.
Diffs=
500d878a2 fix viewer build (#5493)
Adds runtime and editor support for setting feature flags on a Font.
The biggest change to the font engine is that the feature options are now stored on the Font object itself instead of hard-coded during shaping. This is nice as it requires no extra data to be piped through for individual run styling. It also means that we generalized the concept of creating a variable font as configuring a version of the font (see withOptions replacing makeVariation) so that variable axis and feature settings are treated as options to a Font configuration.
This also allows us to track existing variations and options on the configured Font such that any further call to "withOptions" on that already configured Font will propagate previous changes if not overridden. This fortuitously also fixes an issue the modifiers were exhibiting where a variation set on the TextStyle that wasn't part of the modifier set would be lost.
Diffs=
31d9a5424 Feature options on Fonts (#5479)
Quite a lot of churn here, I created this off of https://github.com/rive-app/rive/pull/5429 which already generated a lot of code.
On top of it, I also generated the C++ classes, which in turn added a bunch of other missing things related to text.
There's *not that much non-generated* code here, but I'll keep this draft for now..?
Diffs=
8b7587241 Runtime/interpolate states cpp (#5437)
It's been great being able to draw everything in a single call, but we
are now at a point where we need separate draws for coarse
inner-path-fan tessellations and non-raster-ordered rendering. We will
probably also find separate draws superior to an uber shader for nested
clipping and raster images.
This change (finally) introduces a DrawList, which is capable of
recording all the types of draws we may need. Implementing the DrawList
also required incorporating EXT_base_instance into the GL backend, which
in turn necessitated a nice cleanup of our GL extension wrangling.
Diffs=
28c49dbbd Introduce a DrawList to PLS (#5432)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Wrong direction. We can do better by packing the wedge size in the vertex data and using the built-in "base instance".
Diffs=
80117d7b1 Delete the DrawParameters buffer (#5441)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
I accidentally overwrote this code when I pushed new changes to the original PR on github.
Diffs=
e00611f6c Cleanup the fibonacci growth function in TrivialBlockAllocator (#5430)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
We intentionally chose Skia's triangulator, as opposed to libtess et. al., because it gives us the "breadcrumb triangle" list, which we need in order to do coarse tessellations of just the inner fan.
Diffs=
c153c393a Import GrTriangulator from Skia with tests (#5417)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Currently, PLS renders every path in a single draw call. In order to support some indispensable optmizations, in addition to non-raster-ordered rendering, we need to be able to support a draw list with multiple draws. This change adds a uniform buffer that can support per-draw parameters.
Diffs=
beab8bab0 Refactor PLS uniform buffers to support multiple draws (#5416)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
* <mm_malloc.h> is clang only.
* __builtin_clz is clang only.
* Generate preprocessor defines for shader feature sets as a bitfield instead of strings.
* Use float literals with simd expressions, which are more compatible with the non-clang simd workaround class.
* Remove C++20 designated initializer lists.
Diffs=
ffa49c5b9 Non-clang build fixes (#5397)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Co-authored-by: Scott Redig <scott@pocketwatchgames.com>
Reorder "@PLS_IMPL_RW_TEXTURE" macro definitions in a way that feels more intuitive.
Diffs=
6bb88136d Reorder PLS RW texture definitions (#5388)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
Refer to the correct folder name (pls, not rive_pls).
Diffs=
0781fdac2 Fix downstream pls pushes (#5375)
9dca5ab50 Reorganize pixel local storage implementations (#5353)
Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>