blob: 2e0cf45220c8d030219bd3096b4aa29fa5c6a3d1 [file] [log] [blame]
Ian Elliott1f0911e2022-09-09 16:31:47 -06001/*
2 * Copyright 2022 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#ifndef SF_SKIAVKRENDERENGINE_H_
18#define SF_SKIAVKRENDERENGINE_H_
19
20#include <vk/GrVkBackendContext.h>
21
22#include "SkiaRenderEngine.h"
23
24namespace android {
25namespace renderengine {
26namespace skia {
27
28class SkiaVkRenderEngine : public SkiaRenderEngine {
29public:
30 // Returns false if Vulkan implementation can't support SkiaVkRenderEngine.
31 static bool canSupportSkiaVkRenderEngine();
32 static std::unique_ptr<SkiaVkRenderEngine> create(const RenderEngineCreationArgs& args);
33 ~SkiaVkRenderEngine() override;
34
35 int getContextPriority() override;
36
37protected:
38 // Implementations of abstract SkiaRenderEngine functions specific to
39 // rendering backend
40 virtual SkiaRenderEngine::Contexts createDirectContexts(const GrContextOptions& options);
41 bool supportsProtectedContentImpl() const override;
42 bool useProtectedContextImpl(GrProtected isProtected) override;
43 void waitFence(GrDirectContext* grContext, base::borrowed_fd fenceFd) override;
44 base::unique_fd flushAndSubmit(GrDirectContext* context) override;
45 void appendBackendSpecificInfoToDump(std::string& result) override;
46
47private:
48 SkiaVkRenderEngine(const RenderEngineCreationArgs& args);
49 base::unique_fd flush();
50
51 GrVkBackendContext mBackendContext;
52};
53
54} // namespace skia
55} // namespace renderengine
56} // namespace android
57
Ian Elliottbe705072023-01-04 08:31:37 -070058#endif