blob: f61653b940352ad72f3266f880ad85b8f625b3d6 [file] [log] [blame]
John Reck67b1e2b2020-08-26 13:17:24 -07001/*
2 * Copyright 2020 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_SKIARENDERENGINE_H_
18#define SF_SKIARENDERENGINE_H_
19
20#include <renderengine/RenderEngine.h>
21#include <sys/types.h>
22
23namespace android {
24
25namespace renderengine {
26
27class Mesh;
28class Texture;
29
30namespace skia {
31
32class BlurFilter;
33
34// TODO: Put common skia stuff here that can be shared between the GL & Vulkan backends
35// Currently mostly just handles all the no-op / missing APIs
Alec Mouri081be4c2020-09-16 10:24:47 -070036class SkiaRenderEngine : public RenderEngine {
John Reck67b1e2b2020-08-26 13:17:24 -070037public:
38 static std::unique_ptr<SkiaRenderEngine> create(const RenderEngineCreationArgs& args);
rnleec6a73642021-06-04 14:16:42 -070039 SkiaRenderEngine(RenderEngineType type);
John Reck67b1e2b2020-08-26 13:17:24 -070040 ~SkiaRenderEngine() override {}
41
Ady Abrahamfe2a6db2021-06-09 15:41:37 -070042 virtual std::future<void> primeCache() override { return {}; };
John Reck67b1e2b2020-08-26 13:17:24 -070043 virtual void genTextures(size_t /*count*/, uint32_t* /*names*/) override{};
44 virtual void deleteTextures(size_t /*count*/, uint32_t const* /*names*/) override{};
John Reck67b1e2b2020-08-26 13:17:24 -070045 virtual bool isProtected() const override { return false; } // mInProtectedContext; }
46 virtual bool supportsProtectedContent() const override { return false; };
Alec Mourid6f09462020-12-07 11:18:17 -080047 virtual int getContextPriority() override { return 0; }
Leon Scroggins III9f3072c2021-03-22 10:42:47 -040048 virtual void assertShadersCompiled(int numShaders) {}
Nathaniel Nifongb9f27ef2021-04-01 16:44:12 -040049 virtual int reportShadersCompiled() { return 0; }
Alec Mouria90a5702021-04-16 16:36:21 +000050
51protected:
52 virtual void mapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/,
rnleec6a73642021-06-04 14:16:42 -070053 bool /*isRenderable*/) override = 0;
54 virtual void unmapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/) override = 0;
Sally Qi4cabdd02021-08-05 16:45:57 -070055
56 virtual void drawLayersInternal(
57 const std::shared_ptr<std::promise<RenderEngineResult>>&& resultPromise,
58 const DisplaySettings& display, const std::vector<const LayerSettings*>& layers,
59 const std::shared_ptr<ExternalTexture>& buffer, const bool useFramebufferCache,
60 base::unique_fd&& bufferFence) override {
61 resultPromise->set_value({NO_ERROR, base::unique_fd()});
62 };
John Reck67b1e2b2020-08-26 13:17:24 -070063};
64
65} // namespace skia
66} // namespace renderengine
67} // namespace android
68
Leon Scroggins IIIb9216dc2021-03-08 17:19:01 -050069#endif /* SF_GLESRENDERENGINE_H_ */