Skip to content

Commit

Permalink
Make RenderBuffer mappable
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
csmartdalton and csmartdalton committed Aug 31, 2023
1 parent 10eb683 commit b60a400
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
654d4488e936ac8c63930253b83229ef1c82618b
06a1872884b3b7cf2be58673e5f5246c57c3d39c
2 changes: 1 addition & 1 deletion .rive_renderer
Original file line number Diff line number Diff line change
@@ -1 +1 @@
96690ec03a40390f89ac31cf595de34857003081
4b551c91aec7067f19b3865100d32de1538ebe9b
7 changes: 4 additions & 3 deletions kotlin/src/main/cpp/include/helpers/android_factories.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ class AndroidSkiaFactory : public rive::SkiaFactory
class AndroidPLSFactory : public rive::pls::PLSFactory
{
public:
rive::rcp<rive::RenderBuffer> makeBufferU16(rive::Span<const uint16_t>) override;
rive::rcp<rive::RenderBuffer> makeBufferU32(rive::Span<const uint32_t>) override;
rive::rcp<rive::RenderBuffer> makeBufferF32(rive::Span<const float>) override;
rive::rcp<rive::RenderBuffer> makeRenderBuffer(rive::RenderBufferType,
rive::RenderBufferFlags,
size_t) override;

std::unique_ptr<rive::RenderImage> decodeImage(rive::Span<const uint8_t>) override;
};

Expand Down
2 changes: 2 additions & 0 deletions kotlin/src/main/cpp/include/models/dimensions_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class DimensionsHelper : public rive::Renderer
rive::rcp<rive::RenderBuffer> vertices_f32,
rive::rcp<rive::RenderBuffer> uvCoords_f32,
rive::rcp<rive::RenderBuffer> indices_u16,
uint32_t vertexCount,
uint32_t indexCount,
rive::BlendMode blendMode,
float opacity) override
{}
Expand Down
11 changes: 6 additions & 5 deletions kotlin/src/main/cpp/src/helpers/android_factories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,12 @@ class AndroidPLSImage : public PLSImage
rive_android::EGLWorker::WorkID m_textureCreationWorkID;
};

rcp<RenderBuffer> AndroidPLSFactory::makeBufferU16(Span<const uint16_t> data) { return nullptr; }

rcp<RenderBuffer> AndroidPLSFactory::makeBufferU32(Span<const uint32_t> data) { return nullptr; }

rcp<RenderBuffer> AndroidPLSFactory::makeBufferF32(Span<const float> data) { return nullptr; }
rcp<RenderBuffer> AndroidPLSFactory::makeRenderBuffer(RenderBufferType type,
RenderBufferFlags flags,
size_t sizeInBytes)
{
return nullptr;
}

std::unique_ptr<RenderImage> AndroidPLSFactory::decodeImage(Span<const uint8_t> encodedBytes)
{
Expand Down
2 changes: 1 addition & 1 deletion submodules/rive-cpp

0 comments on commit b60a400

Please sign in to comment.