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

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

Issue 2127183002: Add offsets to GrVkBuffer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/GrVkGpu.cpp ('k') | no next file » | 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 uint32_t firstUniformWrite = 0; 232 uint32_t firstUniformWrite = 0;
233 uint32_t uniformBindingUpdateCount = 0; 233 uint32_t uniformBindingUpdateCount = 0;
234 234
235 VkDescriptorBufferInfo vertBufferInfo; 235 VkDescriptorBufferInfo vertBufferInfo;
236 // Vertex Uniform Buffer 236 // Vertex Uniform Buffer
237 if (fVertexUniformBuffer.get()) { 237 if (fVertexUniformBuffer.get()) {
238 ++uniformBindingUpdateCount; 238 ++uniformBindingUpdateCount;
239 memset(&vertBufferInfo, 0, sizeof(VkDescriptorBufferInfo)); 239 memset(&vertBufferInfo, 0, sizeof(VkDescriptorBufferInfo));
240 vertBufferInfo.buffer = fVertexUniformBuffer->buffer(); 240 vertBufferInfo.buffer = fVertexUniformBuffer->buffer();
241 vertBufferInfo.offset = 0; 241 vertBufferInfo.offset = fVertexUniformBuffer->offset();
242 vertBufferInfo.range = fVertexUniformBuffer->size(); 242 vertBufferInfo.range = fVertexUniformBuffer->size();
243 243
244 descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; 244 descriptorWrites[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
245 descriptorWrites[0].pNext = nullptr; 245 descriptorWrites[0].pNext = nullptr;
246 descriptorWrites[0].dstSet = fDescriptorSets[GrVkUniformHandler::kUnifor mBufferDescSet]; 246 descriptorWrites[0].dstSet = fDescriptorSets[GrVkUniformHandler::kUnifor mBufferDescSet];
247 descriptorWrites[0].dstBinding = GrVkUniformHandler::kVertexBinding; 247 descriptorWrites[0].dstBinding = GrVkUniformHandler::kVertexBinding;
248 descriptorWrites[0].dstArrayElement = 0; 248 descriptorWrites[0].dstArrayElement = 0;
249 descriptorWrites[0].descriptorCount = 1; 249 descriptorWrites[0].descriptorCount = 1;
250 descriptorWrites[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; 250 descriptorWrites[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
251 descriptorWrites[0].pImageInfo = nullptr; 251 descriptorWrites[0].pImageInfo = nullptr;
252 descriptorWrites[0].pBufferInfo = &vertBufferInfo; 252 descriptorWrites[0].pBufferInfo = &vertBufferInfo;
253 descriptorWrites[0].pTexelBufferView = nullptr; 253 descriptorWrites[0].pTexelBufferView = nullptr;
254 } 254 }
255 255
256 VkDescriptorBufferInfo fragBufferInfo; 256 VkDescriptorBufferInfo fragBufferInfo;
257 // Fragment Uniform Buffer 257 // Fragment Uniform Buffer
258 if (fFragmentUniformBuffer.get()) { 258 if (fFragmentUniformBuffer.get()) {
259 if (0 == uniformBindingUpdateCount) { 259 if (0 == uniformBindingUpdateCount) {
260 firstUniformWrite = 1; 260 firstUniformWrite = 1;
261 } 261 }
262 ++uniformBindingUpdateCount; 262 ++uniformBindingUpdateCount;
263 memset(&fragBufferInfo, 0, sizeof(VkDescriptorBufferInfo)); 263 memset(&fragBufferInfo, 0, sizeof(VkDescriptorBufferInfo));
264 fragBufferInfo.buffer = fFragmentUniformBuffer->buffer(); 264 fragBufferInfo.buffer = fFragmentUniformBuffer->buffer();
265 fragBufferInfo.offset = 0; 265 fragBufferInfo.offset = fFragmentUniformBuffer->offset();
266 fragBufferInfo.range = fFragmentUniformBuffer->size(); 266 fragBufferInfo.range = fFragmentUniformBuffer->size();
267 267
268 descriptorWrites[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; 268 descriptorWrites[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
269 descriptorWrites[1].pNext = nullptr; 269 descriptorWrites[1].pNext = nullptr;
270 descriptorWrites[1].dstSet = fDescriptorSets[GrVkUniformHandler::kUnifor mBufferDescSet]; 270 descriptorWrites[1].dstSet = fDescriptorSets[GrVkUniformHandler::kUnifor mBufferDescSet];
271 descriptorWrites[1].dstBinding = GrVkUniformHandler::kFragBinding;; 271 descriptorWrites[1].dstBinding = GrVkUniformHandler::kFragBinding;;
272 descriptorWrites[1].dstArrayElement = 0; 272 descriptorWrites[1].dstArrayElement = 0;
273 descriptorWrites[1].descriptorCount = 1; 273 descriptorWrites[1].descriptorCount = 1;
274 descriptorWrites[1].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; 274 descriptorWrites[1].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
275 descriptorWrites[1].pImageInfo = nullptr; 275 descriptorWrites[1].pImageInfo = nullptr;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 492
493 b.add32(get_blend_info_key(pipeline)); 493 b.add32(get_blend_info_key(pipeline));
494 494
495 b.add32(primitiveType); 495 b.add32(primitiveType);
496 496
497 // Set key length 497 // Set key length
498 int keyLength = key->count(); 498 int keyLength = key->count();
499 SkASSERT(0 == (keyLength % 4)); 499 SkASSERT(0 == (keyLength % 4));
500 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); 500 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
501 } 501 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698