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

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

Issue 1927943002: Unify DescriptorPools for vulkan uniform descriptor sets (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use enum Created 4 years, 7 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
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Finds or creates a compatible GrVkSampler based on the GrTextureParams. 64 // Finds or creates a compatible GrVkSampler based on the GrTextureParams.
65 // The refcount is incremented and a pointer returned. 65 // The refcount is incremented and a pointer returned.
66 GrVkSampler* findOrCreateCompatibleSampler(const GrTextureParams&, uint32_t mipLevels); 66 GrVkSampler* findOrCreateCompatibleSampler(const GrTextureParams&, uint32_t mipLevels);
67 67
68 sk_sp<GrVkPipelineState> findOrCreateCompatiblePipelineState(const GrPipelin e&, 68 sk_sp<GrVkPipelineState> findOrCreateCompatiblePipelineState(const GrPipelin e&,
69 const GrPrimiti veProcessor&, 69 const GrPrimiti veProcessor&,
70 GrPrimitiveType , 70 GrPrimitiveType ,
71 const GrVkRende rPass& renderPass); 71 const GrVkRende rPass& renderPass);
72 72
73 // For all our GrVkPipelineState objects, we require a layout where the firs t set contains two
74 // uniform buffers, one for the vertex shader and one for the fragment shade r. Thus it is
75 // possible for us to use a shadered descriptor pool to allocate all these s imilar descriptor
76 // sets. The caller is responsible for reffing the outPool for as long as th e returned
77 // VkDescriptor set is in use.
78 void getUniformDescriptorSet(VkDescriptorSet*, const GrVkDescriptorPool** ou tPool);
79
80 // Returns the compatible VkDescriptorSetLayout to use for uniform buffers. The caller does not
81 // own the VkDescriptorSetLayout and thus should not delete it. This functio n should be used
82 // when the caller needs the layout to create a VkPipelineLayout.
83 VkDescriptorSetLayout getUniDSLayout() const { return fUniformDescLayout; }
84
73 // Destroy any cached resources. To be called before destroying the VkDevice . 85 // Destroy any cached resources. To be called before destroying the VkDevice .
74 // The assumption is that all queues are idle and all command buffers are fi nished. 86 // The assumption is that all queues are idle and all command buffers are fi nished.
75 // For resource tracing to work properly, this should be called after unrefi ng all other 87 // For resource tracing to work properly, this should be called after unrefi ng all other
76 // resource usages. 88 // resource usages.
77 void destroyResources(); 89 void destroyResources();
78 90
79 // Abandon any cached resources. To be used when the context/VkDevice is los t. 91 // Abandon any cached resources. To be used when the context/VkDevice is los t.
80 // For resource tracing to work properly, this should be called after unrefi ng all other 92 // For resource tracing to work properly, this should be called after unrefi ng all other
81 // resource usages. 93 // resource usages.
82 void abandonResources(); 94 void abandonResources();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 SkTInternalLList<Entry> fLRUList; 127 SkTInternalLList<Entry> fLRUList;
116 128
117 GrVkGpu* fGpu; 129 GrVkGpu* fGpu;
118 130
119 #ifdef GR_PIPELINE_STATE_CACHE_STATS 131 #ifdef GR_PIPELINE_STATE_CACHE_STATS
120 int fTotalRequests; 132 int fTotalRequests;
121 int fCacheMisses; 133 int fCacheMisses;
122 #endif 134 #endif
123 }; 135 };
124 136
137 // Initialiaze the vkDescriptorSetLayout used for allocating new uniform buf fer descritpor sets.
138 void initUniformDescObjects();
139
125 GrVkGpu* fGpu; 140 GrVkGpu* fGpu;
126 141
127 // Central cache for creating pipelines 142 // Central cache for creating pipelines
128 VkPipelineCache fPipelineCache; 143 VkPipelineCache fPipelineCache;
129 144
130 // Array of RenderPasses that only have a single color attachment, optional stencil attachment, 145 // Array of RenderPasses that only have a single color attachment, optional stencil attachment,
131 // optional resolve attachment, and only one subpass 146 // optional resolve attachment, and only one subpass
132 SkSTArray<4, GrVkRenderPass*> fSimpleRenderPasses; 147 SkSTArray<4, GrVkRenderPass*> fSimpleRenderPasses;
133 148
134 // Array of CommandBuffers that are currently in flight 149 // Array of CommandBuffers that are currently in flight
135 SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers; 150 SkSTArray<4, GrVkCommandBuffer*> fActiveCommandBuffers;
136 151
137 // Stores GrVkSampler objects that we've already created so we can reuse the m across multiple 152 // Stores GrVkSampler objects that we've already created so we can reuse the m across multiple
138 // GrVkPipelineStates 153 // GrVkPipelineStates
139 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers; 154 SkTDynamicHash<GrVkSampler, uint16_t> fSamplers;
140 155
141 // Cache of GrVkPipelineStates 156 // Cache of GrVkPipelineStates
142 PipelineStateCache* fPipelineStateCache; 157 PipelineStateCache* fPipelineStateCache;
158
159 // Current pool to allocate uniform descriptor sets from
160 const GrVkDescriptorPool* fUniformDescPool;
161 VkDescriptorSetLayout fUniformDescLayout;
162 //Curent number of uniform descriptors allocated from the pool
163 int fCurrentUniformDescCount;
164 int fCurrMaxUniDescriptors;
165
166 enum {
167 kMaxUniformDescriptors = 1024,
168 kNumUniformDescPerSet = 2,
169 kStartNumUniformDescriptors = 16, // must be less than kMaxUniformDescri ptors
170 };
143 }; 171 };
144 172
145 #endif 173 #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