Refactor PLSRenderer into draw objects Despaghettifies PLSRenderer into high level "PLSDraw" objects that have the ability to count their resource requirements ahead of time and write out their draw data later. This refactoring will eventually allow us to remove intermediate flushes and implement sorting for atomic and msaa modes. We take a ~50% CPU performance/cache loss from moving the path-processing scratch buffers into persistent heap allocations, but we need this persistence in order to count up allocation sizes and remove intermediate flushes. If CPU performance actually becomes a bottleneck in rendering, we can explore options to get this performance back. Diffs= d52d14a1f Refactor PLSRenderer into draw objects (#6397) Co-authored-by: Chris Dalton <99840794+csmartdalton@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head index cdccb94..fc236ec 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -8666bde87b8ef973ff99d7a285a4b768bdf76aa9 +d52d14a1f3f45cda402246dec6b95814cc05abe3
diff --git a/include/rive/math/raw_path.hpp b/include/rive/math/raw_path.hpp index 0aefab5..7f277f8 100644 --- a/include/rive/math/raw_path.hpp +++ b/include/rive/math/raw_path.hpp
@@ -30,6 +30,7 @@ bool empty() const { return m_Points.empty(); } AABB bounds() const; + size_t countMoveTos() const; void move(Vec2D); void line(Vec2D);
diff --git a/src/math/raw_path.cpp b/src/math/raw_path.cpp index 4bbaccb..29a1d5e 100644 --- a/src/math/raw_path.cpp +++ b/src/math/raw_path.cpp
@@ -43,6 +43,16 @@ return bounds; } +size_t RawPath::countMoveTos() const +{ + size_t moveToCount = 0; + for (PathVerb verb : m_Verbs) + { + moveToCount += verb == PathVerb::move ? 1 : 0; + } + return moveToCount; +} + void RawPath::injectImplicitMoveIfNeeded() { if (!m_contourIsOpen)