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

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

Issue 1904723003: Revert of Use transfer buffer for BatchAtlas texture copies (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/batches/GrDrawBatch.h ('k') | src/gpu/gl/GrGLCaps.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 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
39 bool cpuBacked = gpu->glCaps().useNonVBOVertexAndIndexDynamicData() && 33 bool cpuBacked = gpu->glCaps().useNonVBOVertexAndIndexDynamicData() &&
40 GrBufferTypeIsVertexOrIndex(intendedType) && 34 GrBufferTypeIsVertexOrIndex(intendedType) &&
41 kDynamic_GrAccessPattern == accessPattern; 35 kDynamic_GrAccessPattern == accessPattern;
42 SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, acce ssPattern, 36 SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, acce ssPattern,
43 cpuBacked, data)); 37 cpuBacked, data));
44 if (!cpuBacked && 0 == buffer->bufferID()) { 38 if (!cpuBacked && 0 == buffer->bufferID()) {
45 return nullptr; 39 return nullptr;
46 } 40 }
47 return buffer.release(); 41 return buffer.release();
48 } 42 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 317
324 void GrGLBuffer::validate() const { 318 void GrGLBuffer::validate() const {
325 // The following assert isn't valid when the buffer has been abandoned: 319 // The following assert isn't valid when the buffer has been abandoned:
326 // SkASSERT((0 == fDesc.fID) == (fCPUData)); 320 // SkASSERT((0 == fDesc.fID) == (fCPUData));
327 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes); 321 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes);
328 SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes <= fSizeInBytes); 322 SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes <= fSizeInBytes);
329 SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr); 323 SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr);
330 } 324 }
331 325
332 #endif 326 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrDrawBatch.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698