Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2254 // many drivers would allow it to work, but ANGLE does not. | 2254 // many drivers would allow it to work, but ANGLE does not. |
| 2255 if (kES2_GrGLBinding == gpu->glBinding() && gpu->glCaps().bgraIsInternalForm at() && | 2255 if (kES2_GrGLBinding == gpu->glBinding() && gpu->glCaps().bgraIsInternalForm at() && |
| 2256 (kBGRA_8888_GrPixelConfig == dst->config() || kBGRA_8888_GrPixelConfig = = src->config())) { | 2256 (kBGRA_8888_GrPixelConfig == dst->config() || kBGRA_8888_GrPixelConfig = = src->config())) { |
| 2257 return false; | 2257 return false; |
| 2258 } | 2258 } |
| 2259 const GrGLRenderTarget* dstRT = static_cast<const GrGLRenderTarget*>(dst->as RenderTarget()); | 2259 const GrGLRenderTarget* dstRT = static_cast<const GrGLRenderTarget*>(dst->as RenderTarget()); |
| 2260 // If dst is multisampled (and uses an extension where there is a separate M SAA renderbuffer) | 2260 // If dst is multisampled (and uses an extension where there is a separate M SAA renderbuffer) |
| 2261 // then we don't want to copy to the texture but to the MSAA buffer. | 2261 // then we don't want to copy to the texture but to the MSAA buffer. |
| 2262 if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) { | 2262 if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) { |
| 2263 return false; | 2263 return false; |
| 2264 } | 2264 } |
|
robertphillips
2013/04/17 14:22:26
Does it make any sense to make this a test on GrSu
bsalomon
2013/04/18 18:09:33
Hmm... it's really a GL-specific thing.
| |
| 2265 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as RenderTarget()); | |
| 2266 // If the src is multisampled (and uses an extension where there is a separa te MSAA | |
| 2267 // renderbuffer) then it is an invalid operation to call CopyTexSubImage | |
| 2268 if (NULL != srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { | |
| 2269 return false; | |
| 2270 } | |
| 2265 if (gpu->isConfigRenderable(src->config()) && NULL != dst->asTexture() && | 2271 if (gpu->isConfigRenderable(src->config()) && NULL != dst->asTexture() && |
| 2266 dst->origin() == src->origin() && kIndex_8_GrPixelConfig != src->config( )) { | 2272 dst->origin() == src->origin() && kIndex_8_GrPixelConfig != src->config( )) { |
| 2267 if (NULL != wouldNeedTempFBO) { | 2273 if (NULL != wouldNeedTempFBO) { |
| 2268 *wouldNeedTempFBO = NULL == src->asRenderTarget(); | 2274 *wouldNeedTempFBO = NULL == src->asRenderTarget(); |
| 2269 } | 2275 } |
| 2270 return true; | 2276 return true; |
| 2271 } else { | 2277 } else { |
| 2272 return false; | 2278 return false; |
| 2273 } | 2279 } |
| 2274 } | 2280 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 2305 | 2311 |
| 2306 } | 2312 } |
| 2307 | 2313 |
| 2308 void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) { | 2314 void GrGpuGL::initCopySurfaceDstDesc(const GrSurface* src, GrTextureDesc* desc) { |
| 2309 // Check for format issues with glCopyTexSubImage2D | 2315 // Check for format issues with glCopyTexSubImage2D |
| 2310 if (kES2_GrGLBinding == this->glBinding() && this->glCaps().bgraIsInternalFo rmat() && | 2316 if (kES2_GrGLBinding == this->glBinding() && this->glCaps().bgraIsInternalFo rmat() && |
| 2311 kBGRA_8888_GrPixelConfig == src->config()) { | 2317 kBGRA_8888_GrPixelConfig == src->config()) { |
| 2312 // glCopyTexSubImage2D doesn't work with this config. We'll want to make it a render target | 2318 // glCopyTexSubImage2D doesn't work with this config. We'll want to make it a render target |
| 2313 // in order to call glBlitFramebuffer or to copy to it by rendering. | 2319 // in order to call glBlitFramebuffer or to copy to it by rendering. |
| 2314 INHERITED::initCopySurfaceDstDesc(src, desc); | 2320 INHERITED::initCopySurfaceDstDesc(src, desc); |
| 2321 return; | |
| 2315 } else if (NULL == src->asRenderTarget()) { | 2322 } else if (NULL == src->asRenderTarget()) { |
| 2316 // We don't want to have to create an FBO just to use glCopyTexSubImage2 D. Let the base | 2323 // We don't want to have to create an FBO just to use glCopyTexSubImage2 D. Let the base |
| 2317 // class handle it by rendering. | 2324 // class handle it by rendering. |
| 2318 INHERITED::initCopySurfaceDstDesc(src, desc); | 2325 INHERITED::initCopySurfaceDstDesc(src, desc); |
| 2326 return; | |
| 2327 } | |
| 2328 | |
| 2329 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as RenderTarget()); | |
| 2330 if (NULL != srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { | |
| 2331 // It's illegal to call CopyTexSubImage2D on a MSAA renderbuffer. | |
| 2332 INHERITED::initCopySurfaceDstDesc(src, desc); | |
| 2319 } else { | 2333 } else { |
| 2320 desc->fConfig = src->config(); | 2334 desc->fConfig = src->config(); |
| 2321 desc->fOrigin = src->origin(); | 2335 desc->fOrigin = src->origin(); |
| 2322 desc->fFlags = kNone_GrTextureFlags; | 2336 desc->fFlags = kNone_GrTextureFlags; |
| 2323 } | 2337 } |
| 2324 } | 2338 } |
| 2325 | 2339 |
| 2326 bool GrGpuGL::onCopySurface(GrSurface* dst, | 2340 bool GrGpuGL::onCopySurface(GrSurface* dst, |
| 2327 GrSurface* src, | 2341 GrSurface* src, |
| 2328 const SkIRect& srcRect, | 2342 const SkIRect& srcRect, |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2487 this->setVertexArrayID(gpu, 0); | 2501 this->setVertexArrayID(gpu, 0); |
| 2488 } | 2502 } |
| 2489 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2503 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2490 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2504 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2491 fDefaultVertexArrayAttribState.resize(attrCount); | 2505 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2492 } | 2506 } |
| 2493 attribState = &fDefaultVertexArrayAttribState; | 2507 attribState = &fDefaultVertexArrayAttribState; |
| 2494 } | 2508 } |
| 2495 return attribState; | 2509 return attribState; |
| 2496 } | 2510 } |
| OLD | NEW |