OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrVkBuffer.h" | 8 #include "GrVkBuffer.h" |
9 #include "GrVkGpu.h" | 9 #include "GrVkGpu.h" |
10 #include "GrVkMemory.h" | 10 #include "GrVkMemory.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 case kUniform_Type: | 38 case kUniform_Type: |
39 bufInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; | 39 bufInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; |
40 break; | 40 break; |
41 case kCopyRead_Type: | 41 case kCopyRead_Type: |
42 bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; | 42 bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_SRC_BIT; |
43 break; | 43 break; |
44 case kCopyWrite_Type: | 44 case kCopyWrite_Type: |
45 bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; | 45 bufInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; |
46 break; | 46 break; |
47 } | 47 } |
48 bufInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; | 48 if (!desc.fDynamic) { |
| 49 bufInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; |
| 50 } |
49 | 51 |
50 bufInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; | 52 bufInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; |
51 bufInfo.queueFamilyIndexCount = 0; | 53 bufInfo.queueFamilyIndexCount = 0; |
52 bufInfo.pQueueFamilyIndices = nullptr; | 54 bufInfo.pQueueFamilyIndices = nullptr; |
53 | 55 |
54 VkResult err; | 56 VkResult err; |
55 err = VK_CALL(gpu, CreateBuffer(gpu->device(), &bufInfo, nullptr, &buffer)); | 57 err = VK_CALL(gpu, CreateBuffer(gpu->device(), &bufInfo, nullptr, &buffer)); |
56 if (err) { | 58 if (err) { |
57 return nullptr; | 59 return nullptr; |
58 } | 60 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 this->internalUnmap(gpu, srcSizeInBytes); | 215 this->internalUnmap(gpu, srcSizeInBytes); |
214 | 216 |
215 return true; | 217 return true; |
216 } | 218 } |
217 | 219 |
218 void GrVkBuffer::validate() const { | 220 void GrVkBuffer::validate() const { |
219 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type | 221 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type |
220 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType | 222 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType |
221 || kUniform_Type == fDesc.fType); | 223 || kUniform_Type == fDesc.fType); |
222 } | 224 } |
OLD | NEW |