blob: c552b96d470e7eae666c3d9fa4829873f1567786 [file] [log] [blame]
Robert Phillips09b2bcb2021-05-12 11:56:47 -04001/*
2 * Copyright 2021 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkBaseGpuDevice_DEFINED
9#define SkBaseGpuDevice_DEFINED
10
Robert Phillipsc2132ea2021-05-17 14:32:29 -040011#include "src/gpu/GrSurfaceProxyView.h"
12
Robert Phillips09b2bcb2021-05-12 11:56:47 -040013// NOTE: when not defined, SkGpuDevice extends SkBaseDevice directly and manages its clip stack
14// using GrClipStack. When false, SkGpuDevice continues to extend SkClipStackDevice and uses
15// SkClipStack and GrClipStackClip to manage the clip stack.
16#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
17 // For staging purposes, disable this for Android Framework
18 #if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK)
19 #define SK_DISABLE_NEW_GR_CLIP_STACK
20 #endif
21#endif
22
23#if !defined(SK_DISABLE_NEW_GR_CLIP_STACK)
24 #include "src/core/SkDevice.h"
25 #define BASE_DEVICE SkBaseDevice
26#else
27 #include "src/core/SkClipStackDevice.h"
28 #define BASE_DEVICE SkClipStackDevice
29#endif
30
31class SkBaseGpuDevice : public BASE_DEVICE {
32public:
Robert Phillips54c878e2021-05-20 13:22:52 -040033 enum InitContents {
34 kClear_InitContents,
35 kUninit_InitContents
36 };
37
Robert Phillips09b2bcb2021-05-12 11:56:47 -040038 SkBaseGpuDevice(const SkImageInfo& ii, const SkSurfaceProps& props)
39 : INHERITED(ii, props) {
40 }
41
Robert Phillipsc2132ea2021-05-17 14:32:29 -040042 virtual GrSurfaceProxyView readSurfaceView() = 0;
43 GrRenderTargetProxy* targetProxy() {
44 return this->readSurfaceView().asRenderTargetProxy();
45 }
Robert Phillips09b2bcb2021-05-12 11:56:47 -040046
Robert Phillips0095fcb2021-05-24 14:34:01 -040047 virtual bool wait(int numSemaphores,
48 const GrBackendSemaphore* waitSemaphores,
49 bool deleteSemaphoresAfterWait) = 0;
50
Robert Phillips09b2bcb2021-05-12 11:56:47 -040051protected:
52
53private:
54 using INHERITED = BASE_DEVICE;
55};
56
57#undef BASE_DEVICE
58
59#endif