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

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

Issue 2275633002: Add support for getting vulkan descriptor sets without a GrVkUniformHandler. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 3 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 | « no previous file | src/gpu/vk/GrVkDescriptorSetManager.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 GrVkDescriptorSetManager_DEFINED 8 #ifndef GrVkDescriptorSetManager_DEFINED
9 #define GrVkDescriptorSetManager_DEFINED 9 #define GrVkDescriptorSetManager_DEFINED
10 10
(...skipping 11 matching lines...) Expand all
22 * This class handles the allocation of descriptor sets for a given VkDescriptor SetLayout. It will 22 * This class handles the allocation of descriptor sets for a given VkDescriptor SetLayout. It will
23 * try to reuse previously allocated descriptor sets if they are no longer in us e by other objects. 23 * try to reuse previously allocated descriptor sets if they are no longer in us e by other objects.
24 */ 24 */
25 class GrVkDescriptorSetManager { 25 class GrVkDescriptorSetManager {
26 public: 26 public:
27 GR_DEFINE_RESOURCE_HANDLE_CLASS(Handle); 27 GR_DEFINE_RESOURCE_HANDLE_CLASS(Handle);
28 28
29 GrVkDescriptorSetManager(GrVkGpu* gpu, 29 GrVkDescriptorSetManager(GrVkGpu* gpu,
30 VkDescriptorType, 30 VkDescriptorType,
31 const GrVkUniformHandler* handler = nullptr); 31 const GrVkUniformHandler* handler = nullptr);
32
33 GrVkDescriptorSetManager(GrVkGpu* gpu,
34 VkDescriptorType,
35 const SkTArray<uint32_t>& visibilities);
36
32 ~GrVkDescriptorSetManager() {} 37 ~GrVkDescriptorSetManager() {}
33 38
34 void abandon(); 39 void abandon();
35 void release(const GrVkGpu* gpu); 40 void release(const GrVkGpu* gpu);
36 41
37 VkDescriptorSetLayout layout() const { return fPoolManager.fDescLayout; } 42 VkDescriptorSetLayout layout() const { return fPoolManager.fDescLayout; }
38 43
39 const GrVkDescriptorSet* getDescriptorSet(GrVkGpu* gpu, const Handle& handle ); 44 const GrVkDescriptorSet* getDescriptorSet(GrVkGpu* gpu, const Handle& handle );
40 45
41 void recycleDescriptorSet(const GrVkDescriptorSet*); 46 void recycleDescriptorSet(const GrVkDescriptorSet*);
42 47
43 bool isCompatible(VkDescriptorType type, const GrVkUniformHandler*) const; 48 bool isCompatible(VkDescriptorType type, const GrVkUniformHandler*) const;
49 bool isCompatible(VkDescriptorType type,
50 const SkTArray<uint32_t>& visibilities) const;
44 51
45 private: 52 private:
46 struct DescriptorPoolManager { 53 struct DescriptorPoolManager {
47 DescriptorPoolManager(VkDescriptorType type, GrVkGpu* gpu, 54 DescriptorPoolManager(VkDescriptorType type, GrVkGpu* gpu,
48 const GrVkUniformHandler* handler = nullptr); 55 const GrVkUniformHandler* handler = nullptr);
56 DescriptorPoolManager(VkDescriptorType type, GrVkGpu* gpu,
57 const SkTArray<uint32_t>& visibilities);
58
49 59
50 ~DescriptorPoolManager() { 60 ~DescriptorPoolManager() {
51 SkASSERT(!fDescLayout); 61 SkASSERT(!fDescLayout);
52 SkASSERT(!fPool); 62 SkASSERT(!fPool);
53 } 63 }
54 64
55 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds); 65 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds);
56 66
57 void freeGPUResources(const GrVkGpu* gpu); 67 void freeGPUResources(const GrVkGpu* gpu);
58 void abandonGPUResources(); 68 void abandonGPUResources();
59 69
60 VkDescriptorSetLayout fDescLayout; 70 VkDescriptorSetLayout fDescLayout;
61 VkDescriptorType fDescType; 71 VkDescriptorType fDescType;
62 uint32_t fDescCountPerSet; 72 uint32_t fDescCountPerSet;
63 uint32_t fMaxDescriptors; 73 uint32_t fMaxDescriptors;
64 uint32_t fCurrentDescriptorCount; 74 uint32_t fCurrentDescriptorCount;
65 GrVkDescriptorPool* fPool; 75 GrVkDescriptorPool* fPool;
66 76
67 private: 77 private:
68 enum { 78 enum {
69 kUniformDescPerSet = 2, 79 kUniformDescPerSet = 2,
70 kMaxDescriptors = 1024, 80 kMaxDescriptors = 1024,
71 kStartNumDescriptors = 16, // must be less than kMaxUniformDescripto rs 81 kStartNumDescriptors = 16, // must be less than kMaxUniformDescripto rs
72 }; 82 };
73 83
84 void init(GrVkGpu* gpu, VkDescriptorType type, const GrVkUniformHandler* uniformHandler,
85 const SkTArray<uint32_t>* visibilities);
86
74 void getNewPool(GrVkGpu* gpu); 87 void getNewPool(GrVkGpu* gpu);
75 }; 88 };
76 89
77 DescriptorPoolManager fPoolManager; 90 DescriptorPoolManager fPoolManager;
78 SkTArray<const GrVkDescriptorSet*, true> fFreeSets; 91 SkTArray<const GrVkDescriptorSet*, true> fFreeSets;
79 SkSTArray<4, uint32_t> fBindingVisibilities; 92 SkSTArray<4, uint32_t> fBindingVisibilities;
80 }; 93 };
81 94
82 #endif 95 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkDescriptorSetManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698