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 | 901aff0 | 2019-10-08 12:32:56 -0400 | [diff] [blame] | 46 | GrVkPipeline* createPipeline(const GrProgramInfo&, |
Robert Phillips | 6c2aa7a | 2019-10-17 19:06:39 +0000 | [diff] [blame] | 47 | const GrStencilSettings& stencil, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 48 | VkPipelineShaderStageCreateInfo* shaderStageInfo, |
| 49 | int shaderStageCount, |
| 50 | GrPrimitiveType primitiveType, |
Greg Daniel | 99b88e0 | 2018-10-03 15:31:20 -0400 | [diff] [blame] | 51 | VkRenderPass compatibleRenderPass, |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 52 | VkPipelineLayout layout); |
| 53 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 54 | GR_DEFINE_RESOURCE_HANDLE_CLASS(CompatibleRPHandle); |
| 55 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 56 | // 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] | 57 | // and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. If this is |
| 58 | // non null it will be set to a handle that can be used in the furutre to quickly return a |
| 59 | // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarget. |
| 60 | const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& target, |
| 61 | CompatibleRPHandle* compatibleHandle = nullptr); |
| 62 | // The CompatibleRPHandle must be a valid handle previously set by a call to |
| 63 | // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*). |
| 64 | const GrVkRenderPass* findCompatibleRenderPass(const CompatibleRPHandle& compatibleHandle); |
| 65 | |
Greg Daniel | b46add8 | 2019-01-02 14:51:29 -0500 | [diff] [blame] | 66 | const GrVkRenderPass* findCompatibleExternalRenderPass(VkRenderPass, |
| 67 | uint32_t colorAttachmentIndex); |
| 68 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 69 | // Finds or creates a render pass that matches the target and LoadStoreOps, increments the |
| 70 | // refcount, and returns. The caller can optionally pass in a pointer to a CompatibleRPHandle. |
| 71 | // If this is non null it will be set to a handle that can be used in the furutre to quickly |
| 72 | // return a GrVkRenderPasses without the need inspecting a GrVkRenderTarget. |
Greg Daniel | fa3adf7 | 2019-11-07 09:53:41 -0500 | [diff] [blame^] | 73 | const GrVkRenderPass* findRenderPass(GrVkRenderTarget* target, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 74 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 75 | const GrVkRenderPass::LoadStoreOps& stencilOps, |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 76 | CompatibleRPHandle* compatibleHandle = nullptr); |
| 77 | |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 78 | // The CompatibleRPHandle must be a valid handle previously set by a call to findRenderPass or |
| 79 | // findCompatibleRenderPass. |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 80 | const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHandle, |
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); |
| 83 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 84 | GrVkCommandPool* findOrCreateCommandPool(); |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 85 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 86 | void checkCommandBuffers(); |
Ethan Nicholas | bff4e07 | 2018-12-12 18:17:24 +0000 | [diff] [blame] | 87 | |
Greg Daniel | a3aa75a | 2019-04-12 14:24:55 -0400 | [diff] [blame] | 88 | // We must add the finishedProc to all active command buffers since we may have flushed work |
| 89 | // that the client cares about before they explicitly called flush and the GPU may reorder |
| 90 | // command execution. So we make sure all previously submitted work finishes before we call the |
| 91 | // finishedProc. |
| 92 | void addFinishedProcToActiveCommandBuffers(GrGpuFinishedProc finishedProc, |
| 93 | GrGpuFinishedContext finishedContext); |
| 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 | 901aff0 | 2019-10-08 12:32:56 -0400 | [diff] [blame] | 114 | GrRenderTarget*, |
| 115 | const GrProgramInfo&, |
Greg Daniel | 9a51a86 | 2018-11-30 10:18:14 -0500 | [diff] [blame] | 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 | a870b46 | 2019-01-08 15:49:46 -0500 | [diff] [blame] | 159 | void storePipelineCacheData(); |
| 160 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 161 | // Destroy any cached resources. To be called before destroying the VkDevice. |
| 162 | // The assumption is that all queues are idle and all command buffers are finished. |
| 163 | // For resource tracing to work properly, this should be called after unrefing all other |
| 164 | // resource usages. |
Jim Van Verth | 09557d7 | 2016-11-07 11:10:21 -0500 | [diff] [blame] | 165 | // If deviceLost is true, then resources will not be checked to see if they've finished |
| 166 | // before deleting (see section 4.2.4 of the Vulkan spec). |
| 167 | void destroyResources(bool deviceLost); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 168 | |
| 169 | // Abandon any cached resources. To be used when the context/VkDevice is lost. |
| 170 | // For resource tracing to work properly, this should be called after unrefing all other |
| 171 | // resource usages. |
| 172 | void abandonResources(); |
| 173 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 174 | void backgroundReset(GrVkCommandPool* pool); |
| 175 | |
| 176 | void reset(GrVkCommandPool* pool); |
| 177 | |
Brian Osman | fd7657c | 2019-04-25 11:34:07 -0400 | [diff] [blame] | 178 | #if GR_TEST_UTILS |
| 179 | void resetShaderCacheForTesting() const { fPipelineStateCache->release(); } |
| 180 | #endif |
| 181 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 182 | private: |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 183 | |
djsollen | efe46d2 | 2016-04-29 06:41:35 -0700 | [diff] [blame] | 184 | #ifdef SK_DEBUG |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 185 | #define GR_PIPELINE_STATE_CACHE_STATS |
| 186 | #endif |
| 187 | |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 188 | class PipelineStateCache : public ::SkNoncopyable { |
| 189 | public: |
| 190 | PipelineStateCache(GrVkGpu* gpu); |
| 191 | ~PipelineStateCache(); |
| 192 | |
| 193 | void abandon(); |
| 194 | void release(); |
Robert Phillips | 901aff0 | 2019-10-08 12:32:56 -0400 | [diff] [blame] | 195 | GrVkPipelineState* refPipelineState(GrRenderTarget*, |
| 196 | const GrProgramInfo&, |
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: |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 201 | struct Entry; |
| 202 | |
Ethan Nicholas | 87f340e | 2017-01-03 14:32:01 -0500 | [diff] [blame] | 203 | struct DescHash { |
| 204 | uint32_t operator()(const GrProgramDesc& desc) const { |
| 205 | return SkOpts::hash_fn(desc.asKey(), desc.keyLength(), 0); |
| 206 | } |
| 207 | }; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 208 | |
Brian Salomon | 1471df9 | 2018-06-08 10:49:00 -0400 | [diff] [blame] | 209 | SkLRUCache<const GrVkPipelineStateBuilder::Desc, std::unique_ptr<Entry>, DescHash> fMap; |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 210 | |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 211 | GrVkGpu* fGpu; |
egdaniel | af13277 | 2016-03-28 12:39:29 -0700 | [diff] [blame] | 212 | |
| 213 | #ifdef GR_PIPELINE_STATE_CACHE_STATS |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 214 | int fTotalRequests; |
| 215 | int fCacheMisses; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 216 | #endif |
| 217 | }; |
| 218 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 219 | class CompatibleRenderPassSet { |
| 220 | public: |
| 221 | // This will always construct the basic load store render pass (all attachments load and |
| 222 | // store their data) so that there is at least one compatible VkRenderPass that can be used |
| 223 | // with this set. |
Greg Daniel | e643da6 | 2019-11-05 12:36:42 -0500 | [diff] [blame] | 224 | CompatibleRenderPassSet(GrVkGpu* gpu, const GrVkRenderTarget& target); |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 225 | |
| 226 | bool isCompatible(const GrVkRenderTarget& target) const; |
| 227 | |
| 228 | GrVkRenderPass* getCompatibleRenderPass() const { |
| 229 | // The first GrVkRenderpass should always exist since we create the basic load store |
| 230 | // render pass on create |
| 231 | SkASSERT(fRenderPasses[0]); |
| 232 | return fRenderPasses[0]; |
| 233 | } |
| 234 | |
Greg Daniel | e643da6 | 2019-11-05 12:36:42 -0500 | [diff] [blame] | 235 | GrVkRenderPass* getRenderPass(GrVkGpu* gpu, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 236 | const GrVkRenderPass::LoadStoreOps& colorOps, |
egdaniel | 2feb093 | 2016-06-08 06:48:09 -0700 | [diff] [blame] | 237 | const GrVkRenderPass::LoadStoreOps& stencilOps); |
| 238 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 239 | void releaseResources(GrVkGpu* gpu); |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 240 | void abandonResources(); |
| 241 | |
| 242 | private: |
| 243 | SkSTArray<4, GrVkRenderPass*> fRenderPasses; |
| 244 | int fLastReturnedIndex; |
| 245 | }; |
| 246 | |
Greg Daniel | a870b46 | 2019-01-08 15:49:46 -0500 | [diff] [blame] | 247 | VkPipelineCache pipelineCache(); |
| 248 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 249 | GrVkGpu* fGpu; |
| 250 | |
jvanverth | 03509ea | 2016-03-02 13:19:47 -0800 | [diff] [blame] | 251 | // Central cache for creating pipelines |
| 252 | VkPipelineCache fPipelineCache; |
| 253 | |
egdaniel | d62e28b | 2016-06-07 08:43:30 -0700 | [diff] [blame] | 254 | SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 255 | |
Greg Daniel | b46add8 | 2019-01-02 14:51:29 -0500 | [diff] [blame] | 256 | SkTArray<const GrVkRenderPass*> fExternalRenderPasses; |
| 257 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 258 | // Array of command pools that we are waiting on |
| 259 | SkSTArray<4, GrVkCommandPool*, true> fActiveCommandPools; |
jvanverth | 7ec9241 | 2016-07-06 09:24:57 -0700 | [diff] [blame] | 260 | |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 261 | // Array of available command pools that are not in flight |
| 262 | SkSTArray<4, GrVkCommandPool*, true> fAvailableCommandPools; |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 263 | |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 264 | // Array of available uniform buffer resources |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 265 | SkSTArray<16, const GrVkResource*, true> fAvailableUniformBufferResources; |
jvanverth | 4c6e47a | 2016-07-22 10:34:52 -0700 | [diff] [blame] | 266 | |
egdaniel | 8b6394c | 2016-03-04 07:35:10 -0800 | [diff] [blame] | 267 | // 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] | 268 | // GrVkPipelineStates |
Greg Daniel | 7e00022 | 2018-12-03 10:08:21 -0500 | [diff] [blame] | 269 | SkTDynamicHash<GrVkSampler, GrVkSampler::Key> fSamplers; |
| 270 | |
| 271 | // Stores GrVkSamplerYcbcrConversion objects that we've already created so we can reuse them. |
| 272 | SkTDynamicHash<GrVkSamplerYcbcrConversion, GrVkSamplerYcbcrConversion::Key> fYcbcrConversions; |
egdaniel | 22281c1 | 2016-03-23 13:49:40 -0700 | [diff] [blame] | 273 | |
| 274 | // Cache of GrVkPipelineStates |
| 275 | PipelineStateCache* fPipelineStateCache; |
egdaniel | 778555c | 2016-05-02 06:50:36 -0700 | [diff] [blame] | 276 | |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 277 | SkSTArray<4, std::unique_ptr<GrVkDescriptorSetManager>> fDescriptorSetManagers; |
egdaniel | a95220d | 2016-07-21 11:50:37 -0700 | [diff] [blame] | 278 | |
egdaniel | 707bbd6 | 2016-07-26 07:19:47 -0700 | [diff] [blame] | 279 | GrVkDescriptorSetManager::Handle fUniformDSHandle; |
Ethan Nicholas | 8e265a7 | 2018-12-12 16:22:40 -0500 | [diff] [blame] | 280 | |
| 281 | std::recursive_mutex fBackgroundMutex; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 282 | }; |
| 283 | |
| 284 | #endif |