| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // FBO status. | 168 // FBO status. |
| 169 this->clearStencil(rt); | 169 this->clearStencil(rt); |
| 170 GrStencilAttachment* sb = rt->renderTargetPriv().getStencilAttachment(); | 170 GrStencilAttachment* sb = rt->renderTargetPriv().getStencilAttachment(); |
| 171 sb->resourcePriv().setUniqueKey(sbKey); | 171 sb->resourcePriv().setUniqueKey(sbKey); |
| 172 return true; | 172 return true; |
| 173 } else { | 173 } else { |
| 174 return false; | 174 return false; |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc) { | 178 GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn
ership ownership) { |
| 179 this->handleDirtyContext(); | 179 this->handleDirtyContext(); |
| 180 GrTexture* tex = this->onWrapBackendTexture(desc); | 180 GrTexture* tex = this->onWrapBackendTexture(desc, ownership); |
| 181 if (NULL == tex) { | 181 if (NULL == tex) { |
| 182 return NULL; | 182 return NULL; |
| 183 } | 183 } |
| 184 // TODO: defer this and attach dynamically | 184 // TODO: defer this and attach dynamically |
| 185 GrRenderTarget* tgt = tex->asRenderTarget(); | 185 GrRenderTarget* tgt = tex->asRenderTarget(); |
| 186 if (tgt && !this->attachStencilAttachmentToRenderTarget(tgt)) { | 186 if (tgt && !this->attachStencilAttachmentToRenderTarget(tgt)) { |
| 187 tex->unref(); | 187 tex->unref(); |
| 188 return NULL; | 188 return NULL; |
| 189 } else { | 189 } else { |
| 190 return tex; | 190 return tex; |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc) { | 194 GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc&
desc, |
| 195 GrWrapOwnership ownership) { |
| 195 this->handleDirtyContext(); | 196 this->handleDirtyContext(); |
| 196 return this->onWrapBackendRenderTarget(desc); | 197 return this->onWrapBackendRenderTarget(desc, ownership); |
| 197 } | 198 } |
| 198 | 199 |
| 199 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { | 200 GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { |
| 200 this->handleDirtyContext(); | 201 this->handleDirtyContext(); |
| 201 return this->onCreateVertexBuffer(size, dynamic); | 202 return this->onCreateVertexBuffer(size, dynamic); |
| 202 } | 203 } |
| 203 | 204 |
| 204 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { | 205 GrIndexBuffer* GrGpu::createIndexBuffer(size_t size, bool dynamic) { |
| 205 this->handleDirtyContext(); | 206 this->handleDirtyContext(); |
| 206 return this->onCreateIndexBuffer(size, dynamic); | 207 return this->onCreateIndexBuffer(size, dynamic); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 //////////////////////////////////////////////////////////////////////////////// | 296 //////////////////////////////////////////////////////////////////////////////// |
| 296 | 297 |
| 297 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { | 298 void GrGpu::draw(const DrawArgs& args, const GrVertices& vertices) { |
| 298 this->handleDirtyContext(); | 299 this->handleDirtyContext(); |
| 299 GrVertices::Iterator iter; | 300 GrVertices::Iterator iter; |
| 300 const GrNonInstancedVertices* verts = iter.init(vertices); | 301 const GrNonInstancedVertices* verts = iter.init(vertices); |
| 301 do { | 302 do { |
| 302 this->onDraw(args, *verts); | 303 this->onDraw(args, *verts); |
| 303 } while ((verts = iter.next())); | 304 } while ((verts = iter.next())); |
| 304 } | 305 } |
| OLD | NEW |