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

Commit a500ceab authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement WebView support for Vulkan using temporary buffer"

parents a01a1809 11606ffa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ cc_defaults {
        "pipeline/skia/SkiaRecordingCanvas.cpp",
        "pipeline/skia/SkiaVulkanPipeline.cpp",
        "pipeline/skia/VectorDrawableAtlas.cpp",
        "pipeline/skia/VkFunctorDrawable.cpp",
        "renderstate/RenderState.cpp",
        "renderthread/CacheManager.cpp",
        "renderthread/CanvasContext.cpp",
+0 −33
Original line number Diff line number Diff line
@@ -107,39 +107,6 @@ static bool hasFP16Support() {

#define FENCE_TIMEOUT 2000000000

class AutoEglImage {
public:
    AutoEglImage(EGLDisplay display, EGLClientBuffer clientBuffer) : mDisplay(display) {
        EGLint imageAttrs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
        image = eglCreateImageKHR(display, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, clientBuffer,
                                  imageAttrs);
    }

    ~AutoEglImage() {
        if (image != EGL_NO_IMAGE_KHR) {
            eglDestroyImageKHR(mDisplay, image);
        }
    }

    EGLImageKHR image = EGL_NO_IMAGE_KHR;

private:
    EGLDisplay mDisplay = EGL_NO_DISPLAY;
};

class AutoSkiaGlTexture {
public:
    AutoSkiaGlTexture() {
        glGenTextures(1, &mTexture);
        glBindTexture(GL_TEXTURE_2D, mTexture);
    }

    ~AutoSkiaGlTexture() { glDeleteTextures(1, &mTexture); }

private:
    GLuint mTexture = 0;
};

struct FormatInfo {
    PixelFormat pixelFormat;
    GLint format, type;
+4 −4
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ protected:
            renderNodeDrawable->getRenderNode()->output(mOutput, mLevel + 1);
            return;
        }
        auto glFunctorDrawable = getGLFunctorDrawable(drawable);
        auto glFunctorDrawable = getFunctorDrawable(drawable);
        if (nullptr != glFunctorDrawable) {
            mOutput << std::string(mLevel * 2, ' ') << "drawGLFunctorDrawable" << std::endl;
            return;
@@ -157,10 +157,10 @@ private:
        return nullptr;
    }

    GLFunctorDrawable* getGLFunctorDrawable(SkDrawable* drawable) {
    FunctorDrawable* getFunctorDrawable(SkDrawable* drawable) {
        for (auto& child : mDisplayList.mChildFunctors) {
            if (drawable == &child) {
                return &child;
            if (drawable == child) {
                return child;
            }
        }
        return nullptr;
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include "GlFunctorLifecycleListener.h"

#include <SkCanvas.h>
#include <SkDrawable.h>

#include <utils/Functor.h>

namespace android {
namespace uirenderer {

namespace skiapipeline {

/**
 * This drawable wraps a functor enabling it to be recorded into a list
 * of Skia drawing commands.
 */
class FunctorDrawable : public SkDrawable {
public:
    FunctorDrawable(Functor* functor, GlFunctorLifecycleListener* listener, SkCanvas* canvas)
            : mFunctor(functor), mListener(listener), mBounds(canvas->getLocalClipBounds()) {}
    virtual ~FunctorDrawable() {}

    virtual void syncFunctor() const = 0;

protected:
    virtual SkRect onGetBounds() override { return mBounds; }

    Functor* mFunctor;
    sp<GlFunctorLifecycleListener> mListener;
    const SkRect mBounds;
};

};  // namespace skiapipeline
};  // namespace uirenderer
};  // namespace android
+0 −6
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
#include <GrContext.h>
#include <private/hwui/DrawGlInfo.h>
#include "GlFunctorLifecycleListener.h"
#include "Properties.h"
#include "RenderNode.h"
#include "SkAndroidFrameworkUtils.h"
#include "SkClipStack.h"
@@ -80,11 +79,6 @@ void GLFunctorDrawable::onDraw(SkCanvas* canvas) {
        return;
    }

    if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaVulkan) {
        canvas->clear(SK_ColorRED);
        return;
    }

    GLuint fboID = 0;
    SkISize fboSize;
    if (!GetFboDetails(canvas, &fboID, &fboSize)) {
Loading