2016-10-26 10:30:09 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "SkiaPipeline.h"
|
2016-11-09 11:58:36 -05:00
|
|
|
#include "renderthread/VulkanManager.h"
|
2019-02-15 16:36:30 -05:00
|
|
|
#include "renderthread/VulkanSurface.h"
|
2016-10-26 10:30:09 -04:00
|
|
|
|
2019-02-03 18:01:02 -05:00
|
|
|
#include "renderstate/RenderState.h"
|
|
|
|
|
2016-10-26 10:30:09 -04:00
|
|
|
namespace android {
|
|
|
|
namespace uirenderer {
|
|
|
|
namespace skiapipeline {
|
|
|
|
|
2019-02-03 18:01:02 -05:00
|
|
|
class SkiaVulkanPipeline : public SkiaPipeline, public IGpuContextCallback {
|
2016-10-26 10:30:09 -04:00
|
|
|
public:
|
2018-12-20 13:48:57 -08:00
|
|
|
explicit SkiaVulkanPipeline(renderthread::RenderThread& thread);
|
2019-02-03 18:01:02 -05:00
|
|
|
virtual ~SkiaVulkanPipeline();
|
2016-10-26 10:30:09 -04:00
|
|
|
|
|
|
|
renderthread::MakeCurrentResult makeCurrent() override;
|
|
|
|
renderthread::Frame getFrame() override;
|
|
|
|
bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
|
2018-05-03 14:40:56 -07:00
|
|
|
const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue,
|
2018-09-10 16:28:08 -07:00
|
|
|
const Rect& contentDrawBounds, bool opaque, const LightInfo& lightInfo,
|
2017-11-03 10:12:19 -07:00
|
|
|
const std::vector<sp<RenderNode> >& renderNodes,
|
|
|
|
FrameInfoVisualizer* profiler) override;
|
2019-01-14 13:55:55 -05:00
|
|
|
GrSurfaceOrigin getSurfaceOrigin() override { return kTopLeft_GrSurfaceOrigin; }
|
2016-10-26 10:30:09 -04:00
|
|
|
bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty,
|
2017-11-03 10:12:19 -07:00
|
|
|
FrameInfo* currentFrameInfo, bool* requireSwap) override;
|
2016-10-26 10:30:09 -04:00
|
|
|
DeferredLayerUpdater* createTextureLayer() override;
|
2020-05-07 16:11:18 -07:00
|
|
|
bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior) override;
|
2016-10-26 10:30:09 -04:00
|
|
|
void onStop() override;
|
|
|
|
bool isSurfaceReady() override;
|
|
|
|
bool isContextReady() override;
|
|
|
|
|
|
|
|
static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
|
2017-05-24 13:28:36 -04:00
|
|
|
static sk_sp<Bitmap> allocateHardwareBitmap(renderthread::RenderThread& thread,
|
2017-11-03 10:12:19 -07:00
|
|
|
SkBitmap& skBitmap);
|
2016-10-26 10:30:09 -04:00
|
|
|
|
2019-02-03 18:01:02 -05:00
|
|
|
protected:
|
|
|
|
void onContextDestroyed() override;
|
|
|
|
|
2016-10-26 10:30:09 -04:00
|
|
|
private:
|
2021-04-08 11:39:02 -04:00
|
|
|
renderthread::VulkanManager& vulkanManager();
|
|
|
|
|
2016-11-09 11:58:36 -05:00
|
|
|
renderthread::VulkanSurface* mVkSurface = nullptr;
|
2016-10-26 10:30:09 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace skiapipeline */
|
|
|
|
} /* namespace uirenderer */
|
|
|
|
} /* namespace android */
|