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