Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/gpu/vk/GrVkResourceProvider.h

Issue 2274663005: Add GrVkCopyPipeline to handle vulkan copies as draws (Closed) Base URL: https://skia.googlesource.com/skia.git@compatibleCopyDS
Patch Set: indent nits Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrVkDescriptorSetManager.h" 14 #include "GrVkDescriptorSetManager.h"
15 #include "GrVkPipelineState.h" 15 #include "GrVkPipelineState.h"
16 #include "GrVkRenderPass.h" 16 #include "GrVkRenderPass.h"
17 #include "GrVkResource.h" 17 #include "GrVkResource.h"
18 #include "GrVkUtil.h" 18 #include "GrVkUtil.h"
19 #include "SkTArray.h" 19 #include "SkTArray.h"
20 #include "SkTDynamicHash.h" 20 #include "SkTDynamicHash.h"
21 #include "SkTHash.h" 21 #include "SkTHash.h"
22 #include "SkTInternalLList.h" 22 #include "SkTInternalLList.h"
23 23
24 #include "vk/GrVkDefines.h" 24 #include "vk/GrVkDefines.h"
25 25
26 class GrPipeline; 26 class GrPipeline;
27 class GrPrimitiveProcessor; 27 class GrPrimitiveProcessor;
28 class GrTextureParams; 28 class GrTextureParams;
29 class GrVkCopyPipeline;
29 class GrVkGpu; 30 class GrVkGpu;
30 class GrVkPipeline; 31 class GrVkPipeline;
31 class GrVkPrimaryCommandBuffer; 32 class GrVkPrimaryCommandBuffer;
32 class GrVkRenderTarget; 33 class GrVkRenderTarget;
33 class GrVkSampler; 34 class GrVkSampler;
34 class GrVkSecondaryCommandBuffer; 35 class GrVkSecondaryCommandBuffer;
35 class GrVkUniformHandler; 36 class GrVkUniformHandler;
36 37
37 class GrVkResourceProvider { 38 class GrVkResourceProvider {
38 public: 39 public:
39 GrVkResourceProvider(GrVkGpu* gpu); 40 GrVkResourceProvider(GrVkGpu* gpu);
40 ~GrVkResourceProvider(); 41 ~GrVkResourceProvider();
41 42
42 // Set up any initial vk objects 43 // Set up any initial vk objects
43 void init(); 44 void init();
44 45
45 GrVkPipeline* createPipeline(const GrPipeline& pipeline, 46 GrVkPipeline* createPipeline(const GrPipeline& pipeline,
46 const GrPrimitiveProcessor& primProc, 47 const GrPrimitiveProcessor& primProc,
47 VkPipelineShaderStageCreateInfo* shaderStageInf o, 48 VkPipelineShaderStageCreateInfo* shaderStageInf o,
48 int shaderStageCount, 49 int shaderStageCount,
49 GrPrimitiveType primitiveType, 50 GrPrimitiveType primitiveType,
50 const GrVkRenderPass& renderPass, 51 const GrVkRenderPass& renderPass,
51 VkPipelineLayout layout); 52 VkPipelineLayout layout);
52 53
54 GrVkCopyPipeline* findOrCreateCopyPipeline(const GrVkRenderTarget* dst,
55 VkPipelineShaderStageCreateInfo*,
56 VkPipelineLayout);
57
53 GR_DEFINE_RESOURCE_HANDLE_CLASS(CompatibleRPHandle); 58 GR_DEFINE_RESOURCE_HANDLE_CLASS(CompatibleRPHandle);
54 59
55 // Finds or creates a simple render pass that matches the target, increments the refcount, 60 // Finds or creates a simple render pass that matches the target, increments the refcount,
56 // and returns. The caller can optionally pass in a pointer to a CompatibleR PHandle. If this is 61 // and returns. The caller can optionally pass in a pointer to a CompatibleR PHandle. If this is
57 // non null it will be set to a handle that can be used in the furutre to qu ickly return a 62 // non null it will be set to a handle that can be used in the furutre to qu ickly return a
58 // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarge t. 63 // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarge t.
59 const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& targe t, 64 const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& targe t,
60 CompatibleRPHandle* compatibl eHandle = nullptr); 65 CompatibleRPHandle* compatibl eHandle = nullptr);
61 // The CompatibleRPHandle must be a valid handle previously set by a call to 66 // The CompatibleRPHandle must be a valid handle previously set by a call to
62 // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*). 67 // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*).
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 private: 222 private:
218 SkSTArray<4, GrVkRenderPass*> fRenderPasses; 223 SkSTArray<4, GrVkRenderPass*> fRenderPasses;
219 int fLastReturnedIndex; 224 int fLastReturnedIndex;
220 }; 225 };
221 226
222 GrVkGpu* fGpu; 227 GrVkGpu* fGpu;
223 228
224 // Central cache for creating pipelines 229 // Central cache for creating pipelines
225 VkPipelineCache fPipelineCache; 230 VkPipelineCache fPipelineCache;
226 231
232 // Cache of previously created copy pipelines
233 SkTArray<GrVkCopyPipeline*> fCopyPipelines;
234
227 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray; 235 SkSTArray<4, CompatibleRenderPassSet> fRenderPassArray;
228 236
229 // Array of PrimaryCommandBuffers that are currently in flight 237 // Array of PrimaryCommandBuffers that are currently in flight
230 SkSTArray<4, GrVkPrimaryCommandBuffer*, true> fActiveCommandBuffers; 238 SkSTArray<4, GrVkPrimaryCommandBuffer*, true> fActiveCommandBuffers;
231 // Array of available primary command buffers that are not in flight 239 // Array of available primary command buffers that are not in flight
232 SkSTArray<4, GrVkPrimaryCommandBuffer*, true> fAvailableCommandBuffers; 240 SkSTArray<4, GrVkPrimaryCommandBuffer*, true> fAvailableCommandBuffers;
233 241
234 // Array of available secondary command buffers 242 // Array of available secondary command buffers
235 SkSTArray<16, GrVkSecondaryCommandBuffer*, true> fAvailableSecondaryCommandB uffers; 243 SkSTArray<16, GrVkSecondaryCommandBuffer*, true> fAvailableSecondaryCommandB uffers;
236 244
237 // Array of available uniform buffer resources 245 // Array of available uniform buffer resources
238 SkSTArray<16, const GrVkResource*, true> fAvailableUniformBufferResources; 246 SkSTArray<16, const GrVkResource*, true> fAvailableUniformBufferResources;
239 247
240 // Stores GrVkSampler objects that we've already created so we can reuse the m across multiple 248 // Stores GrVkSampler objects that we've already created so we can reuse the m across multiple
241 // GrVkPipelineStates 249 // GrVkPipelineStates
242 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; 250 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers;
243 251
244 // Cache of GrVkPipelineStates 252 // Cache of GrVkPipelineStates
245 PipelineStateCache* fPipelineStateCache; 253 PipelineStateCache* fPipelineStateCache;
246 254
247 SkSTArray<4, GrVkDescriptorSetManager, true> fDescriptorSetManagers; 255 SkSTArray<4, GrVkDescriptorSetManager, true> fDescriptorSetManagers;
248 256
249 GrVkDescriptorSetManager::Handle fUniformDSHandle; 257 GrVkDescriptorSetManager::Handle fUniformDSHandle;
250 }; 258 };
251 259
252 #endif 260 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateBuilder.cpp ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698