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 if (!desc.fDynamic) { | 48 bufInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; |
49 bufInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; | |
50 } | |
51 | 49 |
52 bufInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; | 50 bufInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; |
53 bufInfo.queueFamilyIndexCount = 0; | 51 bufInfo.queueFamilyIndexCount = 0; |
54 bufInfo.pQueueFamilyIndices = nullptr; | 52 bufInfo.pQueueFamilyIndices = nullptr; |
55 | 53 |
56 VkResult err; | 54 VkResult err; |
57 err = VK_CALL(gpu, CreateBuffer(gpu->device(), &bufInfo, nullptr, &buffer)); | 55 err = VK_CALL(gpu, CreateBuffer(gpu->device(), &bufInfo, nullptr, &buffer)); |
58 if (err) { | 56 if (err) { |
59 return nullptr; | 57 return nullptr; |
60 } | 58 } |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 this->internalUnmap(gpu, srcSizeInBytes); | 213 this->internalUnmap(gpu, srcSizeInBytes); |
216 | 214 |
217 return true; | 215 return true; |
218 } | 216 } |
219 | 217 |
220 void GrVkBuffer::validate() const { | 218 void GrVkBuffer::validate() const { |
221 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type | 219 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f
Type |
222 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType | 220 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType |
223 || kUniform_Type == fDesc.fType); | 221 || kUniform_Type == fDesc.fType); |
224 } | 222 } |
OLD | NEW |