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

Side by Side Diff: src/gpu/vk/GrVkPipelineState.cpp

Issue 1872553005: Don't create new descriptor set for vulkan uniforms every draw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkPipelineStateDataManager.h » ('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 #include "GrVkPipelineState.h" 8 #include "GrVkPipelineState.h"
9 9
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 fXferProcessor->setData(fDataManager, pipeline.getXferProcessor()); 193 fXferProcessor->setData(fDataManager, pipeline.getXferProcessor());
194 append_texture_bindings(pipeline.getXferProcessor(), &textureBindings); 194 append_texture_bindings(pipeline.getXferProcessor(), &textureBindings);
195 195
196 // Get new descriptor sets 196 // Get new descriptor sets
197 if (fNumSamplers) { 197 if (fNumSamplers) {
198 fSamplerPoolManager.getNewDescriptorSet(gpu, 198 fSamplerPoolManager.getNewDescriptorSet(gpu,
199 &fDescriptorSets[GrVkUniformHandler ::kSamplerDescSet]); 199 &fDescriptorSets[GrVkUniformHandler ::kSamplerDescSet]);
200 this->writeSamplers(gpu, textureBindings); 200 this->writeSamplers(gpu, textureBindings);
201 } 201 }
202 202
203
204 if (fVertexUniformBuffer.get() || fFragmentUniformBuffer.get()) { 203 if (fVertexUniformBuffer.get() || fFragmentUniformBuffer.get()) {
205 fUniformPoolManager.getNewDescriptorSet(gpu, 204 if (fDataManager.uploadUniformBuffers(gpu, fVertexUniformBuffer, fFragme ntUniformBuffer) ||
205 VK_NULL_HANDLE == fDescriptorSets[GrVkUniformHandler::kUniformBuffer DescSet]) {
206 fUniformPoolManager.getNewDescriptorSet(gpu,
206 &fDescriptorSets[GrVkUniformHandler::kUni formBufferDescSet]); 207 &fDescriptorSets[GrVkUniformHandler::kUni formBufferDescSet]);
207 this->writeUniformBuffers(gpu); 208 this->writeUniformBuffers(gpu);
209 }
208 } 210 }
209 } 211 }
210 212
211 void GrVkPipelineState::writeUniformBuffers(const GrVkGpu* gpu) { 213 void GrVkPipelineState::writeUniformBuffers(const GrVkGpu* gpu) {
212 fDataManager.uploadUniformBuffers(gpu, fVertexUniformBuffer, fFragmentUnifor mBuffer);
213
214 VkWriteDescriptorSet descriptorWrites[2]; 214 VkWriteDescriptorSet descriptorWrites[2];
215 memset(descriptorWrites, 0, 2 * sizeof(VkWriteDescriptorSet)); 215 memset(descriptorWrites, 0, 2 * sizeof(VkWriteDescriptorSet));
216 216
217 uint32_t firstUniformWrite = 0; 217 uint32_t firstUniformWrite = 0;
218 uint32_t uniformBindingUpdateCount = 0; 218 uint32_t uniformBindingUpdateCount = 0;
219 219
220 VkDescriptorBufferInfo vertBufferInfo; 220 VkDescriptorBufferInfo vertBufferInfo;
221 // Vertex Uniform Buffer 221 // Vertex Uniform Buffer
222 if (fVertexUniformBuffer.get()) { 222 if (fVertexUniformBuffer.get()) {
223 ++uniformBindingUpdateCount; 223 ++uniformBindingUpdateCount;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 501
502 b.add32(get_blend_info_key(pipeline)); 502 b.add32(get_blend_info_key(pipeline));
503 503
504 b.add32(primitiveType); 504 b.add32(primitiveType);
505 505
506 // Set key length 506 // Set key length
507 int keyLength = key->count(); 507 int keyLength = key->count();
508 SkASSERT(0 == (keyLength % 4)); 508 SkASSERT(0 == (keyLength % 4));
509 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); 509 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
510 } 510 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkBuffer.cpp ('k') | src/gpu/vk/GrVkPipelineStateDataManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698