1500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev/*
2500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Copyright (C) 2016 The Android Open Source Project
3500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *
4500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Licensed under the Apache License, Version 2.0 (the "License");
5500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * you may not use this file except in compliance with the License.
6500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * You may obtain a copy of the License at
7500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *
8500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *      http://www.apache.org/licenses/LICENSE-2.0
9500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *
10500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Unless required by applicable law or agreed to in writing, software
11500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * distributed under the License is distributed on an "AS IS" BASIS,
12500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * See the License for the specific language governing permissions and
14500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * limitations under the License.
15500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev */
16500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
17500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#pragma once
18500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
19500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#include "SkiaPipeline.h"
200e3cba31460e0698def0310003b7d291f1174afaDerek Sollenberger#include "renderthread/VulkanManager.h"
21500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
22500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace android {
23500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace uirenderer {
24500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace skiapipeline {
25500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
26500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievclass SkiaVulkanPipeline : public SkiaPipeline {
27500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievpublic:
280e3cba31460e0698def0310003b7d291f1174afaDerek Sollenberger    SkiaVulkanPipeline(renderthread::RenderThread& thread);
29500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    virtual ~SkiaVulkanPipeline() {}
30500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
31500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    renderthread::MakeCurrentResult makeCurrent() override;
32500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    renderthread::Frame getFrame() override;
33500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
34500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const FrameBuilder::LightGeometry& lightGeometry,
35500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            LayerUpdateQueue* layerUpdateQueue,
36500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const Rect& contentDrawBounds, bool opaque,
37500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const BakedOpRenderer::LightInfo& lightInfo,
38500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const std::vector< sp<RenderNode> >& renderNodes,
39500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            FrameInfoVisualizer* profiler) override;
40500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty,
41500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            FrameInfo* currentFrameInfo, bool* requireSwap) override;
42500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override;
43500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    DeferredLayerUpdater* createTextureLayer() override;
44500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior) override;
45500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    void onStop() override;
46500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool isSurfaceReady() override;
47500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool isContextReady() override;
48500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
49500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
50500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
51500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievprivate:
520e3cba31460e0698def0310003b7d291f1174afaDerek Sollenberger    renderthread::VulkanManager& mVkManager;
530e3cba31460e0698def0310003b7d291f1174afaDerek Sollenberger    renderthread::VulkanSurface* mVkSurface = nullptr;
54500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev};
55500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
56500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace skiapipeline */
57500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace uirenderer */
58500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace android */
59