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