Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 GrVkResourceProvider_DEFINED |
| 9 | #define GrVkResourceProvider_DEFINED |
| 10 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/gpu/vk/GrVkTypes.h" |
| 12 | #include "include/private/SkTArray.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "src/core/SkLRUCache.h" |
| 14 | #include "src/core/SkTDynamicHash.h" |
Ben Wagner | 729a23f | 2019-05-17 16:29:34 -0400 | [diff] [blame] | 15 | #include "src/core/SkTInternalLList.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 16 | #include "src/gpu/GrResourceHandle.h" |
| 17 | #include "src/gpu/vk/GrVkDescriptorPool.h" |
| 18 | #include "src/gpu/vk/GrVkDescriptorSetManager.h" |
| 19 | #include "src/gpu/vk/GrVkPipelineStateBuilder.h" |
| 20 | #include "src/gpu/vk/GrVkRenderPass.h" |
| 21 | #include "src/gpu/vk/GrVkResource.h" |
| 22 | #include "src/gpu/vk/GrVkSampler.h" |
| 23 | #include "src/gpu/vk/GrVkSamplerYcbcrConversion.h" |
| 24 | #include "src/gpu/vk/GrVkUtil.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 25 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 26 | #include <mutex> |
| 27 | #include <thread> |
| 28 | |
| 29 | class GrVkCommandPool; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 30 | class GrVkGpu; |
| 31 | class GrVkPipeline; |
Brian Salomon | 1471df9 | 2018-06-08 10:49:00 -0400 | [diff] [blame] | 32 | class GrVkPipelineState; |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 33 | class GrVkPrimaryCommandBuffer; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 34 | class GrVkRenderTarget; |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 35 | class GrVkSecondaryCommandBuffer; |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 36 | class GrVkUniformHandler; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 37 | |
| 38 | class GrVkResourceProvider { |
| 39 | public: |
| 40 | GrVkResourceProvider(GrVkGpu* gpu); |
| 41 | ~GrVkResourceProvider(); |
| 42 | |
jvanverth | 03509ea | 2016-03-02 13:19:47 -0800 | [diff] [blame] | 43 | // Set up any initial vk objects |
| 44 | void init(); |
| 45 | |
Robert Phillips | d0fe875 | 2019-01-31 14:13:59 -0500 | [diff] [blame] | 46 | GrVkPipeline* createPipeline(int numColorSamples, |
| 47 | const GrPrimitiveProcessor& primProc, |
Brian Salomon | ff168d9 | 2018-06-23 15:17:27 -0400 | [diff] [blame] | 48 | const GrPipeline& pipeline, |
csmartdalton | c633abb | 2016-11-01 08:55:55 -0700 | [diff] [blame] | 49 | const GrStencilSettings& stencil, |
Chris Dalton | 71713f6 | 2019-04-18 12:41:03 -0600 | [diff] [blame] | 50 | GrSurfaceOrigin, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 51 | VkPipelineShaderStageCreateInfo* shaderStageInfo, |
| 52 | int shaderStageCount, |
| 53 | GrPrimitiveType primitiveType, |
Greg Daniel | 99b88e0 | 2018-10-03 15:31:20 -0400 | [diff] [blame] | 54 | VkRenderPass compatibleRenderPass, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 55 | VkPipelineLayout layout); |
| 56 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 57 | GR_DEFINE_RESOURCE_HANDLE_CLASS(CompatibleRPHandle); |
| 58 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 59 | // Finds or creates a simple render pass that matches the target, increments the refcount, |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 60 | // and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. If this is |
| 61 | // non null it will be set to a handle that can be used in the furutre to quickly return a |
| 62 | // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarget. |
| 63 | const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& target, |
| 64 | CompatibleRPHandle* compatibleHandle = nullptr); |
| 65 | // The CompatibleRPHandle must be a valid handle previously set by a call to |
| 66 | // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*). |
| 67 | const GrVkRenderPass* findCompatibleRenderPass(const CompatibleRPHandle& compatibleHandle); |
| 68 | |
Greg Daniel | b46add8 | 2019-01-02 14:51:29 -0500 | [diff] [blame] | 69 | const GrVkRenderPass* findCompatibleExternalRenderPass(VkRenderPass, |
| 70 | uint32_t colorAttachmentIndex); |
| 71 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 72 | // Finds or creates a render pass that matches the target and LoadStoreOps, increments the |
| 73 | // refcount, and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. |
| 74 | // If this is non null it will be set to a handle that can be used in the furutre to quickly |
| 75 | // return a GrVkRenderPasses without the need inspecting a GrVkRenderTarget. |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 76 | const GrVkRenderPass* findRenderPass(const GrVkRenderTarget& target, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 77 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 78 | const GrVkRenderPass::LoadStoreOps& stencilOps, |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 79 | CompatibleRPHandle* compatibleHandle = nullptr); |
| 80 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 81 | // The CompatibleRPHandle must be a valid handle previously set by a call to findRenderPass or |
| 82 | // findCompatibleRenderPass. |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 83 | const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHandle, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 84 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 85 | const GrVkRenderPass::LoadStoreOps& stencilOps); |
| 86 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 87 | GrVkCommandPool* findOrCreateCommandPool(); |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 88 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 89 | void checkCommandBuffers(); |
Ethan Nicholas | bff4e07 | 2018-12-12 18:17:24 +0000 | [diff] [blame] | 90 | |
Greg Daniel | a3aa75a | 2019-04-12 14:24:55 -0400 | [diff] [blame] | 91 | // We must add the finishedProc to all active command buffers since we may have flushed work |
| 92 | // that the client cares about before they explicitly called flush and the GPU may reorder |
| 93 | // command execution. So we make sure all previously submitted work finishes before we call the |
| 94 | // finishedProc. |
| 95 | void addFinishedProcToActiveCommandBuffers(GrGpuFinishedProc finishedProc, |
| 96 | GrGpuFinishedContext finishedContext); |
| 97 | |
egdaniel | c2dc1b2 | 2016-03-18 13:18:23 -0700 | [diff] [blame] | 98 | // Finds or creates a compatible GrVkDescriptorPool for the requested type and count. |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 99 | // The refcount is incremented and a pointer returned. |
| 100 | // TODO: Currently this will just create a descriptor pool without holding onto a ref itself |
| 101 | // so we currently do not reuse them. Rquires knowing if another draw is currently using |
| 102 | // the GrVkDescriptorPool, the ability to reset pools, and the ability to purge pools out |
| 103 | // of our cache of GrVkDescriptorPools. |
egdaniel | c2dc1b2 | 2016-03-18 13:18:23 -0700 | [diff] [blame] | 104 | GrVkDescriptorPool* findOrCreateCompatibleDescriptorPool(VkDescriptorType type, uint32_t count); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 105 | |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 106 | // Finds or creates a compatible GrVkSampler based on the GrSamplerState and |
| 107 | // GrVkYcbcrConversionInfo. The refcount is incremented and a pointer returned. |
| 108 | GrVkSampler* findOrCreateCompatibleSampler(const GrSamplerState&, |
| 109 | const GrVkYcbcrConversionInfo& ycbcrInfo); |
| 110 | |
| 111 | // Finds or creates a compatible GrVkSamplerYcbcrConversion based on the GrSamplerState and |
| 112 | // GrVkYcbcrConversionInfo. The refcount is incremented and a pointer returned. |
| 113 | GrVkSamplerYcbcrConversion* findOrCreateCompatibleSamplerYcbcrConversion( |
| 114 | const GrVkYcbcrConversionInfo& ycbcrInfo); |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 115 | |
Greg Daniel | 9a51a86 | 2018-11-30 10:18:14 -0500 | [diff] [blame] | 116 | GrVkPipelineState* findOrCreateCompatiblePipelineState( |
Robert Phillips | d0fe875 | 2019-01-31 14:13:59 -0500 | [diff] [blame] | 117 | GrRenderTarget*, GrSurfaceOrigin, |
Greg Daniel | 9a51a86 | 2018-11-30 10:18:14 -0500 | [diff] [blame] | 118 | const GrPipeline&, |
| 119 | const GrPrimitiveProcessor&, |
| 120 | const GrTextureProxy* const primProcProxies[], |
| 121 | GrPrimitiveType, |
| 122 | VkRenderPass compatibleRenderPass); |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 123 | |
Greg Daniel | a754378 | 2017-05-02 14:01:43 -0400 | [diff] [blame] | 124 | void getSamplerDescriptorSetHandle(VkDescriptorType type, |
| 125 | const GrVkUniformHandler&, |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 126 | GrVkDescriptorSetManager::Handle* handle); |
Greg Daniel | a754378 | 2017-05-02 14:01:43 -0400 | [diff] [blame] | 127 | void getSamplerDescriptorSetHandle(VkDescriptorType type, |
| 128 | const SkTArray<uint32_t>& visibilities, |
egdaniel | 4d866df | 2016-08-25 13:52:00 -0700 | [diff] [blame] | 129 | GrVkDescriptorSetManager::Handle* handle); |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 130 | |
| 131 | // Returns the compatible VkDescriptorSetLayout to use for uniform buffers. The caller does not |
| 132 | // own the VkDescriptorSetLayout and thus should not delete it. This function should be used |
| 133 | // when the caller needs the layout to create a VkPipelineLayout. |
| 134 | VkDescriptorSetLayout getUniformDSLayout() const; |
| 135 | |
| 136 | // Returns the compatible VkDescriptorSetLayout to use for a specific sampler handle. The caller |
| 137 | // does not own the VkDescriptorSetLayout and thus should not delete it. This function should be |
| 138 | // used when the caller needs the layout to create a VkPipelineLayout. |
| 139 | VkDescriptorSetLayout getSamplerDSLayout(const GrVkDescriptorSetManager::Handle&) const; |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 140 | |
| 141 | // Returns a GrVkDescriptorSet that can be used for uniform buffers. The GrVkDescriptorSet |
| 142 | // is already reffed for the caller. |
| 143 | const GrVkDescriptorSet* getUniformDescriptorSet(); |
| 144 | |
| 145 | // Returns a GrVkDescriptorSet that can be used for sampler descriptors that are compatible with |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 146 | // the GrVkDescriptorSetManager::Handle passed in. The GrVkDescriptorSet is already reffed for |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 147 | // the caller. |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 148 | const GrVkDescriptorSet* getSamplerDescriptorSet(const GrVkDescriptorSetManager::Handle&); |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 149 | |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 150 | |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 151 | // Signals that the descriptor set passed it, which is compatible with the passed in handle, |
| 152 | // can be reused by the next allocation request. |
| 153 | void recycleDescriptorSet(const GrVkDescriptorSet* descSet, |
| 154 | const GrVkDescriptorSetManager::Handle&); |
| 155 | |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 156 | // Creates or finds free uniform buffer resources of size GrVkUniformBuffer::kStandardSize. |
| 157 | // Anything larger will need to be created and released by the client. |
| 158 | const GrVkResource* findOrCreateStandardUniformBufferResource(); |
| 159 | |
| 160 | // Signals that the resource passed to it (which should be a uniform buffer resource) |
| 161 | // can be reused by the next uniform buffer resource request. |
| 162 | void recycleStandardUniformBufferResource(const GrVkResource*); |
| 163 | |
Greg Daniel | a870b46 | 2019-01-08 15:49:46 -0500 | [diff] [blame] | 164 | void storePipelineCacheData(); |
| 165 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 166 | // Destroy any cached resources. To be called before destroying the VkDevice. |
| 167 | // The assumption is that all queues are idle and all command buffers are finished. |
| 168 | // For resource tracing to work properly, this should be called after unrefing all other |
| 169 | // resource usages. |
Jim Van Verth | 09557d7 | 2016-11-07 11:10:21 -0500 | [diff] [blame] | 170 | // If deviceLost is true, then resources will not be checked to see if they've finished |
| 171 | // before deleting (see section 4.2.4 of the Vulkan spec). |
| 172 | void destroyResources(bool deviceLost); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 173 | |
| 174 | // Abandon any cached resources. To be used when the context/VkDevice is lost. |
| 175 | // For resource tracing to work properly, this should be called after unrefing all other |
| 176 | // resource usages. |
| 177 | void abandonResources(); |
| 178 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 179 | void backgroundReset(GrVkCommandPool* pool); |
| 180 | |
| 181 | void reset(GrVkCommandPool* pool); |
| 182 | |
Brian Osman | fd7657c | 2019-04-25 11:34:07 -0400 | [diff] [blame] | 183 | #if GR_TEST_UTILS |
| 184 | void resetShaderCacheForTesting() const { fPipelineStateCache->release(); } |
| 185 | #endif |
| 186 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 187 | private: |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 188 | |
djsollen | efe46d2 | 2016-04-29 06:41:35 -0700 | [diff] [blame] | 189 | #ifdef SK_DEBUG |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 190 | #define GR_PIPELINE_STATE_CACHE_STATS |
| 191 | #endif |
| 192 | |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 193 | class PipelineStateCache : public ::SkNoncopyable { |
| 194 | public: |
| 195 | PipelineStateCache(GrVkGpu* gpu); |
| 196 | ~PipelineStateCache(); |
| 197 | |
| 198 | void abandon(); |
| 199 | void release(); |
Robert Phillips | d0fe875 | 2019-01-31 14:13:59 -0500 | [diff] [blame] | 200 | GrVkPipelineState* refPipelineState(GrRenderTarget*, GrSurfaceOrigin, |
| 201 | const GrPrimitiveProcessor&, |
Greg Daniel | 9a51a86 | 2018-11-30 10:18:14 -0500 | [diff] [blame] | 202 | const GrTextureProxy* const primProcProxies[], |
Brian Salomon | ff168d9 | 2018-06-23 15:17:27 -0400 | [diff] [blame] | 203 | const GrPipeline&, |
Greg Daniel | 09eeefb | 2017-10-16 15:15:02 -0400 | [diff] [blame] | 204 | GrPrimitiveType, |
Greg Daniel | 99b88e0 | 2018-10-03 15:31:20 -0400 | [diff] [blame] | 205 | VkRenderPass compatibleRenderPass); |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 206 | |
| 207 | private: |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 208 | struct Entry; |
| 209 | |
Ethan Nicholas | 87f340e | 2017-01-03 14:32:01 -0500 | [diff] [blame] | 210 | struct DescHash { |
| 211 | uint32_t operator()(const GrProgramDesc& desc) const { |
| 212 | return SkOpts::hash_fn(desc.asKey(), desc.keyLength(), 0); |
| 213 | } |
| 214 | }; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 215 | |
Brian Salomon | 1471df9 | 2018-06-08 10:49:00 -0400 | [diff] [blame] | 216 | SkLRUCache<const GrVkPipelineStateBuilder::Desc, std::unique_ptr<Entry>, DescHash> fMap; |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 217 | |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 218 | GrVkGpu* fGpu; |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 219 | |
| 220 | #ifdef GR_PIPELINE_STATE_CACHE_STATS |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 221 | int fTotalRequests; |
| 222 | int fCacheMisses; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 223 | #endif |
| 224 | }; |
| 225 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 226 | class CompatibleRenderPassSet { |
| 227 | public: |
| 228 | // This will always construct the basic load store render pass (all attachments load and |
| 229 | // store their data) so that there is at least one compatible VkRenderPass that can be used |
| 230 | // with this set. |
| 231 | CompatibleRenderPassSet(const GrVkGpu* gpu, const GrVkRenderTarget& target); |
| 232 | |
| 233 | bool isCompatible(const GrVkRenderTarget& target) const; |
| 234 | |
| 235 | GrVkRenderPass* getCompatibleRenderPass() const { |
| 236 | // The first GrVkRenderpass should always exist since we create the basic load store |
| 237 | // render pass on create |
| 238 | SkASSERT(fRenderPasses[0]); |
| 239 | return fRenderPasses[0]; |
| 240 | } |
| 241 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 242 | GrVkRenderPass* getRenderPass(const GrVkGpu* gpu, |
| 243 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 244 | const GrVkRenderPass::LoadStoreOps& stencilOps); |
| 245 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 246 | void releaseResources(GrVkGpu* gpu); |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 247 | void abandonResources(); |
| 248 | |
| 249 | private: |
| 250 | SkSTArray<4, GrVkRenderPass*> fRenderPasses; |
| 251 | int fLastReturnedIndex; |
| 252 | }; |
| 253 | |
Greg Daniel | a870b46 | 2019-01-08 15:49:46 -0500 | [diff] [blame] | 254 | VkPipelineCache pipelineCache(); |
| 255 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 256 | GrVkGpu* fGpu; |
| 257 | |
jvanverth | 03509ea | 2016-03-02 13:19:47 -0800 | [diff] [blame] | 258 | // Central cache for creating pipelines |
| 259 | VkPipelineCache fPipelineCache; |
| 260 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 261 | SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 262 | |
Greg Daniel | b46add8 | 2019-01-02 14:51:29 -0500 | [diff] [blame] | 263 | SkTArray<const GrVkRenderPass*> fExternalRenderPasses; |
| 264 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 265 | // Array of command pools that we are waiting on |
| 266 | SkSTArray<4, GrVkCommandPool*, true> fActiveCommandPools; |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 267 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 268 | // Array of available command pools that are not in flight |
| 269 | SkSTArray<4, GrVkCommandPool*, true> fAvailableCommandPools; |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 270 | |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 271 | // Array of available uniform buffer resources |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 272 | SkSTArray<16, const GrVkResource*, true> fAvailableUniformBufferResources; |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 273 | |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 274 | // Stores GrVkSampler objects that we've already created so we can reuse them across multiple |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 275 | // GrVkPipelineStates |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 276 | SkTDynamicHash<GrVkSampler, GrVkSampler::Key> fSamplers; |
| 277 | |
| 278 | // Stores GrVkSamplerYcbcrConversion objects that we've already created so we can reuse them. |
| 279 | SkTDynamicHash<GrVkSamplerYcbcrConversion, GrVkSamplerYcbcrConversion::Key> fYcbcrConversions; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 280 | |
| 281 | // Cache of GrVkPipelineStates |
| 282 | PipelineStateCache* fPipelineStateCache; |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 283 | |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 284 | SkSTArray<4, std::unique_ptr<GrVkDescriptorSetManager>> fDescriptorSetManagers; |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 285 | |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 286 | GrVkDescriptorSetManager::Handle fUniformDSHandle; |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 287 | |
| 288 | std::recursive_mutex fBackgroundMutex; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 289 | }; |
| 290 | |
| 291 | #endif |