blob: 3d00386bf5cd3315803ecfbb69ff2dcb6f0e109c [file] [log] [blame]
Stan Iliev500a0c32016-10-26 10:30:09 -04001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include "SkiaPipeline.h"
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050020#include "renderthread/VulkanManager.h"
Stan Iliev500a0c32016-10-26 10:30:09 -040021
22namespace android {
23namespace uirenderer {
24namespace skiapipeline {
25
26class SkiaVulkanPipeline : public SkiaPipeline {
27public:
Chih-Hung Hsiehf9336412018-12-20 13:48:57 -080028 explicit SkiaVulkanPipeline(renderthread::RenderThread& thread);
Stan Iliev500a0c32016-10-26 10:30:09 -040029 virtual ~SkiaVulkanPipeline() {}
30
31 renderthread::MakeCurrentResult makeCurrent() override;
32 renderthread::Frame getFrame() override;
33 bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
John Reck1bcacfd2017-11-03 10:12:19 -070034 const FrameBuilder::LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue,
35 const Rect& contentDrawBounds, bool opaque, bool wideColorGamut,
36 const BakedOpRenderer::LightInfo& lightInfo,
37 const std::vector<sp<RenderNode> >& renderNodes,
38 FrameInfoVisualizer* profiler) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040039 bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty,
John Reck1bcacfd2017-11-03 10:12:19 -070040 FrameInfo* currentFrameInfo, bool* requireSwap) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040041 bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override;
42 DeferredLayerUpdater* createTextureLayer() override;
Romain Guy26a2b972017-04-17 09:39:51 -070043 bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior,
John Reck1bcacfd2017-11-03 10:12:19 -070044 renderthread::ColorMode colorMode) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040045 void onStop() override;
46 bool isSurfaceReady() override;
47 bool isContextReady() override;
48
49 static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
Stan Iliev7bc3bc62017-05-24 13:28:36 -040050 static sk_sp<Bitmap> allocateHardwareBitmap(renderthread::RenderThread& thread,
John Reck1bcacfd2017-11-03 10:12:19 -070051 SkBitmap& skBitmap);
Stan Iliev500a0c32016-10-26 10:30:09 -040052
53private:
Derek Sollenberger0e3cba32016-11-09 11:58:36 -050054 renderthread::VulkanManager& mVkManager;
55 renderthread::VulkanSurface* mVkSurface = nullptr;
Stan Iliev500a0c32016-10-26 10:30:09 -040056};
57
58} /* namespace skiapipeline */
59} /* namespace uirenderer */
60} /* namespace android */