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

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

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: gyp 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
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 "GrVkUniformBuffer.h" 8 #include "GrVkUniformBuffer.h"
9 #include "GrVkGpu.h" 9 #include "GrVkGpu.h"
10 10
11 11
12 GrVkUniformBuffer* GrVkUniformBuffer::Create(GrVkGpu* gpu, size_t size, bool dyn amic) { 12 GrVkUniformBuffer* GrVkUniformBuffer::Create(GrVkGpu* gpu, size_t size, bool dyn amic) {
13 if (0 == size) { 13 if (0 == size) {
14 return nullptr; 14 return nullptr;
15 } 15 }
16 GrVkBuffer::Desc desc; 16 GrVkBuffer::Desc desc;
17 desc.fDynamic = dynamic; 17 desc.fAccessPattern = dynamic ? kDynamic_GrAccessPattern : kStatic_GrAccessP attern;
18 desc.fType = GrVkBuffer::kUniform_Type; 18 desc.fType = kUniform_GrBufferType;
19 desc.fSizeInBytes = size; 19 desc.fSizeInBytes = size;
20 20
21 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc); 21 const GrVkBuffer::Resource* bufferResource = GrVkBuffer::Create(gpu, desc);
22 if (!bufferResource) { 22 if (!bufferResource) {
23 return nullptr; 23 return nullptr;
24 } 24 }
25 25
26 GrVkUniformBuffer* buffer = new GrVkUniformBuffer(desc, bufferResource); 26 GrVkUniformBuffer* buffer = new GrVkUniformBuffer(gpu, desc, bufferResource) ;
27 if (!buffer) { 27 if (!buffer) {
28 bufferResource->unref(gpu); 28 bufferResource->unref(gpu);
29 } 29 }
30 return buffer; 30 return buffer;
31 } 31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698