OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, | 214 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, |
215 GrWrapOwnership ownership) { | 215 GrWrapOwnership ownership) { |
216 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 216 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
217 return nullptr; | 217 return nullptr; |
218 } | 218 } |
219 this->handleDirtyContext(); | 219 this->handleDirtyContext(); |
220 return this->onWrapBackendRenderTarget(desc, ownership); | 220 return this->onWrapBackendRenderTarget(desc, ownership); |
221 } | 221 } |
222 | 222 |
223 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc, | 223 GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDe
sc& desc) { |
224 GrWrapOwnership ownershi
p) { | |
225 this->handleDirtyContext(); | 224 this->handleDirtyContext(); |
226 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { | 225 if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
227 return nullptr; | 226 return nullptr; |
228 } | 227 } |
229 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 228 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
230 return nullptr; | 229 return nullptr; |
231 } | 230 } |
232 int maxSize = this->caps()->maxTextureSize(); | 231 int maxSize = this->caps()->maxTextureSize(); |
233 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { | 232 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { |
234 return nullptr; | 233 return nullptr; |
235 } | 234 } |
236 return this->onWrapBackendTextureAsRenderTarget(desc, ownership); | 235 return this->onWrapBackendTextureAsRenderTarget(desc); |
237 } | 236 } |
238 | 237 |
239 GrBuffer* GrGpu::createBuffer(GrBufferType type, size_t size, GrAccessPattern ac
cessPattern) { | 238 GrBuffer* GrGpu::createBuffer(GrBufferType type, size_t size, GrAccessPattern ac
cessPattern) { |
240 this->handleDirtyContext(); | 239 this->handleDirtyContext(); |
241 GrBuffer* buffer = this->onCreateBuffer(type, size, accessPattern); | 240 GrBuffer* buffer = this->onCreateBuffer(type, size, accessPattern); |
242 if (!this->caps()->reuseScratchBuffers()) { | 241 if (!this->caps()->reuseScratchBuffers()) { |
243 buffer->resourcePriv().removeScratchKey(); | 242 buffer->resourcePriv().removeScratchKey(); |
244 } | 243 } |
245 return buffer; | 244 return buffer; |
246 } | 245 } |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 int meshCount) { | 480 int meshCount) { |
482 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { | 481 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { |
483 fStats.incNumFailedDraws(); | 482 fStats.incNumFailedDraws(); |
484 return false; | 483 return false; |
485 } | 484 } |
486 this->handleDirtyContext(); | 485 this->handleDirtyContext(); |
487 | 486 |
488 this->onDraw(pipeline, primProc, meshes, meshCount); | 487 this->onDraw(pipeline, primProc, meshes, meshCount); |
489 return true; | 488 return true; |
490 } | 489 } |
OLD | NEW |