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 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 // texture. | 2391 // texture. |
2392 fHWBoundTextures[lastUnitIdx] = NULL; | 2392 fHWBoundTextures[lastUnitIdx] = NULL; |
2393 } | 2393 } |
2394 | 2394 |
2395 namespace { | 2395 namespace { |
2396 // Determines whether glBlitFramebuffer could be used between src and dst. | 2396 // Determines whether glBlitFramebuffer could be used between src and dst. |
2397 inline bool can_blit_framebuffer(const GrSurface* dst, | 2397 inline bool can_blit_framebuffer(const GrSurface* dst, |
2398 const GrSurface* src, | 2398 const GrSurface* src, |
2399 const GrGpuGL* gpu, | 2399 const GrGpuGL* gpu, |
2400 bool* wouldNeedTempFBO = NULL) { | 2400 bool* wouldNeedTempFBO = NULL) { |
2401 if (gpu->glCaps().isConfigRenderable(dst->config()) && | 2401 if (gpu->glCaps().isConfigRenderable(dst->config(), dst->desc().fSampleCnt >
0) && |
2402 gpu->glCaps().isConfigRenderable(src->config()) && | 2402 gpu->glCaps().isConfigRenderable(src->config(), src->desc().fSampleCnt >
0) && |
2403 gpu->glCaps().usesMSAARenderBuffers()) { | 2403 gpu->glCaps().usesMSAARenderBuffers()) { |
2404 // ES3 doesn't allow framebuffer blits when the src has MSAA and the con
figs don't match | 2404 // ES3 doesn't allow framebuffer blits when the src has MSAA and the con
figs don't match |
2405 // or the rects are not the same (not just the same size but have the sa
me edges). | 2405 // or the rects are not the same (not just the same size but have the sa
me edges). |
2406 if (GrGLCaps::kES_3_0_MSFBOType == gpu->glCaps().msFBOType() && | 2406 if (GrGLCaps::kES_3_0_MSFBOType == gpu->glCaps().msFBOType() && |
2407 (src->desc().fSampleCnt > 0 || src->config() != dst->config())) { | 2407 (src->desc().fSampleCnt > 0 || src->config() != dst->config())) { |
2408 return false; | 2408 return false; |
2409 } | 2409 } |
2410 if (NULL != wouldNeedTempFBO) { | 2410 if (NULL != wouldNeedTempFBO) { |
2411 *wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->as
RenderTarget(); | 2411 *wouldNeedTempFBO = NULL == dst->asRenderTarget() || NULL == src->as
RenderTarget(); |
2412 } | 2412 } |
(...skipping 19 matching lines...) Expand all Loading... |
2432 // then we don't want to copy to the texture but to the MSAA buffer. | 2432 // then we don't want to copy to the texture but to the MSAA buffer. |
2433 if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) { | 2433 if (NULL != dstRT && dstRT->renderFBOID() != dstRT->textureFBOID()) { |
2434 return false; | 2434 return false; |
2435 } | 2435 } |
2436 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as
RenderTarget()); | 2436 const GrGLRenderTarget* srcRT = static_cast<const GrGLRenderTarget*>(src->as
RenderTarget()); |
2437 // If the src is multisampled (and uses an extension where there is a separa
te MSAA | 2437 // If the src is multisampled (and uses an extension where there is a separa
te MSAA |
2438 // renderbuffer) then it is an invalid operation to call CopyTexSubImage | 2438 // renderbuffer) then it is an invalid operation to call CopyTexSubImage |
2439 if (NULL != srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { | 2439 if (NULL != srcRT && srcRT->renderFBOID() != srcRT->textureFBOID()) { |
2440 return false; | 2440 return false; |
2441 } | 2441 } |
2442 if (gpu->glCaps().isConfigRenderable(src->config()) && NULL != dst->asTextur
e() && | 2442 if (gpu->glCaps().isConfigRenderable(src->config(), src->desc().fSampleCnt >
0) && |
2443 dst->origin() == src->origin() && kIndex_8_GrPixelConfig != src->config(
)) { | 2443 NULL != dst->asTexture() && |
| 2444 dst->origin() == src->origin() && |
| 2445 kIndex_8_GrPixelConfig != src->config()) { |
2444 if (NULL != wouldNeedTempFBO) { | 2446 if (NULL != wouldNeedTempFBO) { |
2445 *wouldNeedTempFBO = NULL == src->asRenderTarget(); | 2447 *wouldNeedTempFBO = NULL == src->asRenderTarget(); |
2446 } | 2448 } |
2447 return true; | 2449 return true; |
2448 } else { | 2450 } else { |
2449 return false; | 2451 return false; |
2450 } | 2452 } |
2451 } | 2453 } |
2452 | 2454 |
2453 // If a temporary FBO was created, its non-zero ID is returned. The viewport tha
t the copy rect is | 2455 // If a temporary FBO was created, its non-zero ID is returned. The viewport tha
t the copy rect is |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 this->setVertexArrayID(gpu, 0); | 2674 this->setVertexArrayID(gpu, 0); |
2673 } | 2675 } |
2674 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2676 int attrCount = gpu->glCaps().maxVertexAttributes(); |
2675 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2677 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
2676 fDefaultVertexArrayAttribState.resize(attrCount); | 2678 fDefaultVertexArrayAttribState.resize(attrCount); |
2677 } | 2679 } |
2678 attribState = &fDefaultVertexArrayAttribState; | 2680 attribState = &fDefaultVertexArrayAttribState; |
2679 } | 2681 } |
2680 return attribState; | 2682 return attribState; |
2681 } | 2683 } |
OLD | NEW |