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

Side by Side Diff: src/gpu/gl/GrGLBuffer.cpp

Issue 1888473002: Use transfer buffer for BatchAtlas texture copies Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Chrome 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 2016 Google Inc. 2 * Copyright 2016 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 "GrGLBuffer.h" 8 #include "GrGLBuffer.h"
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "SkTraceMemoryDump.h" 10 #include "SkTraceMemoryDump.h"
(...skipping 12 matching lines...) Expand all
23 #endif 23 #endif
24 24
25 #ifdef SK_DEBUG 25 #ifdef SK_DEBUG
26 #define VALIDATE() this->validate() 26 #define VALIDATE() this->validate()
27 #else 27 #else
28 #define VALIDATE() do {} while(false) 28 #define VALIDATE() do {} while(false)
29 #endif 29 #endif
30 30
31 GrGLBuffer* GrGLBuffer::Create(GrGLGpu* gpu, size_t size, GrBufferType intendedT ype, 31 GrGLBuffer* GrGLBuffer::Create(GrGLGpu* gpu, size_t size, GrBufferType intendedT ype,
32 GrAccessPattern accessPattern, const void* data) { 32 GrAccessPattern accessPattern, const void* data) {
33 if (gpu->glCaps().transferBufferType() == GrGLCaps::kNone_TransferBufferType &&
34 (kXferCpuToGpu_GrBufferType == intendedType ||
35 kXferGpuToCpu_GrBufferType == intendedType)) {
36 return nullptr;
37 }
38
33 bool cpuBacked = gpu->glCaps().useNonVBOVertexAndIndexDynamicData() && 39 bool cpuBacked = gpu->glCaps().useNonVBOVertexAndIndexDynamicData() &&
34 GrBufferTypeIsVertexOrIndex(intendedType) && 40 GrBufferTypeIsVertexOrIndex(intendedType) &&
35 kDynamic_GrAccessPattern == accessPattern; 41 kDynamic_GrAccessPattern == accessPattern;
36 SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, acce ssPattern, 42 SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, acce ssPattern,
37 cpuBacked, data)); 43 cpuBacked, data));
38 if (!cpuBacked && 0 == buffer->bufferID()) { 44 if (!cpuBacked && 0 == buffer->bufferID()) {
39 return nullptr; 45 return nullptr;
40 } 46 }
41 return buffer.release(); 47 return buffer.release();
42 } 48 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 323
318 void GrGLBuffer::validate() const { 324 void GrGLBuffer::validate() const {
319 // The following assert isn't valid when the buffer has been abandoned: 325 // The following assert isn't valid when the buffer has been abandoned:
320 // SkASSERT((0 == fDesc.fID) == (fCPUData)); 326 // SkASSERT((0 == fDesc.fID) == (fCPUData));
321 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes); 327 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes);
322 SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes <= fSizeInBytes); 328 SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes <= fSizeInBytes);
323 SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr); 329 SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr);
324 } 330 }
325 331
326 #endif 332 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698