| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 fStats.incTextureCreates(); | 153 fStats.incTextureCreates(); |
| 154 if (srcData) { | 154 if (srcData) { |
| 155 fStats.incTextureUploads(); | 155 fStats.incTextureUploads(); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 return tex; | 158 return tex; |
| 159 } | 159 } |
| 160 | 160 |
| 161 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { | 161 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { |
| 162 this->handleDirtyContext(); | 162 this->handleDirtyContext(); |
| 163 if (!this->caps()->isConfigTexturable(desc.fConfig)) { |
| 164 return nullptr; |
| 165 } |
| 166 if ((desc.fFlags & kRenderTarget_GrBackendTextureFlag) && |
| 167 !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 168 return nullptr; |
| 169 } |
| 163 GrTexture* tex = this->onWrapBackendTexture(desc, ownership); | 170 GrTexture* tex = this->onWrapBackendTexture(desc, ownership); |
| 164 if (nullptr == tex) { | 171 if (nullptr == tex) { |
| 165 return nullptr; | 172 return nullptr; |
| 166 } | 173 } |
| 167 // TODO: defer this and attach dynamically | 174 // TODO: defer this and attach dynamically |
| 168 GrRenderTarget* tgt = tex->asRenderTarget(); | 175 GrRenderTarget* tgt = tex->asRenderTarget(); |
| 169 if (tgt && !fContext->resourceProvider()->attachStencilAttachment(tgt)) { | 176 if (tgt && !fContext->resourceProvider()->attachStencilAttachment(tgt)) { |
| 170 tex->unref(); | 177 tex->unref(); |
| 171 return nullptr; | 178 return nullptr; |
| 172 } else { | 179 } else { |
| 173 return tex; | 180 return tex; |
| 174 } | 181 } |
| 175 } | 182 } |
| 176 | 183 |
| 177 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, | 184 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, |
| 178 GrWrapOwnership ownership) { | 185 GrWrapOwnership ownership) { |
| 186 if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 187 return nullptr; |
| 188 } |
| 179 this->handleDirtyContext(); | 189 this->handleDirtyContext(); |
| 180 return this->onWrapBackendRenderTarget(desc, ownership); | 190 return this->onWrapBackendRenderTarget(desc, ownership); |
| 181 } | 191 } |
| 182 | 192 |
| 183 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { | 193 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { |
| 184 this->handleDirtyContext(); | 194 this->handleDirtyContext(); |
| 185 GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic); | 195 GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic); |
| 186 if (!this->caps()->reuseScratchBuffers()) { | 196 if (!this->caps()->reuseScratchBuffers()) { |
| 187 vb->resourcePriv().removeScratchKey(); | 197 vb->resourcePriv().removeScratchKey(); |
| 188 } | 198 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); | 360 this->xferBarrier(args.fPipeline->getRenderTarget(), barrierType); |
| 351 } | 361 } |
| 352 | 362 |
| 353 GrVertices::Iterator iter; | 363 GrVertices::Iterator iter; |
| 354 const GrNonInstancedVertices* verts = iter.init(vertices); | 364 const GrNonInstancedVertices* verts = iter.init(vertices); |
| 355 do { | 365 do { |
| 356 this->onDraw(args, *verts); | 366 this->onDraw(args, *verts); |
| 357 fStats.incNumDraws(); | 367 fStats.incNumDraws(); |
| 358 } while ((verts = iter.next())); | 368 } while ((verts = iter.next())); |
| 359 } | 369 } |
| OLD | NEW |