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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 GrGpu::GrGpu(GrContext* context) | 45 GrGpu::GrGpu(GrContext* context) |
46 : fResetTimestamp(kExpiredTimestamp+1) | 46 : fResetTimestamp(kExpiredTimestamp+1) |
47 , fResetBits(kAll_GrBackendState) | 47 , fResetBits(kAll_GrBackendState) |
48 , fMultisampleSpecsAllocator(1) | 48 , fMultisampleSpecsAllocator(1) |
49 , fContext(context) { | 49 , fContext(context) { |
50 } | 50 } |
51 | 51 |
52 GrGpu::~GrGpu() {} | 52 GrGpu::~GrGpu() {} |
53 | 53 |
| 54 void GrGpu::initGpuResources() {} |
| 55 |
54 void GrGpu::disconnect(DisconnectType) {} | 56 void GrGpu::disconnect(DisconnectType) {} |
55 | 57 |
56 //////////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////////// |
57 | 59 |
58 bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParam
s& textureParams, | 60 bool GrGpu::makeCopyForTextureParams(int width, int height, const GrTextureParam
s& textureParams, |
59 GrTextureProducer::CopyParams* copyParams)
const { | 61 GrTextureProducer::CopyParams* copyParams)
const { |
60 const GrCaps& caps = *this->caps(); | 62 const GrCaps& caps = *this->caps(); |
61 if (textureParams.isTiled() && !caps.npotTextureTileSupport() && | 63 if (textureParams.isTiled() && !caps.npotTextureTileSupport() && |
62 (!SkIsPow2(width) || !SkIsPow2(height))) { | 64 (!SkIsPow2(width) || !SkIsPow2(height))) { |
63 copyParams->fWidth = GrNextPow2(width); | 65 copyParams->fWidth = GrNextPow2(width); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 230 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
229 return nullptr; | 231 return nullptr; |
230 } | 232 } |
231 int maxSize = this->caps()->maxTextureSize(); | 233 int maxSize = this->caps()->maxTextureSize(); |
232 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { | 234 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { |
233 return nullptr; | 235 return nullptr; |
234 } | 236 } |
235 return this->onWrapBackendTextureAsRenderTarget(desc); | 237 return this->onWrapBackendTextureAsRenderTarget(desc); |
236 } | 238 } |
237 | 239 |
238 GrBuffer* GrGpu::createBuffer(GrBufferType type, size_t size, GrAccessPattern ac
cessPattern) { | 240 GrBuffer* GrGpu::createBuffer(size_t size, GrBufferType intendedType, |
| 241 GrAccessPattern accessPattern) { |
239 this->handleDirtyContext(); | 242 this->handleDirtyContext(); |
240 GrBuffer* buffer = this->onCreateBuffer(type, size, accessPattern); | 243 GrBuffer* buffer = this->onCreateBuffer(size, intendedType, accessPattern); |
241 if (!this->caps()->reuseScratchBuffers()) { | 244 if (!this->caps()->reuseScratchBuffers()) { |
242 buffer->resourcePriv().removeScratchKey(); | 245 buffer->resourcePriv().removeScratchKey(); |
243 } | 246 } |
244 return buffer; | 247 return buffer; |
245 } | 248 } |
246 | 249 |
247 void GrGpu::clear(const SkIRect& rect, | 250 void GrGpu::clear(const SkIRect& rect, |
248 GrColor color, | 251 GrColor color, |
249 GrRenderTarget* renderTarget) { | 252 GrRenderTarget* renderTarget) { |
250 SkASSERT(renderTarget); | 253 SkASSERT(renderTarget); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 int meshCount) { | 483 int meshCount) { |
481 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { | 484 if (primProc.numAttribs() > this->caps()->maxVertexAttributes()) { |
482 fStats.incNumFailedDraws(); | 485 fStats.incNumFailedDraws(); |
483 return false; | 486 return false; |
484 } | 487 } |
485 this->handleDirtyContext(); | 488 this->handleDirtyContext(); |
486 | 489 |
487 this->onDraw(pipeline, primProc, meshes, meshCount); | 490 this->onDraw(pipeline, primProc, meshes, meshCount); |
488 return true; | 491 return true; |
489 } | 492 } |
OLD | NEW |