OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 fUsage)); | 121 fUsage)); |
122 if (CHECK_ALLOC_ERROR(gpu->glInterface()) != GR_GL_NO_ERROR) { | 122 if (CHECK_ALLOC_ERROR(gpu->glInterface()) != GR_GL_NO_ERROR) { |
123 GL_CALL(DeleteBuffers(1, &fBufferID)); | 123 GL_CALL(DeleteBuffers(1, &fBufferID)); |
124 fBufferID = 0; | 124 fBufferID = 0; |
125 } else { | 125 } else { |
126 fGLSizeInBytes = fSizeInBytes; | 126 fGLSizeInBytes = fSizeInBytes; |
127 } | 127 } |
128 } | 128 } |
129 } | 129 } |
130 VALIDATE(); | 130 VALIDATE(); |
131 this->registerWithCache(); | 131 this->registerWithCache(SkBudgeted::kYes); |
132 } | 132 } |
133 | 133 |
134 inline GrGLGpu* GrGLBuffer::glGpu() const { | 134 inline GrGLGpu* GrGLBuffer::glGpu() const { |
135 SkASSERT(!this->wasDestroyed()); | 135 SkASSERT(!this->wasDestroyed()); |
136 return static_cast<GrGLGpu*>(this->getGpu()); | 136 return static_cast<GrGLGpu*>(this->getGpu()); |
137 } | 137 } |
138 | 138 |
139 inline const GrGLCaps& GrGLBuffer::glCaps() const { | 139 inline const GrGLCaps& GrGLBuffer::glCaps() const { |
140 return this->glGpu()->glCaps(); | 140 return this->glGpu()->glCaps(); |
141 } | 141 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 void GrGLBuffer::validate() const { | 318 void GrGLBuffer::validate() const { |
319 // 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: |
320 // SkASSERT((0 == fDesc.fID) == (fCPUData)); | 320 // SkASSERT((0 == fDesc.fID) == (fCPUData)); |
321 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes); | 321 SkASSERT(0 != fBufferID || 0 == fGLSizeInBytes); |
322 SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes <= fSizeInBytes); | 322 SkASSERT(nullptr == fMapPtr || fCPUData || fGLSizeInBytes <= fSizeInBytes); |
323 SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr); | 323 SkASSERT(nullptr == fCPUData || nullptr == fMapPtr || fCPUData == fMapPtr); |
324 } | 324 } |
325 | 325 |
326 #endif | 326 #endif |
OLD | NEW |