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 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 11 | #include "GrResourceHandle.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 12 | #include "GrVkDescriptorPool.h" |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 13 | #include "GrVkDescriptorSetManager.h" |
Brian Salomon | 1471df9 | 2018-06-08 10:49:00 -0400 | [diff] [blame] | 14 | #include "GrVkPipelineStateBuilder.h" |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 15 | #include "GrVkRenderPass.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 16 | #include "GrVkResource.h" |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 17 | #include "GrVkSampler.h" |
| 18 | #include "GrVkSamplerYcbcrConversion.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 19 | #include "GrVkUtil.h" |
Ethan Nicholas | 87f340e | 2017-01-03 14:32:01 -0500 | [diff] [blame] | 20 | #include "SkLRUCache.h" |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 21 | #include "SkTArray.h" |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 22 | #include "SkTDynamicHash.h" |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 23 | #include "SkTInternalLList.h" |
Greg Daniel | 487132b | 2018-12-20 14:09:36 -0500 | [diff] [blame] | 24 | #include "vk/GrVkTypes.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; |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 30 | class GrVkCopyPipeline; |
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 | |
Brian Salomon | ff168d9 | 2018-06-23 15:17:27 -0400 | [diff] [blame] | 47 | GrVkPipeline* createPipeline(const GrPrimitiveProcessor& primProc, |
| 48 | const GrPipeline& pipeline, |
csmartdalton | c633abb | 2016-11-01 08:55:55 -0700 | [diff] [blame] | 49 | const GrStencilSettings& stencil, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 50 | VkPipelineShaderStageCreateInfo* shaderStageInfo, |
| 51 | int shaderStageCount, |
| 52 | GrPrimitiveType primitiveType, |
Greg Daniel | 99b88e0 | 2018-10-03 15:31:20 -0400 | [diff] [blame] | 53 | VkRenderPass compatibleRenderPass, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 54 | VkPipelineLayout layout); |
| 55 | |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 56 | GrVkCopyPipeline* findOrCreateCopyPipeline(const GrVkRenderTarget* dst, |
| 57 | VkPipelineShaderStageCreateInfo*, |
| 58 | VkPipelineLayout); |
| 59 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 60 | GR_DEFINE_RESOURCE_HANDLE_CLASS(CompatibleRPHandle); |
| 61 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 62 | // 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] | 63 | // and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. If this is |
| 64 | // non null it will be set to a handle that can be used in the furutre to quickly return a |
| 65 | // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarget. |
| 66 | const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& target, |
| 67 | CompatibleRPHandle* compatibleHandle = nullptr); |
| 68 | // The CompatibleRPHandle must be a valid handle previously set by a call to |
| 69 | // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*). |
| 70 | const GrVkRenderPass* findCompatibleRenderPass(const CompatibleRPHandle& compatibleHandle); |
| 71 | |
Greg Daniel | b46add8 | 2019-01-02 14:51:29 -0500 | [diff] [blame^] | 72 | const GrVkRenderPass* findCompatibleExternalRenderPass(VkRenderPass, |
| 73 | uint32_t colorAttachmentIndex); |
| 74 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 75 | // Finds or creates a render pass that matches the target and LoadStoreOps, increments the |
| 76 | // refcount, and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. |
| 77 | // If this is non null it will be set to a handle that can be used in the furutre to quickly |
| 78 | // return a GrVkRenderPasses without the need inspecting a GrVkRenderTarget. |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 79 | const GrVkRenderPass* findRenderPass(const GrVkRenderTarget& target, |
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, |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 82 | CompatibleRPHandle* compatibleHandle = nullptr); |
| 83 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 84 | // The CompatibleRPHandle must be a valid handle previously set by a call to findRenderPass or |
| 85 | // findCompatibleRenderPass. |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 86 | const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHandle, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 87 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 88 | const GrVkRenderPass::LoadStoreOps& stencilOps); |
| 89 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 90 | GrVkCommandPool* findOrCreateCommandPool(); |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 91 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 92 | void checkCommandBuffers(); |
Ethan Nicholas | bff4e07 | 2018-12-12 18:17:24 +0000 | [diff] [blame] | 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. |
| 104 | GrVkSampler* findOrCreateCompatibleSampler(const GrSamplerState&, |
| 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( |
| 113 | const GrPipeline&, |
| 114 | const GrPrimitiveProcessor&, |
| 115 | const GrTextureProxy* const primProcProxies[], |
| 116 | GrPrimitiveType, |
| 117 | VkRenderPass compatibleRenderPass); |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 118 | |
Greg Daniel | a754378 | 2017-05-02 14:01:43 -0400 | [diff] [blame] | 119 | void getSamplerDescriptorSetHandle(VkDescriptorType type, |
| 120 | const GrVkUniformHandler&, |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 121 | GrVkDescriptorSetManager::Handle* handle); |
Greg Daniel | a754378 | 2017-05-02 14:01:43 -0400 | [diff] [blame] | 122 | void getSamplerDescriptorSetHandle(VkDescriptorType type, |
| 123 | const SkTArray<uint32_t>& visibilities, |
egdaniel | 4d866df | 2016-08-25 13:52:00 -0700 | [diff] [blame] | 124 | GrVkDescriptorSetManager::Handle* handle); |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 125 | |
| 126 | // Returns the compatible VkDescriptorSetLayout to use for uniform buffers. The caller does not |
| 127 | // own the VkDescriptorSetLayout and thus should not delete it. This function should be used |
| 128 | // when the caller needs the layout to create a VkPipelineLayout. |
| 129 | VkDescriptorSetLayout getUniformDSLayout() const; |
| 130 | |
| 131 | // Returns the compatible VkDescriptorSetLayout to use for a specific sampler handle. The caller |
| 132 | // does not own the VkDescriptorSetLayout and thus should not delete it. This function should be |
| 133 | // used when the caller needs the layout to create a VkPipelineLayout. |
| 134 | VkDescriptorSetLayout getSamplerDSLayout(const GrVkDescriptorSetManager::Handle&) const; |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 135 | |
| 136 | // Returns a GrVkDescriptorSet that can be used for uniform buffers. The GrVkDescriptorSet |
| 137 | // is already reffed for the caller. |
| 138 | const GrVkDescriptorSet* getUniformDescriptorSet(); |
| 139 | |
| 140 | // 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] | 141 | // the GrVkDescriptorSetManager::Handle passed in. The GrVkDescriptorSet is already reffed for |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 142 | // the caller. |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 143 | const GrVkDescriptorSet* getSamplerDescriptorSet(const GrVkDescriptorSetManager::Handle&); |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 144 | |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 145 | |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 146 | // Signals that the descriptor set passed it, which is compatible with the passed in handle, |
| 147 | // can be reused by the next allocation request. |
| 148 | void recycleDescriptorSet(const GrVkDescriptorSet* descSet, |
| 149 | const GrVkDescriptorSetManager::Handle&); |
| 150 | |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 151 | // Creates or finds free uniform buffer resources of size GrVkUniformBuffer::kStandardSize. |
| 152 | // Anything larger will need to be created and released by the client. |
| 153 | const GrVkResource* findOrCreateStandardUniformBufferResource(); |
| 154 | |
| 155 | // Signals that the resource passed to it (which should be a uniform buffer resource) |
| 156 | // can be reused by the next uniform buffer resource request. |
| 157 | void recycleStandardUniformBufferResource(const GrVkResource*); |
| 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 | |
| 167 | // Abandon any cached resources. To be used when the context/VkDevice is lost. |
| 168 | // For resource tracing to work properly, this should be called after unrefing all other |
| 169 | // resource usages. |
| 170 | void abandonResources(); |
| 171 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 172 | void backgroundReset(GrVkCommandPool* pool); |
| 173 | |
| 174 | void reset(GrVkCommandPool* pool); |
| 175 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 176 | private: |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 177 | |
djsollen | efe46d2 | 2016-04-29 06:41:35 -0700 | [diff] [blame] | 178 | #ifdef SK_DEBUG |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 179 | #define GR_PIPELINE_STATE_CACHE_STATS |
| 180 | #endif |
| 181 | |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 182 | class PipelineStateCache : public ::SkNoncopyable { |
| 183 | public: |
| 184 | PipelineStateCache(GrVkGpu* gpu); |
| 185 | ~PipelineStateCache(); |
| 186 | |
| 187 | void abandon(); |
| 188 | void release(); |
Brian Salomon | ff168d9 | 2018-06-23 15:17:27 -0400 | [diff] [blame] | 189 | GrVkPipelineState* refPipelineState(const GrPrimitiveProcessor&, |
Greg Daniel | 9a51a86 | 2018-11-30 10:18:14 -0500 | [diff] [blame] | 190 | const GrTextureProxy* const primProcProxies[], |
Brian Salomon | ff168d9 | 2018-06-23 15:17:27 -0400 | [diff] [blame] | 191 | const GrPipeline&, |
Greg Daniel | 09eeefb | 2017-10-16 15:15:02 -0400 | [diff] [blame] | 192 | GrPrimitiveType, |
Greg Daniel | 99b88e0 | 2018-10-03 15:31:20 -0400 | [diff] [blame] | 193 | VkRenderPass compatibleRenderPass); |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 194 | |
| 195 | private: |
| 196 | enum { |
| 197 | // We may actually have kMaxEntries+1 PipelineStates in context because we create a new |
| 198 | // PipelineState before evicting from the cache. |
| 199 | kMaxEntries = 128, |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | struct Entry; |
| 203 | |
Ethan Nicholas | 87f340e | 2017-01-03 14:32:01 -0500 | [diff] [blame] | 204 | struct DescHash { |
| 205 | uint32_t operator()(const GrProgramDesc& desc) const { |
| 206 | return SkOpts::hash_fn(desc.asKey(), desc.keyLength(), 0); |
| 207 | } |
| 208 | }; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 209 | |
Brian Salomon | 1471df9 | 2018-06-08 10:49:00 -0400 | [diff] [blame] | 210 | SkLRUCache<const GrVkPipelineStateBuilder::Desc, std::unique_ptr<Entry>, DescHash> fMap; |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 211 | |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 212 | GrVkGpu* fGpu; |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 213 | |
| 214 | #ifdef GR_PIPELINE_STATE_CACHE_STATS |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 215 | int fTotalRequests; |
| 216 | int fCacheMisses; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 217 | #endif |
| 218 | }; |
| 219 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 220 | class CompatibleRenderPassSet { |
| 221 | public: |
| 222 | // This will always construct the basic load store render pass (all attachments load and |
| 223 | // store their data) so that there is at least one compatible VkRenderPass that can be used |
| 224 | // with this set. |
| 225 | CompatibleRenderPassSet(const GrVkGpu* gpu, const GrVkRenderTarget& target); |
| 226 | |
| 227 | bool isCompatible(const GrVkRenderTarget& target) const; |
| 228 | |
| 229 | GrVkRenderPass* getCompatibleRenderPass() const { |
| 230 | // The first GrVkRenderpass should always exist since we create the basic load store |
| 231 | // render pass on create |
| 232 | SkASSERT(fRenderPasses[0]); |
| 233 | return fRenderPasses[0]; |
| 234 | } |
| 235 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 236 | GrVkRenderPass* getRenderPass(const GrVkGpu* gpu, |
| 237 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 238 | const GrVkRenderPass::LoadStoreOps& stencilOps); |
| 239 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 240 | void releaseResources(GrVkGpu* gpu); |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 241 | void abandonResources(); |
| 242 | |
| 243 | private: |
| 244 | SkSTArray<4, GrVkRenderPass*> fRenderPasses; |
| 245 | int fLastReturnedIndex; |
| 246 | }; |
| 247 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 248 | GrVkGpu* fGpu; |
| 249 | |
jvanverth | 03509ea | 2016-03-02 13:19:47 -0800 | [diff] [blame] | 250 | // Central cache for creating pipelines |
| 251 | VkPipelineCache fPipelineCache; |
| 252 | |
egdaniel | bc9b296 | 2016-09-27 08:00:53 -0700 | [diff] [blame] | 253 | // Cache of previously created copy pipelines |
| 254 | SkTArray<GrVkCopyPipeline*> fCopyPipelines; |
| 255 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 256 | SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 257 | |
Greg Daniel | b46add8 | 2019-01-02 14:51:29 -0500 | [diff] [blame^] | 258 | SkTArray<const GrVkRenderPass*> fExternalRenderPasses; |
| 259 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 260 | // Array of command pools that we are waiting on |
| 261 | SkSTArray<4, GrVkCommandPool*, true> fActiveCommandPools; |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 262 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 263 | // Array of available command pools that are not in flight |
| 264 | SkSTArray<4, GrVkCommandPool*, true> fAvailableCommandPools; |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 265 | |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 266 | // Array of available uniform buffer resources |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 267 | SkSTArray<16, const GrVkResource*, true> fAvailableUniformBufferResources; |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 268 | |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 269 | // 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] | 270 | // GrVkPipelineStates |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 271 | SkTDynamicHash<GrVkSampler, GrVkSampler::Key> fSamplers; |
| 272 | |
| 273 | // Stores GrVkSamplerYcbcrConversion objects that we've already created so we can reuse them. |
| 274 | SkTDynamicHash<GrVkSamplerYcbcrConversion, GrVkSamplerYcbcrConversion::Key> fYcbcrConversions; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 275 | |
| 276 | // Cache of GrVkPipelineStates |
| 277 | PipelineStateCache* fPipelineStateCache; |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 278 | |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 279 | SkSTArray<4, std::unique_ptr<GrVkDescriptorSetManager>> fDescriptorSetManagers; |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 280 | |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 281 | GrVkDescriptorSetManager::Handle fUniformDSHandle; |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 282 | |
| 283 | std::recursive_mutex fBackgroundMutex; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 284 | }; |
| 285 | |
| 286 | #endif |