blob: 0c0fbe9d716c37568e5c9f5e099e346d37648df8 [file] [log] [blame]
Stan Iliev768e3932016-07-08 21:34:52 -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 "FrameInfoVisualizer.h"
20#include "EglManager.h"
21
22#include <SkRect.h>
23#include <utils/RefBase.h>
24
25namespace android {
26
27class Surface;
28
29namespace uirenderer {
30
31class DeferredLayerUpdater;
32
33namespace renderthread {
34
35enum class SwapBehavior {
36 kSwap_default,
37 kSwap_discardBuffer,
38};
39
40enum class MakeCurrentResult {
41 AlreadyCurrent,
42 Failed,
43 Succeeded
44};
45
46class IRenderPipeline {
47public:
48 virtual MakeCurrentResult makeCurrent() = 0;
49 virtual Frame getFrame() = 0;
50 virtual bool draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
51 const FrameBuilder::LightGeometry& lightGeometry,
52 LayerUpdateQueue* layerUpdateQueue,
53 const Rect& contentDrawBounds, bool opaque,
54 const BakedOpRenderer::LightInfo& lightInfo,
55 const std::vector< sp<RenderNode> >& renderNodes,
56 FrameInfoVisualizer* profiler) = 0;
57 virtual bool swapBuffers(const Frame& frame, bool drew, const SkRect& screenDirty,
58 FrameInfo* currentFrameInfo, bool* requireSwap) = 0;
59 virtual bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) = 0;
60 virtual Layer* createTextureLayer() = 0;
61 virtual bool setSurface(Surface* window, SwapBehavior swapBehavior) = 0;
62 virtual void onStop() = 0;
63 virtual bool isSurfaceReady() = 0;
64 virtual bool isContextReady() = 0;
65 virtual void onDestroyHardwareResources() = 0;
66 virtual void renderLayers(const FrameBuilder::LightGeometry& lightGeometry,
67 LayerUpdateQueue* layerUpdateQueue, bool opaque,
68 const BakedOpRenderer::LightInfo& lightInfo) = 0;
69 virtual TaskManager* getTaskManager() = 0;
70
71 virtual ~IRenderPipeline() {}
72};
73
74} /* namespace renderthread */
75} /* namespace uirenderer */
76} /* namespace android */