blob: 5d10b6f8bebc74a8860b6ca4bc9d184d2344ec40 [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; }
Leon Scroggins IIIa37ca992022-02-02 18:08:20 -050050 virtual void setEnableTracing(bool tracingEnabled) override;
Alec Mouria90a5702021-04-16 16:36:21 +000051
52protected:
53 virtual void mapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/,
rnleec6a73642021-06-04 14:16:42 -070054 bool /*isRenderable*/) override = 0;
55 virtual void unmapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/) override = 0;
Sally Qi4cabdd02021-08-05 16:45:57 -070056
57 virtual void drawLayersInternal(
58 const std::shared_ptr<std::promise<RenderEngineResult>>&& resultPromise,
Sally Qi59a9f502021-10-12 18:53:23 +000059 const DisplaySettings& display, const std::vector<LayerSettings>& layers,
Sally Qi4cabdd02021-08-05 16:45:57 -070060 const std::shared_ptr<ExternalTexture>& buffer, const bool useFramebufferCache,
61 base::unique_fd&& bufferFence) override {
62 resultPromise->set_value({NO_ERROR, base::unique_fd()});
63 };
John Reck67b1e2b2020-08-26 13:17:24 -070064};
65
66} // namespace skia
67} // namespace renderengine
68} // namespace android
69
Leon Scroggins IIIb9216dc2021-03-08 17:19:01 -050070#endif /* SF_GLESRENDERENGINE_H_ */