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 36 class SkiaRenderEngine : public RenderEngine { 37 public: 38 static std::unique_ptr<SkiaRenderEngine> create(const RenderEngineCreationArgs& args); 39 SkiaRenderEngine(RenderEngineType type); ~SkiaRenderEngine()40 ~SkiaRenderEngine() override {} 41 primeCache()42 virtual std::future<void> primeCache() override { return {}; }; genTextures(size_t,uint32_t *)43 virtual void genTextures(size_t /*count*/, uint32_t* /*names*/) override{}; deleteTextures(size_t,uint32_t const *)44 virtual void deleteTextures(size_t /*count*/, uint32_t const* /*names*/) override{}; isProtected()45 virtual bool isProtected() const override { return false; } // mInProtectedContext; } supportsProtectedContent()46 virtual bool supportsProtectedContent() const override { return false; }; drawLayers(const DisplaySettings &,const std::vector<const LayerSettings * > &,const std::shared_ptr<ExternalTexture> &,const bool,base::unique_fd &&,base::unique_fd *)47 virtual status_t drawLayers(const DisplaySettings& /*display*/, 48 const std::vector<const LayerSettings*>& /*layers*/, 49 const std::shared_ptr<ExternalTexture>& /*buffer*/, 50 const bool /*useFramebufferCache*/, 51 base::unique_fd&& /*bufferFence*/, 52 base::unique_fd* /*drawFence*/) override { 53 return 0; 54 }; getContextPriority()55 virtual int getContextPriority() override { return 0; } assertShadersCompiled(int numShaders)56 virtual void assertShadersCompiled(int numShaders) {} reportShadersCompiled()57 virtual int reportShadersCompiled() { return 0; } 58 59 protected: 60 virtual void mapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/, 61 bool /*isRenderable*/) override = 0; 62 virtual void unmapExternalTextureBuffer(const sp<GraphicBuffer>& /*buffer*/) override = 0; 63 }; 64 65 } // namespace skia 66 } // namespace renderengine 67 } // namespace android 68 69 #endif /* SF_GLESRENDERENGINE_H_ */ 70