OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |