Skip to content

Commit

Permalink
Change class names to strip PLS
Browse files Browse the repository at this point in the history
Diffs=
c7bb5eb5a Change class names to strip PLS (#7988)
2be9ddc7e Set core audio session category to none (#7772)
25d423274 Initial file moves and renames (#7951)
69cffe900 Check if clipping shape's worldpath exists (#7956)
8b0f43cea Change master to main for runtime-wasm (#7965)

Co-authored-by: rivessamr <[email protected]>
  • Loading branch information
rivessamr and rivessamr committed Aug 28, 2024
1 parent 44f4902 commit 504f418
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/submodule_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
# lets check it when we push to master (we've just done something in android, its a good time to see about this)
push:
branches:
- master
- main

schedule:
# 8am UTC every day
Expand Down
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
08d65ca60f8246c2f1456cb6ed8a43b0c7de8100
c7bb5eb5ae34e300171bc6e48e26216170b094c7
2 changes: 1 addition & 1 deletion wasm/premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ filter({})
RIVE_RUNTIME_DIR = os.isdir('../../runtime') and '../../runtime' or './submodules/rive-runtime'
dofile(RIVE_RUNTIME_DIR .. '/premake5_v2.lua')

RIVE_PLS_DIR = os.isdir('../../runtime/pls') and '../../runtime/pls' or './submodules/rive-runtime/pls'
RIVE_PLS_DIR = os.isdir('../../runtime/renderer') and '../../runtime/renderer' or './submodules/rive-runtime/renderer'
if _OPTIONS['renderer'] == 'webgl2' then
dofile(RIVE_PLS_DIR .. '/premake5_pls_renderer.lua')
end
Expand Down
72 changes: 36 additions & 36 deletions wasm/src/bindings_webgl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#ifdef RIVE_WEBGL2_RENDERER

#include "rive/pls/pls_image.hpp"
#include "rive/pls/gl/pls_render_context_gl_impl.hpp"
#include "rive/pls/pls_renderer.hpp"
#include "rive/pls/gl/pls_render_target_gl.hpp"
#include "rive/renderer/image.hpp"
#include "rive/renderer/gl/render_context_gl_impl.hpp"
#include "rive/renderer/rive_renderer.hpp"
#include "rive/renderer/gl/render_target_gl.hpp"
#include "js_alignment.hpp"

#include <emscripten.h>
Expand All @@ -22,7 +22,7 @@ using namespace emscripten;
#include <vector>

using namespace rive;
using namespace rive::pls;
using namespace rive::gpu;

class WebGL2Renderer;
class WebGL2RenderImage;
Expand All @@ -33,9 +33,9 @@ using PLSResourceID = uint64_t;
static std::atomic<PLSResourceID> s_nextWebGL2ImageID;
static std::atomic<PLSResourceID> s_nextWebGL2BufferID;

// Singleton PLSFactory implementation for WebGL 2.
// Singleton RiveRenderFactory implementation for WebGL 2.
// All objects are context free and keyed to actual resources the the specific GL contexts.
class WebGL2Factory : public PLSFactory
class WebGL2Factory : public RiveRenderFactory
{
public:
static WebGL2Factory* Instance()
Expand Down Expand Up @@ -112,7 +112,7 @@ class ScopedGLContextMakeCurrent
const EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_previousContext;
};

// Wraps a PLSImage that will be decoded in the future.
// Wraps an Image that will be decoded in the future.
class PLSPromiseImage
{
public:
Expand All @@ -137,12 +137,12 @@ class PLSPromiseImage
m_plsImage.reset();
}

PLSImage* getPLSImage(const WebGL2Renderer*, const WebGL2RenderImage*);
Image* getImage(const WebGL2Renderer*, const WebGL2RenderImage*);

private:
const EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_contextGL;
GLuint m_decodingTextureID = 0;
rcp<PLSImage> m_plsImage;
rcp<Image> m_plsImage;
PLSResourceID m_frameIDWhenValid = 0;
};

Expand Down Expand Up @@ -224,13 +224,13 @@ class PLSSynchronizedBuffer
PLSResourceID m_mutationID = 0; // Tells when we are out of sync with the WebGL2BufferData.
};

// Wraps a tightly coupled PLSRenderer and PLSRenderContext, which are tied to a specific WebGL2
// Wraps a tightly coupled RiveRenderer and RenderContext, which are tied to a specific WebGL2
// context.
class WebGL2Renderer : public PLSRenderer
class WebGL2Renderer : public RiveRenderer
{
public:
WebGL2Renderer(std::unique_ptr<PLSRenderContext> plsContext, int width, int height) :
PLSRenderer(plsContext.get()), m_plsContext(std::move(plsContext))
WebGL2Renderer(std::unique_ptr<RenderContext> plsContext, int width, int height) :
RiveRenderer(plsContext.get()), m_plsContext(std::move(plsContext))
{
resize(width, height);
}
Expand All @@ -248,9 +248,9 @@ class WebGL2Renderer : public PLSRenderer

PLSResourceID currentFrameID() const { return m_currentFrameID; }

PLSRenderContextGLImpl* plsContextGL() const
RenderContextGLImpl* plsContextGL() const
{
return m_plsContext->static_impl_cast<PLSRenderContextGLImpl>();
return m_plsContext->static_impl_cast<RenderContextGLImpl>();
}

void resize(int width, int height)
Expand All @@ -266,10 +266,10 @@ class WebGL2Renderer : public PLSRenderer
// TODO: Give this a better name!!
void clear()
{
PLSRenderContext::FrameDescriptor frameDescriptor = {
RenderContext::FrameDescriptor frameDescriptor = {
.renderTargetWidth = m_renderTarget->width(),
.renderTargetHeight = m_renderTarget->height(),
.loadAction = pls::LoadAction::clear,
.loadAction = gpu::LoadAction::clear,
.clearColor = 0,
};
if (m_renderTarget->sampleCount() > 1)
Expand Down Expand Up @@ -303,10 +303,10 @@ class WebGL2Renderer : public PLSRenderer
void drawImage(const RenderImage* renderImage, BlendMode blendMode, float opacity) override
{
LITE_RTTI_CAST_OR_RETURN(webglRenderImage, const WebGL2RenderImage*, renderImage);
if (PLSImage* plsImage = getPLSImage(webglRenderImage))
if (Image* plsImage = getImage(webglRenderImage))
{
// The plsImage is done decoding.
PLSRenderer::drawImage(plsImage, blendMode, opacity);
RiveRenderer::drawImage(plsImage, blendMode, opacity);
}
}

Expand All @@ -320,20 +320,20 @@ class WebGL2Renderer : public PLSRenderer
float opacity) override
{
LITE_RTTI_CAST_OR_RETURN(webglRenderImage, const WebGL2RenderImage*, renderImage);
if (PLSImage* plsImage = getPLSImage(webglRenderImage))
if (Image* plsImage = getImage(webglRenderImage))
{
// The plsImage is done decoding.
LITE_RTTI_CAST_OR_RETURN(vertexBuffer, WebGL2RenderBuffer*, vertices_f32.get());
LITE_RTTI_CAST_OR_RETURN(uvBuffer, WebGL2RenderBuffer*, uvCoords_f32.get());
LITE_RTTI_CAST_OR_RETURN(indexBuffer, WebGL2RenderBuffer*, indices_u16.get());
PLSRenderer::drawImageMesh(plsImage,
refPLSBuffer(vertexBuffer),
refPLSBuffer(uvBuffer),
refPLSBuffer(indexBuffer),
vertexCount,
indexCount,
blendMode,
opacity);
RiveRenderer::drawImageMesh(plsImage,
refPLSBuffer(vertexBuffer),
refPLSBuffer(uvBuffer),
refPLSBuffer(indexBuffer),
vertexCount,
indexCount,
blendMode,
opacity);
}
}

Expand All @@ -356,11 +356,11 @@ class WebGL2Renderer : public PLSRenderer
}

private:
PLSImage* getPLSImage(const WebGL2RenderImage* webglImage)
Image* getImage(const WebGL2RenderImage* webglImage)
{
PLSPromiseImage& promiseImage =
m_plsPromiseImages.try_emplace(webglImage->uniqueID(), this, webglImage).first->second;
return promiseImage.getPLSImage(this, webglImage);
return promiseImage.getImage(this, webglImage);
}

rcp<RenderBuffer> refPLSBuffer(WebGL2RenderBuffer* wglBuff)
Expand All @@ -372,7 +372,7 @@ class WebGL2Renderer : public PLSRenderer

const EMSCRIPTEN_WEBGL_CONTEXT_HANDLE m_contextGL = emscripten_webgl_get_current_context();

std::unique_ptr<PLSRenderContext> m_plsContext;
std::unique_ptr<RenderContext> m_plsContext;
rcp<FramebufferRenderTargetGL> m_renderTarget;

std::map<PLSResourceID, PLSPromiseImage> m_plsPromiseImages;
Expand Down Expand Up @@ -430,8 +430,8 @@ PLSPromiseImage::PLSPromiseImage(const WebGL2Renderer* webglRenderer,
}
}

PLSImage* PLSPromiseImage::getPLSImage(const WebGL2Renderer* webglRenderer,
const WebGL2RenderImage* webglRenderImage)
Image* PLSPromiseImage::getImage(const WebGL2Renderer* webglRenderer,
const WebGL2RenderImage* webglRenderImage)
{
assert(emscripten_webgl_get_current_context() == m_contextGL);
if (m_plsImage == nullptr) // Is the image not yet decoded?
Expand All @@ -449,7 +449,7 @@ PLSImage* PLSPromiseImage::getPLSImage(const WebGL2Renderer* webglRenderer,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
m_plsImage = make_rcp<PLSImage>(webglRenderer->plsContextGL()->adoptImageTexture(
m_plsImage = make_rcp<Image>(webglRenderer->plsContextGL()->adoptImageTexture(
texture_image_width(m_decodingTextureID),
texture_image_height(m_decodingTextureID),
m_decodingTextureID));
Expand Down Expand Up @@ -515,7 +515,7 @@ Factory* jsFactory() { return WebGL2Factory::Instance(); }

WebGL2Renderer* makeWebGL2Renderer(int width, int height)
{
if (auto plsContext = PLSRenderContextGLImpl::MakeContext())
if (auto plsContext = RenderContextGLImpl::MakeContext())
{
return new WebGL2Renderer(std::move(plsContext), width, height);
}
Expand Down
2 changes: 1 addition & 1 deletion wasm/submodules/rive-runtime
Submodule rive-runtime updated 142 files

0 comments on commit 504f418

Please sign in to comment.