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

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

Issue 2035853002: Add support for finding/creating general GrVkRenderPass from the VkResourceProvider. (Closed) Base URL: https://skia.googlesource.com/skia.git@renderPass
Patch Set: nits Created 4 years, 6 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/GrVkRenderTarget.h ('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 "GrVkPipelineState.h" 14 #include "GrVkPipelineState.h"
15 #include "GrVkRenderPass.h"
15 #include "GrVkResource.h" 16 #include "GrVkResource.h"
16 #include "GrVkUtil.h" 17 #include "GrVkUtil.h"
17 #include "SkTArray.h" 18 #include "SkTArray.h"
18 #include "SkTDynamicHash.h" 19 #include "SkTDynamicHash.h"
19 #include "SkTHash.h" 20 #include "SkTHash.h"
20 #include "SkTInternalLList.h" 21 #include "SkTInternalLList.h"
21 22
22 #include "vk/GrVkDefines.h" 23 #include "vk/GrVkDefines.h"
23 24
24 class GrPipeline; 25 class GrPipeline;
25 class GrPrimitiveProcessor; 26 class GrPrimitiveProcessor;
26 class GrTextureParams; 27 class GrTextureParams;
27 class GrVkCommandBuffer; 28 class GrVkCommandBuffer;
28 class GrVkGpu; 29 class GrVkGpu;
29 class GrVkPipeline; 30 class GrVkPipeline;
30 class GrVkRenderPass;
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
39 // Set up any initial vk objects 39 // Set up any initial vk objects
40 void init(); 40 void init();
(...skipping 11 matching lines...) Expand all
52 // Finds or creates a simple render pass that matches the target, increments the refcount, 52 // Finds or creates a simple render pass that matches the target, increments the refcount,
53 // and returns. The caller can optionally pass in a pointer to a CompatibleR PHandle. If this is 53 // and returns. The caller can optionally pass in a pointer to a CompatibleR PHandle. If this is
54 // non null it will be set to a handle that can be used in the furutre to qu ickly return a 54 // non null it will be set to a handle that can be used in the furutre to qu ickly return a
55 // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarge t. 55 // compatible GrVkRenderPasses without the need inspecting a GrVkRenderTarge t.
56 const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& targe t, 56 const GrVkRenderPass* findCompatibleRenderPass(const GrVkRenderTarget& targe t,
57 CompatibleRPHandle* compatibl eHandle = nullptr); 57 CompatibleRPHandle* compatibl eHandle = nullptr);
58 // The CompatibleRPHandle must be a valid handle previously set by a call to 58 // The CompatibleRPHandle must be a valid handle previously set by a call to
59 // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*). 59 // findCompatibleRenderPass(GrVkRenderTarget&, CompatibleRPHandle*).
60 const GrVkRenderPass* findCompatibleRenderPass(const CompatibleRPHandle& com patibleHandle); 60 const GrVkRenderPass* findCompatibleRenderPass(const CompatibleRPHandle& com patibleHandle);
61 61
62 #if 0 62 // Finds or creates a render pass that matches the target and LoadStoreOps, increments the
63 // TODO: 63 // refcount, and returns. The caller can optionally pass in a pointer to a C ompatibleRPHandle.
64 // If this is non null it will be set to a handle that can be used in the fu rutre to quickly
65 // return a GrVkRenderPasses without the need inspecting a GrVkRenderTarget.
64 const GrVkRenderPass* findRenderPass(const GrVkRenderTarget& target, 66 const GrVkRenderPass* findRenderPass(const GrVkRenderTarget& target,
65 VkAttachmentLoadOp colorLoad, 67 const GrVkRenderPass::LoadStoreOps& col orOps,
66 VkAttachmentStoreOp colorStore, 68 const GrVkRenderPass::LoadStoreOps& res olveOps,
67 VkAttachmentLoadOp stencilLoad, 69 const GrVkRenderPass::LoadStoreOps& ste ncilOps,
68 VkAttachmentStoreOp stencilStore,
69 CompatibleRPHandle* compatibleHandle = nullptr); 70 CompatibleRPHandle* compatibleHandle = nullptr);
70 71
72 // The CompatibleRPHandle must be a valid handle previously set by a call to findRenderPass or
73 // findCompatibleRenderPass.
71 const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHan dle, 74 const GrVkRenderPass* findRenderPass(const CompatibleRPHandle& compatibleHan dle,
72 VkAttachmentLoadOp colorLoad, 75 const GrVkRenderPass::LoadStoreOps& col orOps,
73 VkAttachmentStoreOp colorStore, 76 const GrVkRenderPass::LoadStoreOps& res olveOps,
74 VkAttachmentLoadOp stencilLoad, 77 const GrVkRenderPass::LoadStoreOps& ste ncilOps);
75 VkAttachmentStoreOp stencilStore); 78
76 #endif
77 79
78 GrVkCommandBuffer* createCommandBuffer(); 80 GrVkCommandBuffer* createCommandBuffer();
79 void checkCommandBuffers(); 81 void checkCommandBuffers();
80 82
81 // 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.
82 // The refcount is incremented and a pointer returned. 84 // The refcount is incremented and a pointer returned.
83 // 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
84 // 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
85 // 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
86 // of our cache of GrVkDescriptorPools. 88 // of our cache of GrVkDescriptorPools.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 170
169 bool isCompatible(const GrVkRenderTarget& target) const; 171 bool isCompatible(const GrVkRenderTarget& target) const;
170 172
171 GrVkRenderPass* getCompatibleRenderPass() const { 173 GrVkRenderPass* getCompatibleRenderPass() const {
172 // The first GrVkRenderpass should always exist since we create the basic load store 174 // The first GrVkRenderpass should always exist since we create the basic load store
173 // render pass on create 175 // render pass on create
174 SkASSERT(fRenderPasses[0]); 176 SkASSERT(fRenderPasses[0]);
175 return fRenderPasses[0]; 177 return fRenderPasses[0];
176 } 178 }
177 179
180 GrVkRenderPass* getRenderPass(const GrVkGpu* gpu,
181 const GrVkRenderPass::LoadStoreOps& colorO ps,
182 const GrVkRenderPass::LoadStoreOps& resolv eOps,
183 const GrVkRenderPass::LoadStoreOps& stenci lOps);
184
178 void releaseResources(const GrVkGpu* gpu); 185 void releaseResources(const GrVkGpu* gpu);
179 void abandonResources(); 186 void abandonResources();
180 187
181 private: 188 private:
182 SkSTArray<4, GrVkRenderPass*> fRenderPasses; 189 SkSTArray<4, GrVkRenderPass*> fRenderPasses;
183 int fLastReturnedIndex; 190 int fLastReturnedIndex;
184 }; 191 };
185 192
186 // Initialiaze the vkDescriptorSetLayout used for allocating new uniform buf fer descritpor sets. 193 // Initialiaze the vkDescriptorSetLayout used for allocating new uniform buf fer descritpor sets.
187 void initUniformDescObjects(); 194 void initUniformDescObjects();
(...skipping 23 matching lines...) Expand all
211 int fCurrMaxUniDescriptors; 218 int fCurrMaxUniDescriptors;
212 219
213 enum { 220 enum {
214 kMaxUniformDescriptors = 1024, 221 kMaxUniformDescriptors = 1024,
215 kNumUniformDescPerSet = 2, 222 kNumUniformDescPerSet = 2,
216 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri ptors 223 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri ptors
217 }; 224 };
218 }; 225 };
219 226
220 #endif 227 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkRenderTarget.h ('k') | src/gpu/vk/GrVkResourceProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698