SkiaVulkanPipeline.h revision 500a0c30d4dcd012218c3e44a62926a1c34a259f
1500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev/* 2500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Copyright (C) 2016 The Android Open Source Project 3500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * 4500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Licensed under the Apache License, Version 2.0 (the "License"); 5500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * you may not use this file except in compliance with the License. 6500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * You may obtain a copy of the License at 7500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * 8500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * http://www.apache.org/licenses/LICENSE-2.0 9500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * 10500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Unless required by applicable law or agreed to in writing, software 11500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * distributed under the License is distributed on an "AS IS" BASIS, 12500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * See the License for the specific language governing permissions and 14500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * limitations under the License. 15500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev */ 16500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 17500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#pragma once 18500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 19500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#include "SkiaPipeline.h" 20500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#include <SkSurface.h> 21500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 22500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace sk_app { 23500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievclass WindowContext; 24500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} 25500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 26500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace android { 27500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace uirenderer { 28500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace skiapipeline { 29500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 30500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievclass SkiaVulkanPipeline : public SkiaPipeline { 31500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievpublic: 32500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev SkiaVulkanPipeline(renderthread::RenderThread& thread) : SkiaPipeline(thread) {} 33500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev virtual ~SkiaVulkanPipeline() {} 34500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 35500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev renderthread::MakeCurrentResult makeCurrent() override; 36500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev renderthread::Frame getFrame() override; 37500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty, 38500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev const FrameBuilder::LightGeometry& lightGeometry, 39500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev LayerUpdateQueue* layerUpdateQueue, 40500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev const Rect& contentDrawBounds, bool opaque, 41500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev const BakedOpRenderer::LightInfo& lightInfo, 42500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev const std::vector< sp<RenderNode> >& renderNodes, 43500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev FrameInfoVisualizer* profiler) override; 44500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, 45500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev FrameInfo* currentFrameInfo, bool* requireSwap) override; 46500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override; 47500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev DeferredLayerUpdater* createTextureLayer() override; 48500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior) override; 49500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev void onStop() override; 50500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev bool isSurfaceReady() override; 51500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev bool isContextReady() override; 52500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 53500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor); 54500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 55500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievprivate: 56500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev sk_app::WindowContext* mWindowContext = nullptr; 57500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev sk_sp<SkSurface> mBackbuffer; 58500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev}; 59500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev 60500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace skiapipeline */ 61500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace uirenderer */ 62500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace android */ 63