|  | /* | 
|  | * Copyright 2022 The Android Open Source Project | 
|  | * | 
|  | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | * you may not use this file except in compliance with the License. | 
|  | * You may obtain a copy of the License at | 
|  | * | 
|  | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | * | 
|  | * Unless required by applicable law or agreed to in writing, software | 
|  | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | * See the License for the specific language governing permissions and | 
|  | * limitations under the License. | 
|  | */ | 
|  |  | 
|  | #ifndef SF_SKIAVKRENDERENGINE_H_ | 
|  | #define SF_SKIAVKRENDERENGINE_H_ | 
|  |  | 
|  | // Allow the SkiaVkRenderEngine class to not be compiled, to save space | 
|  | // NOTE: In order to build this class, define `RE_SKIAVK` in a build file. | 
|  | #ifdef RE_SKIAVK | 
|  |  | 
|  | #include <vk/GrVkBackendContext.h> | 
|  |  | 
|  | #include "SkiaRenderEngine.h" | 
|  |  | 
|  | namespace android { | 
|  | namespace renderengine { | 
|  | namespace skia { | 
|  |  | 
|  | class SkiaVkRenderEngine : public SkiaRenderEngine { | 
|  | public: | 
|  | // Returns false if Vulkan implementation can't support SkiaVkRenderEngine. | 
|  | static bool canSupportSkiaVkRenderEngine(); | 
|  | static std::unique_ptr<SkiaVkRenderEngine> create(const RenderEngineCreationArgs& args); | 
|  | ~SkiaVkRenderEngine() override; | 
|  |  | 
|  | int getContextPriority() override; | 
|  |  | 
|  | protected: | 
|  | // Implementations of abstract SkiaRenderEngine functions specific to | 
|  | // rendering backend | 
|  | virtual SkiaRenderEngine::Contexts createDirectContexts(const GrContextOptions& options); | 
|  | bool supportsProtectedContentImpl() const override; | 
|  | bool useProtectedContextImpl(GrProtected isProtected) override; | 
|  | void waitFence(GrDirectContext* grContext, base::borrowed_fd fenceFd) override; | 
|  | base::unique_fd flushAndSubmit(GrDirectContext* context) override; | 
|  | void appendBackendSpecificInfoToDump(std::string& result) override; | 
|  |  | 
|  | private: | 
|  | SkiaVkRenderEngine(const RenderEngineCreationArgs& args); | 
|  | base::unique_fd flush(); | 
|  |  | 
|  | GrVkBackendContext mBackendContext; | 
|  | }; | 
|  |  | 
|  | } // namespace skia | 
|  | } // namespace renderengine | 
|  | } // namespace android | 
|  |  | 
|  | #endif // RE_SKIAVK | 
|  | #endif // SF_SKIAVKRENDERENGINE_H_ |