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

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

Issue 1835813003: Use NV glsl shader compiler for Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@cacheHash
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 | « no previous file | src/gpu/vk/GrVkCaps.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 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 bufInfo.queueFamilyIndexCount = 0; 50 bufInfo.queueFamilyIndexCount = 0;
51 bufInfo.pQueueFamilyIndices = nullptr; 51 bufInfo.pQueueFamilyIndices = nullptr;
52 52
53 VkResult err; 53 VkResult err;
54 err = VK_CALL(gpu, CreateBuffer(gpu->device(), &bufInfo, nullptr, &buffer)); 54 err = VK_CALL(gpu, CreateBuffer(gpu->device(), &bufInfo, nullptr, &buffer));
55 if (err) { 55 if (err) {
56 return nullptr; 56 return nullptr;
57 } 57 }
58 58
59 VkMemoryPropertyFlags requiredMemProps = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | 59 VkMemoryPropertyFlags requiredMemProps = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
60 VK_MEMORY_PROPERTY_HOST_COHERENT_BI T; 60 VK_MEMORY_PROPERTY_HOST_COHERENT_BI T |
61 VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
61 62
62 if (!GrVkMemory::AllocAndBindBufferMemory(gpu, 63 if (!GrVkMemory::AllocAndBindBufferMemory(gpu,
63 buffer, 64 buffer,
64 requiredMemProps, 65 requiredMemProps,
65 &alloc)) { 66 &alloc)) {
66 VK_CALL(gpu, DestroyBuffer(gpu->device(), buffer, nullptr)); 67 // Try again without requiring host cached memory
67 return nullptr; 68 requiredMemProps = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
69 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
70 if (!GrVkMemory::AllocAndBindBufferMemory(gpu,
71 buffer,
72 requiredMemProps,
73 &alloc)) {
74 VK_CALL(gpu, DestroyBuffer(gpu->device(), buffer, nullptr));
75 return nullptr;
76 }
68 } 77 }
69 78
70 const GrVkBuffer::Resource* resource = new GrVkBuffer::Resource(buffer, allo c); 79 const GrVkBuffer::Resource* resource = new GrVkBuffer::Resource(buffer, allo c);
71 if (!resource) { 80 if (!resource) {
72 VK_CALL(gpu, DestroyBuffer(gpu->device(), buffer, nullptr)); 81 VK_CALL(gpu, DestroyBuffer(gpu->device(), buffer, nullptr));
73 VK_CALL(gpu, FreeMemory(gpu->device(), alloc, nullptr)); 82 VK_CALL(gpu, FreeMemory(gpu->device(), alloc, nullptr));
74 return nullptr; 83 return nullptr;
75 } 84 }
76 85
77 return resource; 86 return resource;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 189
181 return true; 190 return true;
182 } 191 }
183 192
184 void GrVkBuffer::validate() const { 193 void GrVkBuffer::validate() const {
185 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f Type 194 SkASSERT(!fResource || kVertex_Type == fDesc.fType || kIndex_Type == fDesc.f Type
186 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType 195 || kCopyRead_Type == fDesc.fType || kCopyWrite_Type == fDesc.fType
187 || kUniform_Type == fDesc.fType); 196 || kUniform_Type == fDesc.fType);
188 } 197 }
189 198
OLDNEW
« no previous file with comments | « no previous file | src/gpu/vk/GrVkCaps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698