blob: bcde3b1756edc6438ef66c254c08a94f95398efd [file] [log] [blame]
Greg Daniel164a9f02016-02-22 09:56:40 -05001/*
2 * Copyright 2015 Google Inc.
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 GrVkGpu_DEFINED
9#define GrVkGpu_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/gpu/vk/GrVkBackendContext.h"
12#include "include/gpu/vk/GrVkTypes.h"
13#include "src/gpu/GrGpu.h"
14#include "src/gpu/vk/GrVkCaps.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050015#include "src/gpu/vk/GrVkIndexBuffer.h"
16#include "src/gpu/vk/GrVkMemory.h"
17#include "src/gpu/vk/GrVkResourceProvider.h"
18#include "src/gpu/vk/GrVkSemaphore.h"
19#include "src/gpu/vk/GrVkUtil.h"
20#include "src/gpu/vk/GrVkVertexBuffer.h"
Greg Daniel164a9f02016-02-22 09:56:40 -050021
22class GrPipeline;
Greg Daniel164a9f02016-02-22 09:56:40 -050023
24class GrVkBufferImpl;
Ethan Nicholas8e265a72018-12-12 16:22:40 -050025class GrVkCommandPool;
Greg Daniel81df0412018-05-31 13:13:33 -040026class GrVkMemoryAllocator;
Greg Daniel164a9f02016-02-22 09:56:40 -050027class GrVkPipeline;
egdaniel22281c12016-03-23 13:49:40 -070028class GrVkPipelineState;
egdaniel066df7c2016-06-08 14:02:27 -070029class GrVkPrimaryCommandBuffer;
Greg Daniel2d41d0d2019-08-26 11:08:51 -040030class GrVkOpsRenderPass;
Greg Daniel164a9f02016-02-22 09:56:40 -050031class GrVkRenderPass;
egdaniel066df7c2016-06-08 14:02:27 -070032class GrVkSecondaryCommandBuffer;
Greg Daniel164a9f02016-02-22 09:56:40 -050033class GrVkTexture;
34struct GrVkInterface;
35
Ethan Nicholas941e7e22016-12-12 15:33:30 -050036namespace SkSL {
37 class Compiler;
38}
39
Greg Daniel164a9f02016-02-22 09:56:40 -050040class GrVkGpu : public GrGpu {
41public:
Greg Danielf730c182018-07-02 20:15:37 +000042 static sk_sp<GrGpu> Make(const GrVkBackendContext&, const GrContextOptions&, GrContext*);
jvanverth633b3562016-03-23 11:01:22 -070043
Greg Daniel164a9f02016-02-22 09:56:40 -050044 ~GrVkGpu() override;
45
Greg Daniel8606cf82017-05-08 16:17:53 -040046 void disconnect(DisconnectType) override;
47
Greg Danielf730c182018-07-02 20:15:37 +000048 const GrVkInterface* vkInterface() const { return fInterface.get(); }
Greg Daniel164a9f02016-02-22 09:56:40 -050049 const GrVkCaps& vkCaps() const { return *fVkCaps; }
50
Greg Daniele643da62019-11-05 12:36:42 -050051 bool isDeviceLost() const { return fDeviceIsLost; }
52 void setDeviceLost() { fDeviceIsLost = true; }
53
Greg Daniel81df0412018-05-31 13:13:33 -040054 GrVkMemoryAllocator* memoryAllocator() const { return fMemoryAllocator.get(); }
55
Greg Daniel637c06a2018-09-12 09:44:25 -040056 VkPhysicalDevice physicalDevice() const { return fPhysicalDevice; }
Greg Daniel164a9f02016-02-22 09:56:40 -050057 VkDevice device() const { return fDevice; }
58 VkQueue queue() const { return fQueue; }
Greg Danielecddbc02018-08-30 16:39:34 -040059 uint32_t queueIndex() const { return fQueueIndex; }
Ethan Nicholas8e265a72018-12-12 16:22:40 -050060 GrVkCommandPool* cmdPool() const { return fCmdPool; }
Greg Daniela870b462019-01-08 15:49:46 -050061 const VkPhysicalDeviceProperties& physicalDeviceProperties() const {
Greg Daniel8385a8a2018-02-26 13:29:37 -050062 return fPhysDevProps;
63 }
Greg Daniela870b462019-01-08 15:49:46 -050064 const VkPhysicalDeviceMemoryProperties& physicalDeviceMemoryProperties() const {
Greg Daniel164a9f02016-02-22 09:56:40 -050065 return fPhysDevMemProps;
66 }
Emircan Uysaler23ca4e72019-06-24 10:53:09 -040067 bool protectedContext() const { return fProtectedContext == GrProtected::kYes; }
Greg Daniel164a9f02016-02-22 09:56:40 -050068
egdanielbc9b2962016-09-27 08:00:53 -070069 GrVkResourceProvider& resourceProvider() { return fResourceProvider; }
70
71 GrVkPrimaryCommandBuffer* currentCommandBuffer() { return fCurrentCmdBuffer; }
Greg Daniel164a9f02016-02-22 09:56:40 -050072
Chris Dalton2284aab2019-11-15 11:02:24 -070073 void querySampleLocations(GrRenderTarget*, SkTArray<SkPoint>*) override;
Chris Daltond7291ba2019-03-07 14:17:03 -070074
Greg Daniel164a9f02016-02-22 09:56:40 -050075 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
76
Robert Phillipsf0313ee2019-05-21 13:51:11 -040077 void deleteBackendTexture(const GrBackendTexture&) override;
Robert Phillipsf0ced622019-05-16 09:06:25 -040078#if GR_TEST_UTILS
79 bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
Greg Daniel164a9f02016-02-22 09:56:40 -050080
Brian Osman2d010b62018-08-09 10:55:09 -040081 GrBackendRenderTarget createTestingOnlyBackendRenderTarget(int w, int h, GrColorType) override;
Brian Salomonf865b052018-03-09 09:01:53 -050082 void deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) override;
83
Greg Daniel26b50a42018-03-08 09:49:58 -050084 void testingOnly_flushGpuAndSync() override;
Brian Osmanfd7657c2019-04-25 11:34:07 -040085
86 void resetShaderCacheForTesting() const override {
87 fResourceProvider.resetShaderCacheForTesting();
88 }
Brian Salomonf865b052018-03-09 09:01:53 -050089#endif
Greg Daniel26b50a42018-03-08 09:49:58 -050090
Chris Daltoneffee202019-07-01 22:28:03 -060091 GrStencilAttachment* createStencilAttachmentForRenderTarget(
92 const GrRenderTarget*, int width, int height, int numStencilSamples) override;
Greg Daniel164a9f02016-02-22 09:56:40 -050093
Greg Daniel2d41d0d2019-08-26 11:08:51 -040094 GrOpsRenderPass* getOpsRenderPass(
Greg Daniel4a0d36d2019-09-30 12:24:36 -040095 GrRenderTarget*, GrSurfaceOrigin, const SkIRect&,
Greg Daniel2d41d0d2019-08-26 11:08:51 -040096 const GrOpsRenderPass::LoadAndStoreInfo&,
Greg Danielb20d7e52019-09-03 13:54:39 -040097 const GrOpsRenderPass::StencilLoadAndStoreInfo&,
Michael Ludwigfcdd0612019-11-25 08:34:31 -050098 const SkTArray<GrSurfaceProxy*, true>& sampledProxies) override;
egdaniel066df7c2016-06-08 14:02:27 -070099
Greg Daniel59dc1482019-02-22 10:46:38 -0500100 void addBufferMemoryBarrier(const GrVkResource*,
101 VkPipelineStageFlags srcStageMask,
Greg Daniel164a9f02016-02-22 09:56:40 -0500102 VkPipelineStageFlags dstStageMask,
103 bool byRegion,
104 VkBufferMemoryBarrier* barrier) const;
Greg Daniel59dc1482019-02-22 10:46:38 -0500105 void addImageMemoryBarrier(const GrVkResource*,
106 VkPipelineStageFlags srcStageMask,
Greg Daniel164a9f02016-02-22 09:56:40 -0500107 VkPipelineStageFlags dstStageMask,
108 bool byRegion,
109 VkImageMemoryBarrier* barrier) const;
halcanary9d524f22016-03-29 09:03:52 -0700110
ethannicholasb3058bd2016-07-01 08:22:01 -0700111 SkSL::Compiler* shaderCompiler() const {
112 return fCompiler;
113 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500114
Brian Salomon930f9392018-06-20 16:25:26 -0400115 bool onRegenerateMipMapLevels(GrTexture* tex) override;
116
Chris Dalton16a33c62019-09-24 22:19:17 -0600117 void onResolveRenderTarget(GrRenderTarget* target, const SkIRect& resolveRect,
118 GrSurfaceOrigin resolveOrigin, ForExternalIO) override;
egdaniel66933552016-08-24 07:22:19 -0700119
Greg Danielf0c681e2019-09-05 14:07:41 -0400120 void submitSecondaryCommandBuffer(std::unique_ptr<GrVkSecondaryCommandBuffer>);
egdaniel066df7c2016-06-08 14:02:27 -0700121
Greg Daniel2d41d0d2019-08-26 11:08:51 -0400122 void submit(GrOpsRenderPass*) override;
Robert Phillips5b5d84c2018-08-09 15:12:18 -0400123
Greg Daniel6be35232017-03-01 17:01:09 -0500124 GrFence SK_WARN_UNUSED_RESULT insertFence() override;
125 bool waitFence(GrFence, uint64_t timeout) override;
jvanverth84741b32016-09-30 08:39:02 -0700126 void deleteFence(GrFence) const override;
127
Greg Daniel301015c2019-11-18 14:06:46 -0500128 std::unique_ptr<GrSemaphore> SK_WARN_UNUSED_RESULT makeSemaphore(bool isOwned) override;
129 std::unique_ptr<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
130 GrResourceProvider::SemaphoreWrapType wrapType, GrWrapOwnership ownership) override;
131 void insertSemaphore(GrSemaphore* semaphore) override;
132 void waitSemaphore(GrSemaphore* semaphore) override;
Greg Daniel48661b82018-01-22 16:11:35 -0500133
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400134 // These match the definitions in SkDrawable, from whence they came
135 typedef void* SubmitContext;
136 typedef void (*SubmitProc)(SubmitContext submitContext);
137
138 // Adds an SkDrawable::GpuDrawHandler that we will delete the next time we submit the primary
139 // command buffer to the gpu.
140 void addDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable);
141
Brian Salomonb0d8b762019-05-06 16:58:22 -0400142 void checkFinishProcs() override { fResourceProvider.checkCommandBuffers(); }
143
Greg Daniel301015c2019-11-18 14:06:46 -0500144 std::unique_ptr<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;
Brian Osman13dddce2017-05-09 13:19:50 -0400145
Greg Daniel6888c0d2017-08-25 11:55:50 -0400146 void copyBuffer(GrVkBuffer* srcBuffer, GrVkBuffer* dstBuffer, VkDeviceSize srcOffset,
147 VkDeviceSize dstOffset, VkDeviceSize size);
jvanverthdb379092016-07-07 11:18:46 -0700148 bool updateBuffer(GrVkBuffer* buffer, const void* src, VkDeviceSize offset, VkDeviceSize size);
jvanvertha584de92016-06-30 09:10:52 -0700149
Greg Daniela870b462019-01-08 15:49:46 -0500150 enum PersistentCacheKeyType : uint32_t {
151 kShader_PersistentCacheKeyType = 0,
152 kPipelineCache_PersistentCacheKeyType = 1,
153 };
154
155 void storeVkPipelineCacheData() override;
156
Greg Danielfa3adf72019-11-07 09:53:41 -0500157 bool beginRenderPass(const GrVkRenderPass*,
Greg Danielf0c681e2019-09-05 14:07:41 -0400158 const VkClearValue* colorClear,
159 GrVkRenderTarget*, GrSurfaceOrigin,
Greg Daniel28d40b22019-09-09 15:00:15 +0000160 const SkIRect& bounds, bool forSecondaryCB);
Greg Danielf0c681e2019-09-05 14:07:41 -0400161 void endRenderPass(GrRenderTarget* target, GrSurfaceOrigin origin, const SkIRect& bounds);
162
Greg Daniel164a9f02016-02-22 09:56:40 -0500163private:
Greg Daniele1185582019-12-04 11:29:44 -0500164 enum SyncQueue {
165 kForce_SyncQueue,
166 kSkip_SyncQueue
167 };
168
Greg Daniel98bffae2018-08-01 13:25:41 -0400169 GrVkGpu(GrContext*, const GrContextOptions&, const GrVkBackendContext&,
Greg Daniel41f0e282019-01-28 13:15:05 -0500170 sk_sp<const GrVkInterface>, uint32_t instanceVersion, uint32_t physicalDeviceVersion);
jvanverth633b3562016-03-23 11:01:22 -0700171
egdanielcfcd1812016-03-22 07:16:10 -0700172 void onResetContext(uint32_t resetBits) override {}
Greg Daniel164a9f02016-02-22 09:56:40 -0500173
Greg Daniel8606cf82017-05-08 16:17:53 -0400174 void destroyResources();
175
Robert Phillipsb915c942019-12-17 14:44:37 -0500176 GrBackendTexture onCreateBackendTexture(SkISize dimensions,
Brian Salomon85c3d682019-11-04 15:04:54 -0500177 const GrBackendFormat&,
178 GrRenderable,
179 const BackendTextureData*,
Robert Phillips0d7e2f12019-12-18 13:01:04 -0500180 GrMipMapped,
Brian Salomon85c3d682019-11-04 15:04:54 -0500181 GrProtected) override;
Robert Phillipsb915c942019-12-17 14:44:37 -0500182 GrBackendTexture onCreateCompressedBackendTexture(SkISize dimensions,
183 const GrBackendFormat&,
184 const BackendTextureData*,
185 GrMipMapped,
186 GrProtected) override;
187
Brian Salomon81536f22019-08-08 16:30:49 -0400188 sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&,
189 const GrBackendFormat& format,
190 GrRenderable,
191 int renderTargetSampleCnt,
192 SkBudgeted,
193 GrProtected,
Brian Salomond2a8ae22019-09-10 16:03:59 -0400194 int mipLevelCount,
195 uint32_t levelClearMask) override;
Robert Phillips9f744f72019-12-19 19:14:33 -0500196 sk_sp<GrTexture> onCreateCompressedTexture(SkISize dimensions, const GrBackendFormat&,
Robert Phillipse4720c62020-01-14 14:33:24 -0500197 SkBudgeted, GrMipMapped, const void* data,
Robert Phillips9f744f72019-12-19 19:14:33 -0500198 size_t dataSize) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500199
Robert Phillipsc80b0e92019-07-23 10:27:09 -0400200 sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, GrColorType, GrWrapOwnership,
201 GrWrapCacheable, GrIOType) override;
Robert Phillipsb915c942019-12-17 14:44:37 -0500202 sk_sp<GrTexture> onWrapCompressedBackendTexture(const GrBackendTexture&, GrWrapOwnership,
203 GrWrapCacheable) override;
Brian Salomond17f6582017-07-19 18:28:58 -0400204 sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
Brian Salomond17f6582017-07-19 18:28:58 -0400205 int sampleCnt,
Robert Phillips0902c982019-07-16 07:47:56 -0400206 GrColorType colorType,
Brian Salomonaa6ca0a2019-01-24 16:03:07 -0500207 GrWrapOwnership,
208 GrWrapCacheable) override;
Robert Phillipsc80b0e92019-07-23 10:27:09 -0400209 sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
210 GrColorType) override;
Greg Daniel7ef28f32017-04-20 16:41:55 +0000211
212 sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
Robert Phillipsc80b0e92019-07-23 10:27:09 -0400213 int sampleCnt, GrColorType) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500214
Greg Danielb46add82019-01-02 14:51:29 -0500215 sk_sp<GrRenderTarget> onWrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
216 const GrVkDrawableInfo&) override;
217
Brian Salomondbf70722019-02-07 11:31:24 -0500218 sk_sp<GrGpuBuffer> onCreateBuffer(size_t size, GrGpuBufferType type, GrAccessPattern,
219 const void* data) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500220
Brian Salomonf77c1462019-08-01 15:19:29 -0400221 bool onReadPixels(GrSurface* surface, int left, int top, int width, int height,
222 GrColorType surfaceColorType, GrColorType dstColorType, void* buffer,
223 size_t rowBytes) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500224
Brian Salomonf77c1462019-08-01 15:19:29 -0400225 bool onWritePixels(GrSurface* surface, int left, int top, int width, int height,
226 GrColorType surfaceColorType, GrColorType srcColorType,
Greg Danielb20d7e52019-09-03 13:54:39 -0400227 const GrMipLevel texels[], int mipLevelCount,
228 bool prepForTexSampling) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500229
Brian Salomonf77c1462019-08-01 15:19:29 -0400230 bool onTransferPixelsTo(GrTexture*, int left, int top, int width, int height,
231 GrColorType textureColorType, GrColorType bufferColorType,
Brian Salomone05ba5a2019-04-08 11:59:07 -0400232 GrGpuBuffer* transferBuffer, size_t offset, size_t rowBytes) override;
Brian Salomon26de56e2019-04-10 12:14:26 -0400233 bool onTransferPixelsFrom(GrSurface* surface, int left, int top, int width, int height,
Brian Salomonf77c1462019-08-01 15:19:29 -0400234 GrColorType surfaceColorType, GrColorType bufferColorType,
235 GrGpuBuffer* transferBuffer, size_t offset) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500236
Greg Daniel46cfbc62019-06-07 11:43:30 -0400237 bool onCopySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
Greg Daniele227fe42019-08-21 13:52:24 -0400238 const SkIPoint& dstPoint) override;
Brian Salomon9b009bb2018-02-14 13:53:55 -0500239
Greg Daniel30a35e82019-11-19 14:12:25 -0500240 bool onFinishFlush(GrSurfaceProxy*[], int, SkSurface::BackendSurfaceAccess access,
Greg Daniel797efca2019-05-09 14:04:20 -0400241 const GrFlushInfo&, const GrPrepareForExternalIORequests&) override;
Greg Daniel51316782017-08-02 15:10:09 +0000242
Greg Daniel164a9f02016-02-22 09:56:40 -0500243 // Ends and submits the current command buffer to the queue and then creates a new command
halcanary9d524f22016-03-29 09:03:52 -0700244 // buffer and begins it. If sync is set to kForce_SyncQueue, the function will wait for all
Greg Daniela5cb7812017-06-16 09:45:32 -0400245 // work in the queue to finish before returning. If this GrVkGpu object has any semaphores in
246 // fSemaphoreToSignal, we will add those signal semaphores to the submission of this command
247 // buffer. If this GrVkGpu object has any semaphores in fSemaphoresToWaitOn, we will add those
248 // wait semaphores to the submission of this command buffer.
Greg Daniele1185582019-12-04 11:29:44 -0500249 bool submitCommandBuffer(SyncQueue sync, GrGpuFinishedProc finishedProc = nullptr,
Greg Daniela3aa75a2019-04-12 14:24:55 -0400250 GrGpuFinishedContext finishedContext = nullptr);
Greg Daniel164a9f02016-02-22 09:56:40 -0500251
Greg Daniel46cfbc62019-06-07 11:43:30 -0400252 void copySurfaceAsCopyImage(GrSurface* dst, GrSurface* src, GrVkImage* dstImage,
253 GrVkImage* srcImage, const SkIRect& srcRect,
Greg Daniel164a9f02016-02-22 09:56:40 -0500254 const SkIPoint& dstPoint);
255
Greg Daniel46cfbc62019-06-07 11:43:30 -0400256 void copySurfaceAsBlit(GrSurface* dst, GrSurface* src, GrVkImage* dstImage, GrVkImage* srcImage,
257 const SkIRect& srcRect, const SkIPoint& dstPoint);
egdaniel17b89252016-04-05 07:23:38 -0700258
Greg Daniel46cfbc62019-06-07 11:43:30 -0400259 void copySurfaceAsResolve(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
egdaniel4bcd62e2016-08-31 07:37:31 -0700260 const SkIPoint& dstPoint);
261
jvanverth900bd4a2016-04-29 13:53:12 -0700262 // helpers for onCreateTexture and writeTexturePixels
Brian Salomona9b04b92018-06-01 15:04:28 -0400263 bool uploadTexDataLinear(GrVkTexture* tex, int left, int top, int width, int height,
264 GrColorType colorType, const void* data, size_t rowBytes);
265 bool uploadTexDataOptimal(GrVkTexture* tex, int left, int top, int width, int height,
266 GrColorType colorType, const GrMipLevel texels[], int mipLevelCount);
Robert Phillipse4720c62020-01-14 14:33:24 -0500267 bool uploadTexDataCompressed(GrVkTexture* tex, VkFormat vkFormat, SkISize dimensions,
268 GrMipMapped mipMapped, const void* data, size_t dataSize);
Brian Salomon1fabd512018-02-09 09:54:25 -0500269 void resolveImage(GrSurface* dst, GrVkRenderTarget* src, const SkIRect& srcRect,
270 const SkIPoint& dstPoint);
egdaniel4bcd62e2016-08-31 07:37:31 -0700271
Brian Salomon85c3d682019-11-04 15:04:54 -0500272 bool createVkImageForBackendSurface(VkFormat,
273 SkISize,
Robert Phillipsb8757352020-01-21 13:05:25 -0500274 GrTexturable,
Robert Phillips0d7e2f12019-12-18 13:01:04 -0500275 GrRenderable,
Brian Salomon85c3d682019-11-04 15:04:54 -0500276 const BackendTextureData*,
Robert Phillips0d7e2f12019-12-18 13:01:04 -0500277 GrMipMapped,
Brian Salomon85c3d682019-11-04 15:04:54 -0500278 GrVkImageInfo*,
279 GrProtected);
Brian Salomon52e943a2018-03-13 09:32:39 -0400280
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400281 sk_sp<const GrVkInterface> fInterface;
282 sk_sp<GrVkMemoryAllocator> fMemoryAllocator;
283 sk_sp<GrVkCaps> fVkCaps;
Greg Daniele643da62019-11-05 12:36:42 -0500284 bool fDeviceIsLost = false;
jvanverth633b3562016-03-23 11:01:22 -0700285
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400286 VkPhysicalDevice fPhysicalDevice;
287 VkDevice fDevice;
288 VkQueue fQueue; // Must be Graphics queue
289 uint32_t fQueueIndex;
jvanverth633b3562016-03-23 11:01:22 -0700290
291 // Created by GrVkGpu
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400292 GrVkResourceProvider fResourceProvider;
Greg Daniel164a9f02016-02-22 09:56:40 -0500293
Ethan Nicholas8e265a72018-12-12 16:22:40 -0500294 GrVkCommandPool* fCmdPool;
295
296 // just a raw pointer; object's lifespan is managed by fCmdPool
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400297 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer;
jvanverth6b6ffc42016-06-13 14:28:07 -0700298
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400299 SkSTArray<1, GrVkSemaphore::Resource*> fSemaphoresToWaitOn;
300 SkSTArray<1, GrVkSemaphore::Resource*> fSemaphoresToSignal;
Greg Daniel6be35232017-03-01 17:01:09 -0500301
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400302 SkTArray<std::unique_ptr<SkDrawable::GpuDrawHandler>> fDrawables;
Greg Daniel6be35232017-03-01 17:01:09 -0500303
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400304 VkPhysicalDeviceProperties fPhysDevProps;
305 VkPhysicalDeviceMemoryProperties fPhysDevMemProps;
306
Ethan Nicholas941e7e22016-12-12 15:33:30 -0500307 // compiler used for compiling sksl into spirv. We only want to create the compiler once since
308 // there is significant overhead to the first compile of any compiler.
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400309 SkSL::Compiler* fCompiler;
Greg Daniel164a9f02016-02-22 09:56:40 -0500310
Greg Daniel8606cf82017-05-08 16:17:53 -0400311 // We need a bool to track whether or not we've already disconnected all the gpu resources from
312 // vulkan context.
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400313 bool fDisconnected;
Greg Daniel8606cf82017-05-08 16:17:53 -0400314
Emircan Uysaler23ca4e72019-06-24 10:53:09 -0400315 GrProtected fProtectedContext;
316
Greg Daniel2d41d0d2019-08-26 11:08:51 -0400317 std::unique_ptr<GrVkOpsRenderPass> fCachedOpsRenderPass;
Robert Phillips5b5d84c2018-08-09 15:12:18 -0400318
Greg Daniel164a9f02016-02-22 09:56:40 -0500319 typedef GrGpu INHERITED;
320};
321
322#endif