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

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

Issue 1877073002: Add optional data parameter to createBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « src/gpu/vk/GrVkGpu.h ('k') | tools/gpu/GrTest.cpp » ('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 "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 // Release old command buffer and create a new one 166 // Release old command buffer and create a new one
167 fCurrentCmdBuffer->unref(this); 167 fCurrentCmdBuffer->unref(this);
168 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); 168 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer();
169 SkASSERT(fCurrentCmdBuffer); 169 SkASSERT(fCurrentCmdBuffer);
170 170
171 fCurrentCmdBuffer->begin(this); 171 fCurrentCmdBuffer->begin(this);
172 } 172 }
173 173
174 /////////////////////////////////////////////////////////////////////////////// 174 ///////////////////////////////////////////////////////////////////////////////
175 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter n accessPattern) { 175 GrBuffer* GrVkGpu::onCreateBuffer(size_t size, GrBufferType type, GrAccessPatter n accessPattern,
176 const void* data) {
177 GrBuffer* buff;
176 switch (type) { 178 switch (type) {
177 case kVertex_GrBufferType: 179 case kVertex_GrBufferType:
178 SkASSERT(kDynamic_GrAccessPattern == accessPattern || 180 SkASSERT(kDynamic_GrAccessPattern == accessPattern ||
179 kStatic_GrAccessPattern == accessPattern); 181 kStatic_GrAccessPattern == accessPattern);
180 return GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); 182 buff = GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern);
181 case kIndex_GrBufferType: 183 case kIndex_GrBufferType:
182 SkASSERT(kDynamic_GrAccessPattern == accessPattern || 184 SkASSERT(kDynamic_GrAccessPattern == accessPattern ||
183 kStatic_GrAccessPattern == accessPattern); 185 kStatic_GrAccessPattern == accessPattern);
184 return GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); 186 buff = GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern);
185 case kXferCpuToGpu_GrBufferType: 187 case kXferCpuToGpu_GrBufferType:
186 SkASSERT(kStream_GrAccessPattern == accessPattern); 188 SkASSERT(kStream_GrAccessPattern == accessPattern);
187 return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_ Type); 189 buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_ Type);
188 case kXferGpuToCpu_GrBufferType: 190 case kXferGpuToCpu_GrBufferType:
189 SkASSERT(kStream_GrAccessPattern == accessPattern); 191 SkASSERT(kStream_GrAccessPattern == accessPattern);
190 return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite _Type); 192 buff = GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite _Type);
191 default: 193 default:
192 SkFAIL("Unknown buffer type."); 194 SkFAIL("Unknown buffer type.");
193 return nullptr; 195 return nullptr;
194 } 196 }
197 if (data && buff) {
198 buff->updateData(data, size);
199 }
200 return buff;
195 } 201 }
196 202
197 //////////////////////////////////////////////////////////////////////////////// 203 ////////////////////////////////////////////////////////////////////////////////
198 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 204 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
199 GrPixelConfig srcConfig, DrawPreference* draw Preference, 205 GrPixelConfig srcConfig, DrawPreference* draw Preference,
200 WritePixelTempDrawInfo* tempDrawInfo) { 206 WritePixelTempDrawInfo* tempDrawInfo) {
201 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) { 207 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) {
202 return false; 208 return false;
203 } 209 }
204 210
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 aglSwapBuffers(aglGetCurrentContext()); 1586 aglSwapBuffers(aglGetCurrentContext());
1581 int set_a_break_pt_here = 9; 1587 int set_a_break_pt_here = 9;
1582 aglSwapBuffers(aglGetCurrentContext()); 1588 aglSwapBuffers(aglGetCurrentContext());
1583 #elif defined(SK_BUILD_FOR_WIN32) 1589 #elif defined(SK_BUILD_FOR_WIN32)
1584 SwapBuf(); 1590 SwapBuf();
1585 int set_a_break_pt_here = 9; 1591 int set_a_break_pt_here = 9;
1586 SwapBuf(); 1592 SwapBuf();
1587 #endif 1593 #endif
1588 #endif 1594 #endif
1589 } 1595 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | tools/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698