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

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

Issue 1831133004: Revert of Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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 | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkIndexBuffer.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 "GrVkGpu.h" 8 #include "GrVkGpu.h"
9 9
10 #include "GrContextOptions.h" 10 #include "GrContextOptions.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 // Release old command buffer and create a new one 165 // Release old command buffer and create a new one
166 fCurrentCmdBuffer->unref(this); 166 fCurrentCmdBuffer->unref(this);
167 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer(); 167 fCurrentCmdBuffer = fResourceProvider.createCommandBuffer();
168 SkASSERT(fCurrentCmdBuffer); 168 SkASSERT(fCurrentCmdBuffer);
169 169
170 fCurrentCmdBuffer->begin(this); 170 fCurrentCmdBuffer->begin(this);
171 } 171 }
172 172
173 /////////////////////////////////////////////////////////////////////////////// 173 ///////////////////////////////////////////////////////////////////////////////
174 GrBuffer* GrVkGpu::onCreateBuffer(GrBufferType type, size_t size, GrAccessPatter n accessPattern) { 174 GrVertexBuffer* GrVkGpu::onCreateVertexBuffer(size_t size, bool dynamic) {
175 switch (type) { 175 return GrVkVertexBuffer::Create(this, size, dynamic);
176 case kVertex_GrBufferType: 176 }
177 SkASSERT(kDynamic_GrAccessPattern == accessPattern || 177
178 kStatic_GrAccessPattern == accessPattern); 178 GrIndexBuffer* GrVkGpu::onCreateIndexBuffer(size_t size, bool dynamic) {
179 return GrVkVertexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); 179 return GrVkIndexBuffer::Create(this, size, dynamic);
180 case kIndex_GrBufferType: 180 }
181 SkASSERT(kDynamic_GrAccessPattern == accessPattern || 181
182 kStatic_GrAccessPattern == accessPattern); 182 GrTransferBuffer* GrVkGpu::onCreateTransferBuffer(size_t size, TransferType type ) {
183 return GrVkIndexBuffer::Create(this, size, kDynamic_GrAccessPattern == accessPattern); 183 GrVkBuffer::Type bufferType = kCpuToGpu_TransferType ? GrVkBuffer::kCopyRead _Type
184 case kXferCpuToGpu_GrBufferType: 184 : GrVkBuffer::kCopyWrit e_Type;
185 SkASSERT(kStream_GrAccessPattern == accessPattern); 185 return GrVkTransferBuffer::Create(this, size, bufferType);
186 return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyRead_ Type);
187 case kXferGpuToCpu_GrBufferType:
188 SkASSERT(kStream_GrAccessPattern == accessPattern);
189 return GrVkTransferBuffer::Create(this, size, GrVkBuffer::kCopyWrite _Type);
190 default:
191 SkFAIL("Unknown buffer type.");
192 return nullptr;
193 }
194 } 186 }
195 187
196 //////////////////////////////////////////////////////////////////////////////// 188 ////////////////////////////////////////////////////////////////////////////////
197 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, 189 bool GrVkGpu::onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height,
198 GrPixelConfig srcConfig, DrawPreference* draw Preference, 190 GrPixelConfig srcConfig, DrawPreference* draw Preference,
199 WritePixelTempDrawInfo* tempDrawInfo) { 191 WritePixelTempDrawInfo* tempDrawInfo) {
200 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) { 192 if (kIndex_8_GrPixelConfig == srcConfig || GrPixelConfigIsCompressed(dstSurf ace->config())) {
201 return false; 193 return false;
202 } 194 }
203 195
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT; 1210 VkAccessFlags dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
1219 tgt->setImageLayout(this, 1211 tgt->setImageLayout(this,
1220 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 1212 VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
1221 srcAccessMask, 1213 srcAccessMask,
1222 dstAccessMask, 1214 dstAccessMask,
1223 srcStageMask, 1215 srcStageMask,
1224 dstStageMask, 1216 dstStageMask,
1225 false); 1217 false);
1226 1218
1227 GrVkTransferBuffer* transferBuffer = 1219 GrVkTransferBuffer* transferBuffer =
1228 static_cast<GrVkTransferBuffer*>(this->createBuffer(kXferGpuToCpu_GrBuff erType, 1220 reinterpret_cast<GrVkTransferBuffer*>(this->createTransferBuffer(rowByte s * height,
1229 rowBytes * height, 1221 kGpuToC pu_TransferType));
1230 kStream_GrAccessPatt ern));
1231 1222
1232 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin(); 1223 bool flipY = kBottomLeft_GrSurfaceOrigin == surface->origin();
1233 VkOffset3D offset = { 1224 VkOffset3D offset = {
1234 left, 1225 left,
1235 flipY ? surface->height() - top - height : top, 1226 flipY ? surface->height() - top - height : top,
1236 0 1227 0
1237 }; 1228 };
1238 1229
1239 // Copy the image to a buffer so we can map it to cpu memory 1230 // Copy the image to a buffer so we can map it to cpu memory
1240 VkBufferImageCopy region; 1231 VkBufferImageCopy region;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 int set_a_break_pt_here = 9; 1421 int set_a_break_pt_here = 9;
1431 aglSwapBuffers(aglGetCurrentContext()); 1422 aglSwapBuffers(aglGetCurrentContext());
1432 #elif defined(SK_BUILD_FOR_WIN32) 1423 #elif defined(SK_BUILD_FOR_WIN32)
1433 SwapBuf(); 1424 SwapBuf();
1434 int set_a_break_pt_here = 9; 1425 int set_a_break_pt_here = 9;
1435 SwapBuf(); 1426 SwapBuf();
1436 #endif 1427 #endif
1437 #endif 1428 #endif
1438 } 1429 }
1439 1430
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkGpu.h ('k') | src/gpu/vk/GrVkIndexBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698