Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fe991e5 authored by Chris Craik's avatar Chris Craik
Browse files

Work to support saveLayer in new pipeline

clipped SaveLayers will now be pulled to the beginning of the frame,
prior to drawing FBO 0. This will remove the need for switching FBOs
mid-frame.

Change-Id: I4d8dc1f845e84e9b49d5acdf4f4703eef4a9cb06
parent 387d1b25
Loading
Loading
Loading
Loading
+23 −12
Original line number Diff line number Diff line
@@ -74,53 +74,64 @@ void BakedOpRenderer::endFrame(Info& info) {
#endif
}

void BakedOpRenderer::onRenderNodeOp(Info*, const RenderNodeOp&, const BakedOpState&) {
void BakedOpRenderer::onRenderNodeOp(Info&, const RenderNodeOp&, const BakedOpState&) {
    LOG_ALWAYS_FATAL("unsupported operation");
}

void BakedOpRenderer::onBitmapOp(Info* info, const BitmapOp& op, const BakedOpState& state) {
    info->caches.textureState().activateTexture(0); // TODO: should this be automatic, and/or elsewhere?
    Texture* texture = info->getTexture(op.bitmap);
void BakedOpRenderer::onBitmapOp(Info& info, const BitmapOp& op, const BakedOpState& state) {
    info.caches.textureState().activateTexture(0); // TODO: should this be automatic, and/or elsewhere?
    Texture* texture = info.getTexture(op.bitmap);
    if (!texture) return;
    const AutoTexture autoCleanup(texture);

    const int textureFillFlags = (op.bitmap->colorType() == kAlpha_8_SkColorType)
            ? TextureFillFlags::IsAlphaMaskTexture : TextureFillFlags::None;
    Glop glop;
    GlopBuilder(info->renderState, info->caches, &glop)
    GlopBuilder(info.renderState, info.caches, &glop)
            .setRoundRectClipState(state.roundRectClipState)
            .setMeshTexturedUnitQuad(texture->uvMapper)
            .setFillTexturePaint(*texture, textureFillFlags, op.paint, state.alpha)
            .setTransform(state.computedState.transform, TransformFlags::None)
            .setModelViewMapUnitToRectSnap(Rect(0, 0, texture->width, texture->height))
            .build();
    info->renderGlop(state, glop);
    info.renderGlop(state, glop);
}

void BakedOpRenderer::onRectOp(Info* info, const RectOp& op, const BakedOpState& state) {
void BakedOpRenderer::onRectOp(Info& info, const RectOp& op, const BakedOpState& state) {
    Glop glop;
    GlopBuilder(info->renderState, info->caches, &glop)
    GlopBuilder(info.renderState, info.caches, &glop)
            .setRoundRectClipState(state.roundRectClipState)
            .setMeshUnitQuad()
            .setFillPaint(*op.paint, state.alpha)
            .setTransform(state.computedState.transform, TransformFlags::None)
            .setModelViewMapUnitToRect(op.unmappedBounds)
            .build();
    info->renderGlop(state, glop);
    info.renderGlop(state, glop);
}

void BakedOpRenderer::onSimpleRectsOp(Info* info, const SimpleRectsOp& op, const BakedOpState& state) {
void BakedOpRenderer::onSimpleRectsOp(Info& info, const SimpleRectsOp& op, const BakedOpState& state) {
    Glop glop;
    GlopBuilder(info->renderState, info->caches, &glop)
    GlopBuilder(info.renderState, info.caches, &glop)
            .setRoundRectClipState(state.roundRectClipState)
            .setMeshIndexedQuads(&op.vertices[0], op.vertexCount / 4)
            .setFillPaint(*op.paint, state.alpha)
            .setTransform(state.computedState.transform, TransformFlags::None)
            .setModelViewOffsetRect(0, 0, op.unmappedBounds)
            .build();
    info->renderGlop(state, glop);
    info.renderGlop(state, glop);
}

void BakedOpRenderer::onBeginLayerOp(Info& info, const BeginLayerOp& op, const BakedOpState& state) {
    LOG_ALWAYS_FATAL("unsupported operation");
}

void BakedOpRenderer::onEndLayerOp(Info& info, const EndLayerOp& op, const BakedOpState& state) {
    LOG_ALWAYS_FATAL("unsupported operation");
}

void BakedOpRenderer::onLayerOp(Info& info, const LayerOp& op, const BakedOpState& state) {
    LOG_ALWAYS_FATAL("unsupported operation");
}

} // namespace uirenderer
} // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public:
     * These functions will perform the actual rendering of the individual operations in OpenGL,
     * given the transform/clip and other state built into the BakedOpState object passed in.
     */
    #define BAKED_OP_RENDERER_METHOD(Type) static void on##Type(Info* info, const Type& op, const BakedOpState& state);
    #define BAKED_OP_RENDERER_METHOD(Type) static void on##Type(Info& info, const Type& op, const BakedOpState& state);
    MAP_OPS(BAKED_OP_RENDERER_METHOD);
};

+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ public:
        // resolvedClipRect = intersect(parentMatrix * localClip, parentClip)
        clipRect = recordedOp.localClipRect;
        snapshot.transform->mapRect(clipRect);
        clipRect.doIntersect(snapshot.getClipRect());
        clipRect.doIntersect(snapshot.getRenderTargetClip());
        clipRect.snapToPixelBoundaries();

        // resolvedClippedBounds = intersect(resolvedMatrix * opBounds, resolvedClipRect)
+2 −2
Original line number Diff line number Diff line
@@ -259,7 +259,7 @@ bool CanvasState::calculateQuickRejectForScissor(float left, float top,
    currentTransform()->mapRect(r);
    r.snapGeometryToPixelBoundaries(snapOut);

    Rect clipRect(currentClipRect());
    Rect clipRect(currentRenderTargetClip());
    clipRect.snapToPixelBoundaries();

    if (!clipRect.intersects(r)) return true;
@@ -287,7 +287,7 @@ bool CanvasState::quickRejectConservative(float left, float top,
    currentTransform()->mapRect(r);
    r.roundOut(); // rounded out to be conservative

    Rect clipRect(currentClipRect());
    Rect clipRect(currentRenderTargetClip());
    clipRect.snapToPixelBoundaries();

    if (!clipRect.intersects(r)) return true;
+1 −1
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public:
    void setInvisible(bool value) { mSnapshot->invisible = value; }

    inline const mat4* currentTransform() const { return currentSnapshot()->transform; }
    inline const Rect& currentClipRect() const { return currentSnapshot()->getClipRect(); }
    inline const Rect& currentRenderTargetClip() const { return currentSnapshot()->getRenderTargetClip(); }
    inline Region* currentRegion() const { return currentSnapshot()->region; }
    inline int currentFlags() const { return currentSnapshot()->flags; }
    const Vector3& currentLightCenter() const { return currentSnapshot()->getRelativeLightCenter(); }
Loading