John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 23 | namespace android { |
| 24 | |
| 25 | namespace renderengine { |
| 26 | |
| 27 | class Mesh; |
| 28 | class Texture; |
| 29 | |
| 30 | namespace skia { |
| 31 | |
| 32 | class 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 Mouri | 081be4c | 2020-09-16 10:24:47 -0700 | [diff] [blame] | 36 | class SkiaRenderEngine : public RenderEngine { |
John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 37 | public: |
| 38 | static std::unique_ptr<SkiaRenderEngine> create(const RenderEngineCreationArgs& args); |
Alec Mouri | 0d99510 | 2021-02-24 16:53:38 -0800 | [diff] [blame] | 39 | SkiaRenderEngine(RenderEngineType type) : RenderEngine(type) {} |
John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 40 | ~SkiaRenderEngine() override {} |
| 41 | |
Leon Scroggins III | b9216dc | 2021-03-08 17:19:01 -0500 | [diff] [blame] | 42 | virtual void primeCache() override{}; |
John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 43 | virtual void genTextures(size_t /*count*/, uint32_t* /*names*/) override{}; |
| 44 | virtual void deleteTextures(size_t /*count*/, uint32_t const* /*names*/) override{}; |
John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 45 | virtual bool isProtected() const override { return false; } // mInProtectedContext; } |
| 46 | virtual bool supportsProtectedContent() const override { return false; }; |
| 47 | virtual bool useProtectedContext(bool /*useProtectedContext*/) override { return false; }; |
| 48 | virtual status_t drawLayers(const DisplaySettings& /*display*/, |
| 49 | const std::vector<const LayerSettings*>& /*layers*/, |
Alec Mouri | a90a570 | 2021-04-16 16:36:21 +0000 | [diff] [blame^] | 50 | const std::shared_ptr<ExternalTexture>& /*buffer*/, |
John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 51 | const bool /*useFramebufferCache*/, |
| 52 | base::unique_fd&& /*bufferFence*/, |
| 53 | base::unique_fd* /*drawFence*/) override { |
| 54 | return 0; |
| 55 | }; |
| 56 | virtual bool cleanupPostRender(CleanupMode) override { return true; }; |
Alec Mouri | d6f0946 | 2020-12-07 11:18:17 -0800 | [diff] [blame] | 57 | virtual int getContextPriority() override { return 0; } |
Leon Scroggins III | 9f3072c | 2021-03-22 10:42:47 -0400 | [diff] [blame] | 58 | virtual void assertShadersCompiled(int numShaders) {} |
Nathaniel Nifong | b9f27ef | 2021-04-01 16:44:12 -0400 | [diff] [blame] | 59 | virtual int reportShadersCompiled() { return 0; } |
Alec Mouri | a90a570 | 2021-04-16 16:36:21 +0000 | [diff] [blame^] | 60 | |
| 61 | protected: |
| 62 | virtual void mapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/, |
| 63 | bool /*isRenderable*/) override; |
| 64 | virtual void unmapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/) override; |
John Reck | 67b1e2b | 2020-08-26 13:17:24 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | } // namespace skia |
| 68 | } // namespace renderengine |
| 69 | } // namespace android |
| 70 | |
Leon Scroggins III | b9216dc | 2021-03-08 17:19:01 -0500 | [diff] [blame] | 71 | #endif /* SF_GLESRENDERENGINE_H_ */ |