| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrVkResourceProvider_DEFINED | 8 #ifndef GrVkResourceProvider_DEFINED |
| 9 #define GrVkResourceProvider_DEFINED | 9 #define GrVkResourceProvider_DEFINED |
| 10 | 10 |
| 11 #include "GrGpu.h" | 11 #include "GrGpu.h" |
| 12 #include "GrResourceHandle.h" | 12 #include "GrResourceHandle.h" |
| 13 #include "GrVkDescriptorPool.h" | 13 #include "GrVkDescriptorPool.h" |
| 14 #include "GrVkPipelineState.h" | 14 #include "GrVkPipelineState.h" |
| 15 #include "GrVkRenderPass.h" | 15 #include "GrVkRenderPass.h" |
| 16 #include "GrVkResource.h" | 16 #include "GrVkResource.h" |
| 17 #include "GrVkUtil.h" | 17 #include "GrVkUtil.h" |
| 18 #include "SkTArray.h" | 18 #include "SkTArray.h" |
| 19 #include "SkTDynamicHash.h" | 19 #include "SkTDynamicHash.h" |
| 20 #include "SkTHash.h" | 20 #include "SkTHash.h" |
| 21 #include "SkTInternalLList.h" | 21 #include "SkTInternalLList.h" |
| 22 | 22 |
| 23 #include "vk/GrVkDefines.h" | 23 #include "vk/GrVkDefines.h" |
| 24 | 24 |
| 25 class GrPipeline; | 25 class GrPipeline; |
| 26 class GrPrimitiveProcessor; | 26 class GrPrimitiveProcessor; |
| 27 class GrTextureParams; | 27 class GrTextureParams; |
| 28 class GrVkCommandBuffer; | 28 class GrVkPrimaryCommandBuffer; |
| 29 class GrVkGpu; | 29 class GrVkGpu; |
| 30 class GrVkPipeline; | 30 class GrVkPipeline; |
| 31 class GrVkRenderTarget; | 31 class GrVkRenderTarget; |
| 32 class GrVkSampler; | 32 class GrVkSampler; |
| 33 | 33 |
| 34 class GrVkResourceProvider { | 34 class GrVkResourceProvider { |
| 35 public: | 35 public: |
| 36 GrVkResourceProvider(GrVkGpu* gpu); | 36 GrVkResourceProvider(GrVkGpu* gpu); |
| 37 ~GrVkResourceProvider(); | 37 ~GrVkResourceProvider(); |
| 38 | 38 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 CompatibleRPHandle* compatibleHandle =
nullptr); | 70 CompatibleRPHandle* compatibleHandle =
nullptr); |
| 71 | 71 |
| 72 // The CompatibleRPHandle must be a valid handle previously set by a call to
findRenderPass or | 72 // The CompatibleRPHandle must be a valid handle previously set by a call to
findRenderPass or |
| 73 // findCompatibleRenderPass. | 73 // findCompatibleRenderPass. |
| 74 const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHan
dle, | 74 const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHan
dle, |
| 75 const GrVkRenderPass::LoadStoreOps& col
orOps, | 75 const GrVkRenderPass::LoadStoreOps& col
orOps, |
| 76 const GrVkRenderPass::LoadStoreOps& res
olveOps, | 76 const GrVkRenderPass::LoadStoreOps& res
olveOps, |
| 77 const GrVkRenderPass::LoadStoreOps& ste
ncilOps); | 77 const GrVkRenderPass::LoadStoreOps& ste
ncilOps); |
| 78 | 78 |
| 79 | 79 |
| 80 GrVkCommandBuffer* createCommandBuffer(); | 80 GrVkPrimaryCommandBuffer* createPrimaryCommandBuffer(); |
| 81 void checkCommandBuffers(); | 81 void checkCommandBuffers(); |
| 82 | 82 |
| 83 // Finds or creates a compatible GrVkDescriptorPool for the requested type a
nd count. | 83 // Finds or creates a compatible GrVkDescriptorPool for the requested type a
nd count. |
| 84 // The refcount is incremented and a pointer returned. | 84 // The refcount is incremented and a pointer returned. |
| 85 // TODO: Currently this will just create a descriptor pool without holding o
nto a ref itself | 85 // TODO: Currently this will just create a descriptor pool without holding o
nto a ref itself |
| 86 // so we currently do not reuse them. Rquires knowing if another draw
is currently using | 86 // so we currently do not reuse them. Rquires knowing if another draw
is currently using |
| 87 // the GrVkDescriptorPool, the ability to reset pools, and the ability
to purge pools out | 87 // the GrVkDescriptorPool, the ability to reset pools, and the ability
to purge pools out |
| 88 // of our cache of GrVkDescriptorPools. | 88 // of our cache of GrVkDescriptorPools. |
| 89 GrVkDescriptorPool* findOrCreateCompatibleDescriptorPool(VkDescriptorType ty
pe, uint32_t count); | 89 GrVkDescriptorPool* findOrCreateCompatibleDescriptorPool(VkDescriptorType ty
pe, uint32_t count); |
| 90 | 90 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 void initUniformDescObjects(); | 194 void initUniformDescObjects(); |
| 195 | 195 |
| 196 GrVkGpu* fGpu; | 196 GrVkGpu* fGpu; |
| 197 | 197 |
| 198 // Central cache for creating pipelines | 198 // Central cache for creating pipelines |
| 199 VkPipelineCache fPipelineCache; | 199 VkPipelineCache fPipelineCache; |
| 200 | 200 |
| 201 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; | 201 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; |
| 202 | 202 |
| 203 // Array of CommandBuffers that are currently in flight | 203 // Array of CommandBuffers that are currently in flight |
| 204 SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers; | 204 SkSTArray<4, GrVkPrimaryCommandBuffer*> fActiveCommandBuffers; |
| 205 | 205 |
| 206 // Stores GrVkSampler objects that we've already created so we can reuse the
m across multiple | 206 // Stores GrVkSampler objects that we've already created so we can reuse the
m across multiple |
| 207 // GrVkPipelineStates | 207 // GrVkPipelineStates |
| 208 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; | 208 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; |
| 209 | 209 |
| 210 // Cache of GrVkPipelineStates | 210 // Cache of GrVkPipelineStates |
| 211 PipelineStateCache* fPipelineStateCache; | 211 PipelineStateCache* fPipelineStateCache; |
| 212 | 212 |
| 213 // Current pool to allocate uniform descriptor sets from | 213 // Current pool to allocate uniform descriptor sets from |
| 214 const GrVkDescriptorPool* fUniformDescPool; | 214 const GrVkDescriptorPool* fUniformDescPool; |
| 215 VkDescriptorSetLayout fUniformDescLayout; | 215 VkDescriptorSetLayout fUniformDescLayout; |
| 216 //Curent number of uniform descriptors allocated from the pool | 216 //Curent number of uniform descriptors allocated from the pool |
| 217 int fCurrentUniformDescCount; | 217 int fCurrentUniformDescCount; |
| 218 int fCurrMaxUniDescriptors; | 218 int fCurrMaxUniDescriptors; |
| 219 | 219 |
| 220 enum { | 220 enum { |
| 221 kMaxUniformDescriptors = 1024, | 221 kMaxUniformDescriptors = 1024, |
| 222 kNumUniformDescPerSet = 2, | 222 kNumUniformDescPerSet = 2, |
| 223 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri
ptors | 223 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri
ptors |
| 224 }; | 224 }; |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 #endif | 227 #endif |
| OLD | NEW |