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

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
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 uint32_t* visibilities,
jvanverth1 2016/08/23 20:43:07 Suggestion: use a const SkTArray<uint32_t>& rather
36 int visibilityCount);
37
32 ~GrVkDescriptorSetManager() {} 38 ~GrVkDescriptorSetManager() {}
33 39
34 void abandon(); 40 void abandon();
35 void release(const GrVkGpu* gpu); 41 void release(const GrVkGpu* gpu);
36 42
37 VkDescriptorSetLayout layout() const { return fPoolManager.fDescLayout; } 43 VkDescriptorSetLayout layout() const { return fPoolManager.fDescLayout; }
38 44
39 const GrVkDescriptorSet* getDescriptorSet(GrVkGpu* gpu, const Handle& handle ); 45 const GrVkDescriptorSet* getDescriptorSet(GrVkGpu* gpu, const Handle& handle );
40 46
41 void recycleDescriptorSet(const GrVkDescriptorSet*); 47 void recycleDescriptorSet(const GrVkDescriptorSet*);
42 48
43 bool isCompatible(VkDescriptorType type, const GrVkUniformHandler*) const; 49 bool isCompatible(VkDescriptorType type, const GrVkUniformHandler*) const;
50 bool isCompatible(VkDescriptorType type,
51 const uint32_t* visibilities,
52 int visibilityCount) const;
44 53
45 private: 54 private:
46 struct DescriptorPoolManager { 55 struct DescriptorPoolManager {
47 DescriptorPoolManager(VkDescriptorType type, GrVkGpu* gpu, 56 DescriptorPoolManager(VkDescriptorType type, GrVkGpu* gpu,
48 const GrVkUniformHandler* handler = nullptr); 57 const GrVkUniformHandler* handler = nullptr);
58 DescriptorPoolManager(VkDescriptorType type, GrVkGpu* gpu,
59 const uint32_t* visibilities, int visibilityCount) ;
60
49 61
50 ~DescriptorPoolManager() { 62 ~DescriptorPoolManager() {
51 SkASSERT(!fDescLayout); 63 SkASSERT(!fDescLayout);
52 SkASSERT(!fPool); 64 SkASSERT(!fPool);
53 } 65 }
54 66
55 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds); 67 void getNewDescriptorSet(GrVkGpu* gpu, VkDescriptorSet* ds);
56 68
57 void freeGPUResources(const GrVkGpu* gpu); 69 void freeGPUResources(const GrVkGpu* gpu);
58 void abandonGPUResources(); 70 void abandonGPUResources();
59 71
60 VkDescriptorSetLayout fDescLayout; 72 VkDescriptorSetLayout fDescLayout;
61 VkDescriptorType fDescType; 73 VkDescriptorType fDescType;
62 uint32_t fDescCountPerSet; 74 uint32_t fDescCountPerSet;
63 uint32_t fMaxDescriptors; 75 uint32_t fMaxDescriptors;
64 uint32_t fCurrentDescriptorCount; 76 uint32_t fCurrentDescriptorCount;
65 GrVkDescriptorPool* fPool; 77 GrVkDescriptorPool* fPool;
66 78
67 private: 79 private:
68 enum { 80 enum {
69 kUniformDescPerSet = 2, 81 kUniformDescPerSet = 2,
70 kMaxDescriptors = 1024, 82 kMaxDescriptors = 1024,
71 kStartNumDescriptors = 16, // must be less than kMaxUniformDescripto rs 83 kStartNumDescriptors = 16, // must be less than kMaxUniformDescripto rs
72 }; 84 };
73 85
86 void init(GrVkGpu* gpu, VkDescriptorType type, const GrVkUniformHandler* uniformHandler,
87 const uint32_t* visibilities, int visibilityCount);
88
74 void getNewPool(GrVkGpu* gpu); 89 void getNewPool(GrVkGpu* gpu);
75 }; 90 };
76 91
77 DescriptorPoolManager fPoolManager; 92 DescriptorPoolManager fPoolManager;
78 SkTArray<const GrVkDescriptorSet*, true> fFreeSets; 93 SkTArray<const GrVkDescriptorSet*, true> fFreeSets;
79 SkSTArray<4, uint32_t> fBindingVisibilities; 94 SkSTArray<4, uint32_t> fBindingVisibilities;
80 }; 95 };
81 96
82 #endif 97 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkDescriptorSetManager.cpp » ('j') | src/gpu/vk/GrVkDescriptorSetManager.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698