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

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: Rebase to ToT Created 4 years, 2 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/gl/GrGLAssembleInterface.cpp ('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
33 SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, acce ssPattern, data)); 39 SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, acce ssPattern, data));
34 if (0 == buffer->bufferID()) { 40 if (0 == buffer->bufferID()) {
35 return nullptr; 41 return nullptr;
36 } 42 }
37 return buffer.release(); 43 return buffer.release();
38 } 44 }
39 45
40 // GL_STREAM_DRAW triggers an optimization in Chromium's GPU process where a cli ent's vertex buffer 46 // GL_STREAM_DRAW triggers an optimization in Chromium's GPU process where a cli ent's vertex buffer
41 // objects are implemented as client-side-arrays on tile-deferred architectures. 47 // objects are implemented as client-side-arrays on tile-deferred architectures.
42 #define DYNAMIC_DRAW_PARAM GR_GL_STREAM_DRAW 48 #define DYNAMIC_DRAW_PARAM GR_GL_STREAM_DRAW
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 285 }
280 286
281 #ifdef SK_DEBUG 287 #ifdef SK_DEBUG
282 288
283 void GrGLBuffer::validate() const { 289 void GrGLBuffer::validate() const {
284 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes); 290 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes);
285 SkASSERT(nullptr == fMapPtr || fGLSizeInBytes <= this->sizeInBytes()); 291 SkASSERT(nullptr == fMapPtr || fGLSizeInBytes <= this->sizeInBytes());
286 } 292 }
287 293
288 #endif 294 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLAssembleInterface.cpp ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698