blob: e91fa87542b948856ea1d593922fd71f0bb577d7 [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;
Robert Phillips5b5d84c2018-08-09 15:12:18 -040026class GrVkGpuRTCommandBuffer;
27class GrVkGpuTextureCommandBuffer;
Greg Daniel81df0412018-05-31 13:13:33 -040028class GrVkMemoryAllocator;
Greg Daniel164a9f02016-02-22 09:56:40 -050029class GrVkPipeline;
egdaniel22281c12016-03-23 13:49:40 -070030class GrVkPipelineState;
egdaniel066df7c2016-06-08 14:02:27 -070031class GrVkPrimaryCommandBuffer;
Greg Daniel164a9f02016-02-22 09:56:40 -050032class GrVkRenderPass;
egdaniel066df7c2016-06-08 14:02:27 -070033class GrVkSecondaryCommandBuffer;
Greg Daniel164a9f02016-02-22 09:56:40 -050034class GrVkTexture;
35struct GrVkInterface;
36
Ethan Nicholas941e7e22016-12-12 15:33:30 -050037namespace SkSL {
38 class Compiler;
39}
40
Greg Daniel164a9f02016-02-22 09:56:40 -050041class GrVkGpu : public GrGpu {
42public:
Greg Danielf730c182018-07-02 20:15:37 +000043 static sk_sp<GrGpu> Make(const GrVkBackendContext&, const GrContextOptions&, GrContext*);
jvanverth633b3562016-03-23 11:01:22 -070044
Greg Daniel164a9f02016-02-22 09:56:40 -050045 ~GrVkGpu() override;
46
Greg Daniel8606cf82017-05-08 16:17:53 -040047 void disconnect(DisconnectType) override;
48
Greg Danielf730c182018-07-02 20:15:37 +000049 const GrVkInterface* vkInterface() const { return fInterface.get(); }
Greg Daniel164a9f02016-02-22 09:56:40 -050050 const GrVkCaps& vkCaps() const { return *fVkCaps; }
51
Greg Daniel81df0412018-05-31 13:13:33 -040052 GrVkMemoryAllocator* memoryAllocator() const { return fMemoryAllocator.get(); }
53
Greg Daniel637c06a2018-09-12 09:44:25 -040054 VkPhysicalDevice physicalDevice() const { return fPhysicalDevice; }
Greg Daniel164a9f02016-02-22 09:56:40 -050055 VkDevice device() const { return fDevice; }
56 VkQueue queue() const { return fQueue; }
Greg Danielecddbc02018-08-30 16:39:34 -040057 uint32_t queueIndex() const { return fQueueIndex; }
Ethan Nicholas8e265a72018-12-12 16:22:40 -050058 GrVkCommandPool* cmdPool() const { return fCmdPool; }
Greg Daniela870b462019-01-08 15:49:46 -050059 const VkPhysicalDeviceProperties& physicalDeviceProperties() const {
Greg Daniel8385a8a2018-02-26 13:29:37 -050060 return fPhysDevProps;
61 }
Greg Daniela870b462019-01-08 15:49:46 -050062 const VkPhysicalDeviceMemoryProperties& physicalDeviceMemoryProperties() const {
Greg Daniel164a9f02016-02-22 09:56:40 -050063 return fPhysDevMemProps;
64 }
Emircan Uysaler23ca4e72019-06-24 10:53:09 -040065 bool protectedContext() const { return fProtectedContext == GrProtected::kYes; }
Greg Daniel164a9f02016-02-22 09:56:40 -050066
egdanielbc9b2962016-09-27 08:00:53 -070067 GrVkResourceProvider& resourceProvider() { return fResourceProvider; }
68
69 GrVkPrimaryCommandBuffer* currentCommandBuffer() { return fCurrentCmdBuffer; }
Greg Daniel164a9f02016-02-22 09:56:40 -050070
71 enum SyncQueue {
72 kForce_SyncQueue,
73 kSkip_SyncQueue
74 };
75
Chris Dalton8c4cafd2019-04-15 19:14:36 -060076 void querySampleLocations(GrRenderTarget*, SkTArray<SkPoint>*) override {
Chris Daltond7291ba2019-03-07 14:17:03 -070077 SkASSERT(!this->caps()->sampleLocationsSupport());
78 SK_ABORT("Sample locations not yet implemented for Vulkan.");
79 }
80
Greg Daniel164a9f02016-02-22 09:56:40 -050081 void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {}
82
Robert Phillipsf0313ee2019-05-21 13:51:11 -040083 GrBackendTexture createBackendTexture(int w, int h, const GrBackendFormat&,
84 GrMipMapped, GrRenderable,
Robert Phillips459b2952019-05-23 09:38:27 -040085 const void* pixels, size_t rowBytes,
Emircan Uysaler23ca4e72019-06-24 10:53:09 -040086 const SkColor4f* color,
87 GrProtected isProtected) override;
Robert Phillipsf0313ee2019-05-21 13:51:11 -040088 void deleteBackendTexture(const GrBackendTexture&) override;
Robert Phillipsf0ced622019-05-16 09:06:25 -040089#if GR_TEST_UTILS
90 bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
Greg Daniel164a9f02016-02-22 09:56:40 -050091
Brian Osman2d010b62018-08-09 10:55:09 -040092 GrBackendRenderTarget createTestingOnlyBackendRenderTarget(int w, int h, GrColorType) override;
Brian Salomonf865b052018-03-09 09:01:53 -050093 void deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) override;
94
Greg Daniel26b50a42018-03-08 09:49:58 -050095 void testingOnly_flushGpuAndSync() override;
Brian Osmanfd7657c2019-04-25 11:34:07 -040096
97 void resetShaderCacheForTesting() const override {
98 fResourceProvider.resetShaderCacheForTesting();
99 }
Brian Salomonf865b052018-03-09 09:01:53 -0500100#endif
Greg Daniel26b50a42018-03-08 09:49:58 -0500101
Chris Daltoneffee202019-07-01 22:28:03 -0600102 GrStencilAttachment* createStencilAttachmentForRenderTarget(
103 const GrRenderTarget*, int width, int height, int numStencilSamples) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500104
Robert Phillips5b5d84c2018-08-09 15:12:18 -0400105 GrGpuRTCommandBuffer* getCommandBuffer(
Ethan Nicholas56d19a52018-10-15 11:26:20 -0400106 GrRenderTarget*, GrSurfaceOrigin, const SkRect&,
Greg Daniel500d58b2017-08-24 15:59:33 -0400107 const GrGpuRTCommandBuffer::LoadAndStoreInfo&,
108 const GrGpuRTCommandBuffer::StencilLoadAndStoreInfo&) override;
109
Robert Phillips5b5d84c2018-08-09 15:12:18 -0400110 GrGpuTextureCommandBuffer* getCommandBuffer(GrTexture*, GrSurfaceOrigin) override;
111
egdaniel066df7c2016-06-08 14:02:27 -0700112
Greg Daniel59dc1482019-02-22 10:46:38 -0500113 void addBufferMemoryBarrier(const GrVkResource*,
114 VkPipelineStageFlags srcStageMask,
Greg Daniel164a9f02016-02-22 09:56:40 -0500115 VkPipelineStageFlags dstStageMask,
116 bool byRegion,
117 VkBufferMemoryBarrier* barrier) const;
Greg Daniel59dc1482019-02-22 10:46:38 -0500118 void addImageMemoryBarrier(const GrVkResource*,
119 VkPipelineStageFlags srcStageMask,
Greg Daniel164a9f02016-02-22 09:56:40 -0500120 VkPipelineStageFlags dstStageMask,
121 bool byRegion,
122 VkImageMemoryBarrier* barrier) const;
halcanary9d524f22016-03-29 09:03:52 -0700123
ethannicholasb3058bd2016-07-01 08:22:01 -0700124 SkSL::Compiler* shaderCompiler() const {
125 return fCompiler;
126 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500127
Brian Salomon930f9392018-06-20 16:25:26 -0400128 bool onRegenerateMipMapLevels(GrTexture* tex) override;
129
Greg Daniel0a77f432018-12-06 11:23:32 -0500130 void resolveRenderTargetNoFlush(GrRenderTarget* target) {
131 this->internalResolveRenderTarget(target, false);
132 }
133
Brian Salomon1fabd512018-02-09 09:54:25 -0500134 void onResolveRenderTarget(GrRenderTarget* target) override {
Greg Daniel0a77f432018-12-06 11:23:32 -0500135 // This resolve is called when we are preparing an msaa surface for external I/O. It is
136 // called after flushing, so we need to make sure we submit the command buffer after doing
137 // the resolve so that the resolve actually happens.
Brian Salomon1fabd512018-02-09 09:54:25 -0500138 this->internalResolveRenderTarget(target, true);
Greg Daniel69d49922017-02-23 09:44:02 -0500139 }
egdaniel66933552016-08-24 07:22:19 -0700140
Greg Daniel8daf3b72019-07-30 09:57:26 -0400141 void submitSecondaryCommandBuffer(SkTArray<std::unique_ptr<GrVkSecondaryCommandBuffer>>&,
egdaniel9cb63402016-06-23 08:37:05 -0700142 const GrVkRenderPass*,
Robert Phillips8c326e92017-08-10 13:50:17 -0400143 const VkClearValue* colorClear,
Robert Phillipsb0e93a22017-08-29 08:26:54 -0400144 GrVkRenderTarget*, GrSurfaceOrigin,
egdaniel9cb63402016-06-23 08:37:05 -0700145 const SkIRect& bounds);
egdaniel066df7c2016-06-08 14:02:27 -0700146
Robert Phillips5b5d84c2018-08-09 15:12:18 -0400147 void submit(GrGpuCommandBuffer*) override;
148
Greg Daniel6be35232017-03-01 17:01:09 -0500149 GrFence SK_WARN_UNUSED_RESULT insertFence() override;
150 bool waitFence(GrFence, uint64_t timeout) override;
jvanverth84741b32016-09-30 08:39:02 -0700151 void deleteFence(GrFence) const override;
152
Greg Daniela5cb7812017-06-16 09:45:32 -0400153 sk_sp<GrSemaphore> SK_WARN_UNUSED_RESULT makeSemaphore(bool isOwned) override;
Greg Daniel48661b82018-01-22 16:11:35 -0500154 sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore,
155 GrResourceProvider::SemaphoreWrapType wrapType,
156 GrWrapOwnership ownership) override;
Greg Daniel858e12c2018-12-06 11:11:37 -0500157 void insertSemaphore(sk_sp<GrSemaphore> semaphore) override;
Greg Daniel48661b82018-01-22 16:11:35 -0500158 void waitSemaphore(sk_sp<GrSemaphore> semaphore) override;
159
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400160 // These match the definitions in SkDrawable, from whence they came
161 typedef void* SubmitContext;
162 typedef void (*SubmitProc)(SubmitContext submitContext);
163
164 // Adds an SkDrawable::GpuDrawHandler that we will delete the next time we submit the primary
165 // command buffer to the gpu.
166 void addDrawable(std::unique_ptr<SkDrawable::GpuDrawHandler> drawable);
167
Brian Salomonb0d8b762019-05-06 16:58:22 -0400168 void checkFinishProcs() override { fResourceProvider.checkCommandBuffers(); }
169
Brian Osman13dddce2017-05-09 13:19:50 -0400170 sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override;
171
Greg Daniel6888c0d2017-08-25 11:55:50 -0400172 void copyBuffer(GrVkBuffer* srcBuffer, GrVkBuffer* dstBuffer, VkDeviceSize srcOffset,
173 VkDeviceSize dstOffset, VkDeviceSize size);
jvanverthdb379092016-07-07 11:18:46 -0700174 bool updateBuffer(GrVkBuffer* buffer, const void* src, VkDeviceSize offset, VkDeviceSize size);
jvanvertha584de92016-06-30 09:10:52 -0700175
Greg Daniel7a82edf2018-12-04 10:54:34 -0500176 uint32_t getExtraSamplerKeyForProgram(const GrSamplerState&,
177 const GrBackendFormat& format) override;
178
Greg Daniela870b462019-01-08 15:49:46 -0500179 enum PersistentCacheKeyType : uint32_t {
180 kShader_PersistentCacheKeyType = 0,
181 kPipelineCache_PersistentCacheKeyType = 1,
182 };
183
184 void storeVkPipelineCacheData() override;
185
Greg Daniel164a9f02016-02-22 09:56:40 -0500186private:
Greg Daniel98bffae2018-08-01 13:25:41 -0400187 GrVkGpu(GrContext*, const GrContextOptions&, const GrVkBackendContext&,
Greg Daniel41f0e282019-01-28 13:15:05 -0500188 sk_sp<const GrVkInterface>, uint32_t instanceVersion, uint32_t physicalDeviceVersion);
jvanverth633b3562016-03-23 11:01:22 -0700189
egdanielcfcd1812016-03-22 07:16:10 -0700190 void onResetContext(uint32_t resetBits) override {}
Greg Daniel164a9f02016-02-22 09:56:40 -0500191
Greg Daniel8606cf82017-05-08 16:17:53 -0400192 void destroyResources();
193
Brian Salomon27b4d8d2019-07-22 14:23:45 -0400194 sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, GrRenderable, int renderTargetSampleCnt,
195 SkBudgeted, GrProtected, const GrMipLevel[],
196 int mipLevelCount) override;
Brian Salomonbb8dde82019-06-27 10:52:13 -0400197 sk_sp<GrTexture> onCreateCompressedTexture(int width, int height, SkImage::CompressionType,
198 SkBudgeted, const void* data) 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;
Brian Salomond17f6582017-07-19 18:28:58 -0400202 sk_sp<GrTexture> onWrapRenderableBackendTexture(const GrBackendTexture&,
Brian Salomond17f6582017-07-19 18:28:58 -0400203 int sampleCnt,
Robert Phillips0902c982019-07-16 07:47:56 -0400204 GrColorType colorType,
Brian Salomonaa6ca0a2019-01-24 16:03:07 -0500205 GrWrapOwnership,
206 GrWrapCacheable) override;
Robert Phillipsc80b0e92019-07-23 10:27:09 -0400207 sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&,
208 GrColorType) override;
Greg Daniel7ef28f32017-04-20 16:41:55 +0000209
210 sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&,
Robert Phillipsc80b0e92019-07-23 10:27:09 -0400211 int sampleCnt, GrColorType) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500212
Greg Danielb46add82019-01-02 14:51:29 -0500213 sk_sp<GrRenderTarget> onWrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
214 const GrVkDrawableInfo&) override;
215
Brian Salomondbf70722019-02-07 11:31:24 -0500216 sk_sp<GrGpuBuffer> onCreateBuffer(size_t size, GrGpuBufferType type, GrAccessPattern,
217 const void* data) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500218
Brian Salomonf77c1462019-08-01 15:19:29 -0400219 bool onReadPixels(GrSurface* surface, int left, int top, int width, int height,
220 GrColorType surfaceColorType, GrColorType dstColorType, void* buffer,
221 size_t rowBytes) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500222
Brian Salomonf77c1462019-08-01 15:19:29 -0400223 bool onWritePixels(GrSurface* surface, int left, int top, int width, int height,
224 GrColorType surfaceColorType, GrColorType srcColorType,
Brian Salomona9b04b92018-06-01 15:04:28 -0400225 const GrMipLevel texels[], int mipLevelCount) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500226
Brian Salomonf77c1462019-08-01 15:19:29 -0400227 bool onTransferPixelsTo(GrTexture*, int left, int top, int width, int height,
228 GrColorType textureColorType, GrColorType bufferColorType,
Brian Salomone05ba5a2019-04-08 11:59:07 -0400229 GrGpuBuffer* transferBuffer, size_t offset, size_t rowBytes) override;
Brian Salomon26de56e2019-04-10 12:14:26 -0400230 bool onTransferPixelsFrom(GrSurface* surface, int left, int top, int width, int height,
Brian Salomonf77c1462019-08-01 15:19:29 -0400231 GrColorType surfaceColorType, GrColorType bufferColorType,
232 GrGpuBuffer* transferBuffer, size_t offset) override;
Greg Daniel164a9f02016-02-22 09:56:40 -0500233
Greg Daniel46cfbc62019-06-07 11:43:30 -0400234 bool onCopySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
Greg Daniel55fa6472018-03-16 16:13:10 -0400235 const SkIPoint& dstPoint, bool canDiscardOutsideDstRect) override;
Brian Salomon9b009bb2018-02-14 13:53:55 -0500236
Brian Salomonf9a1fdf2019-05-09 10:30:12 -0400237 void onFinishFlush(GrSurfaceProxy*[], int, SkSurface::BackendSurfaceAccess access,
Greg Daniel797efca2019-05-09 14:04:20 -0400238 const GrFlushInfo&, const GrPrepareForExternalIORequests&) override;
Greg Daniel51316782017-08-02 15:10:09 +0000239
Greg Daniel164a9f02016-02-22 09:56:40 -0500240 // Ends and submits the current command buffer to the queue and then creates a new command
halcanary9d524f22016-03-29 09:03:52 -0700241 // buffer and begins it. If sync is set to kForce_SyncQueue, the function will wait for all
Greg Daniela5cb7812017-06-16 09:45:32 -0400242 // work in the queue to finish before returning. If this GrVkGpu object has any semaphores in
243 // fSemaphoreToSignal, we will add those signal semaphores to the submission of this command
244 // buffer. If this GrVkGpu object has any semaphores in fSemaphoresToWaitOn, we will add those
245 // wait semaphores to the submission of this command buffer.
Greg Daniela3aa75a2019-04-12 14:24:55 -0400246 void submitCommandBuffer(SyncQueue sync, GrGpuFinishedProc finishedProc = nullptr,
247 GrGpuFinishedContext finishedContext = nullptr);
Greg Daniel164a9f02016-02-22 09:56:40 -0500248
Brian Salomon1fabd512018-02-09 09:54:25 -0500249 void internalResolveRenderTarget(GrRenderTarget*, bool requiresSubmit);
Greg Daniel69d49922017-02-23 09:44:02 -0500250
Greg Daniel46cfbc62019-06-07 11:43:30 -0400251 void copySurfaceAsCopyImage(GrSurface* dst, GrSurface* src, GrVkImage* dstImage,
252 GrVkImage* srcImage, const SkIRect& srcRect,
Greg Daniel164a9f02016-02-22 09:56:40 -0500253 const SkIPoint& dstPoint);
254
Greg Daniel46cfbc62019-06-07 11:43:30 -0400255 void copySurfaceAsBlit(GrSurface* dst, GrSurface* src, GrVkImage* dstImage, GrVkImage* srcImage,
256 const SkIRect& srcRect, const SkIPoint& dstPoint);
egdaniel17b89252016-04-05 07:23:38 -0700257
Greg Daniel46cfbc62019-06-07 11:43:30 -0400258 void copySurfaceAsResolve(GrSurface* dst, GrSurface* src, const SkIRect& srcRect,
egdaniel4bcd62e2016-08-31 07:37:31 -0700259 const SkIPoint& dstPoint);
260
jvanverth900bd4a2016-04-29 13:53:12 -0700261 // helpers for onCreateTexture and writeTexturePixels
Brian Salomona9b04b92018-06-01 15:04:28 -0400262 bool uploadTexDataLinear(GrVkTexture* tex, int left, int top, int width, int height,
263 GrColorType colorType, const void* data, size_t rowBytes);
264 bool uploadTexDataOptimal(GrVkTexture* tex, int left, int top, int width, int height,
265 GrColorType colorType, const GrMipLevel texels[], int mipLevelCount);
Jim Van Verth1676cb92019-01-15 13:24:45 -0500266 bool uploadTexDataCompressed(GrVkTexture* tex, int left, int top, int width, int height,
Brian Salomonbb8dde82019-06-27 10:52:13 -0400267 SkImage::CompressionType, const void* data);
Brian Salomon1fabd512018-02-09 09:54:25 -0500268 void resolveImage(GrSurface* dst, GrVkRenderTarget* src, const SkIRect& srcRect,
269 const SkIPoint& dstPoint);
egdaniel4bcd62e2016-08-31 07:37:31 -0700270
Brian Salomonb450f3b2019-07-09 09:36:51 -0400271 bool createVkImageForBackendSurface(VkFormat vkFormat, int w, int h, bool texturable,
272 bool renderable, GrMipMapped mipMapped, const void* srcData,
273 size_t srcRowBytes, const SkColor4f* color,
274 GrVkImageInfo* info, GrProtected isProtected);
Brian Salomon52e943a2018-03-13 09:32:39 -0400275
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400276 sk_sp<const GrVkInterface> fInterface;
277 sk_sp<GrVkMemoryAllocator> fMemoryAllocator;
278 sk_sp<GrVkCaps> fVkCaps;
jvanverth633b3562016-03-23 11:01:22 -0700279
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400280 VkInstance fInstance;
281 VkPhysicalDevice fPhysicalDevice;
282 VkDevice fDevice;
283 VkQueue fQueue; // Must be Graphics queue
284 uint32_t fQueueIndex;
jvanverth633b3562016-03-23 11:01:22 -0700285
286 // Created by GrVkGpu
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400287 GrVkResourceProvider fResourceProvider;
Greg Daniel164a9f02016-02-22 09:56:40 -0500288
Ethan Nicholas8e265a72018-12-12 16:22:40 -0500289 GrVkCommandPool* fCmdPool;
290
291 // just a raw pointer; object's lifespan is managed by fCmdPool
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400292 GrVkPrimaryCommandBuffer* fCurrentCmdBuffer;
jvanverth6b6ffc42016-06-13 14:28:07 -0700293
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400294 SkSTArray<1, GrVkSemaphore::Resource*> fSemaphoresToWaitOn;
295 SkSTArray<1, GrVkSemaphore::Resource*> fSemaphoresToSignal;
Greg Daniel6be35232017-03-01 17:01:09 -0500296
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400297 SkTArray<std::unique_ptr<SkDrawable::GpuDrawHandler>> fDrawables;
Greg Daniel6be35232017-03-01 17:01:09 -0500298
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400299 VkPhysicalDeviceProperties fPhysDevProps;
300 VkPhysicalDeviceMemoryProperties fPhysDevMemProps;
301
Ethan Nicholas941e7e22016-12-12 15:33:30 -0500302 // compiler used for compiling sksl into spirv. We only want to create the compiler once since
303 // there is significant overhead to the first compile of any compiler.
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400304 SkSL::Compiler* fCompiler;
Greg Daniel164a9f02016-02-22 09:56:40 -0500305
Greg Daniel8606cf82017-05-08 16:17:53 -0400306 // We need a bool to track whether or not we've already disconnected all the gpu resources from
307 // vulkan context.
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400308 bool fDisconnected;
Greg Daniel8606cf82017-05-08 16:17:53 -0400309
Emircan Uysaler23ca4e72019-06-24 10:53:09 -0400310 GrProtected fProtectedContext;
311
Greg Daniel64cc9aa2018-10-19 13:54:56 -0400312 std::unique_ptr<GrVkGpuRTCommandBuffer> fCachedRTCommandBuffer;
313 std::unique_ptr<GrVkGpuTextureCommandBuffer> fCachedTexCommandBuffer;
Robert Phillips5b5d84c2018-08-09 15:12:18 -0400314
Greg Daniel164a9f02016-02-22 09:56:40 -0500315 typedef GrGpu INHERITED;
316};
317
318#endif