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 "GrGLGpu.h" | 9 #include "GrGLGpu.h" |
10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { | 263 if (this->glCaps().shaderCaps()->pathRenderingSupport()) { |
264 this->glPathRendering()->abandonGpuResources(); | 264 this->glPathRendering()->abandonGpuResources(); |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 /////////////////////////////////////////////////////////////////////////////// | 268 /////////////////////////////////////////////////////////////////////////////// |
269 GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig, | 269 GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig, |
270 GrPixelConfig surfaceConfig) co
nst { | 270 GrPixelConfig surfaceConfig) co
nst { |
271 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { | 271 if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig
) { |
272 return kBGRA_8888_GrPixelConfig; | 272 return kBGRA_8888_GrPixelConfig; |
273 } else if (this->glContext().isMesa() && | 273 } else if (kMesa_GrGLDriver == this->glContext().driver() && |
274 GrBytesPerPixel(readConfig) == 4 && | 274 GrBytesPerPixel(readConfig) == 4 && |
275 GrPixelConfigSwapRAndB(readConfig) == surfaceConfig) { | 275 GrPixelConfigSwapRAndB(readConfig) == surfaceConfig) { |
276 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. | 276 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA sur
face and vice-versa. |
277 // Perhaps this should be guarded by some compiletime or runtime check. | 277 // Perhaps this should be guarded by some compiletime or runtime check. |
278 return surfaceConfig; | 278 return surfaceConfig; |
279 } else if (readConfig == kBGRA_8888_GrPixelConfig | 279 } else if (readConfig == kBGRA_8888_GrPixelConfig |
280 && !this->glCaps().readPixelsSupported( | 280 && !this->glCaps().readPixelsSupported( |
281 this->glInterface(), | 281 this->glInterface(), |
282 GR_GL_BGRA, | 282 GR_GL_BGRA, |
283 GR_GL_UNSIGNED_BYTE, | 283 GR_GL_UNSIGNED_BYTE, |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 | 1858 |
1859 uint32_t rtID = target->getUniqueID(); | 1859 uint32_t rtID = target->getUniqueID(); |
1860 if (fHWBoundRenderTargetUniqueID != rtID) { | 1860 if (fHWBoundRenderTargetUniqueID != rtID) { |
1861 fStats.incRenderTargetBinds(); | 1861 fStats.incRenderTargetBinds(); |
1862 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); | 1862 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, target->renderFBOID())); |
1863 #ifdef SK_DEBUG | 1863 #ifdef SK_DEBUG |
1864 // don't do this check in Chromium -- this is causing | 1864 // don't do this check in Chromium -- this is causing |
1865 // lots of repeated command buffer flushes when the compositor is | 1865 // lots of repeated command buffer flushes when the compositor is |
1866 // rendering with Ganesh, which is really slow; even too slow for | 1866 // rendering with Ganesh, which is really slow; even too slow for |
1867 // Debug mode. | 1867 // Debug mode. |
1868 if (!this->glContext().isChromium()) { | 1868 if (kChromium_GrGLDriver != this->glContext().driver()) { |
1869 GrGLenum status; | 1869 GrGLenum status; |
1870 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); | 1870 GL_CALL_RET(status, CheckFramebufferStatus(GR_GL_FRAMEBUFFER)); |
1871 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { | 1871 if (status != GR_GL_FRAMEBUFFER_COMPLETE) { |
1872 SkDebugf("GrGLGpu::flushRenderTarget glCheckFramebufferStatus %x
\n", status); | 1872 SkDebugf("GrGLGpu::flushRenderTarget glCheckFramebufferStatus %x
\n", status); |
1873 } | 1873 } |
1874 } | 1874 } |
1875 #endif | 1875 #endif |
1876 fHWBoundRenderTargetUniqueID = rtID; | 1876 fHWBoundRenderTargetUniqueID = rtID; |
1877 const GrGLIRect& vp = target->getViewport(); | 1877 const GrGLIRect& vp = target->getViewport(); |
1878 if (fHWViewport != vp) { | 1878 if (fHWViewport != vp) { |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3067 this->setVertexArrayID(gpu, 0); | 3067 this->setVertexArrayID(gpu, 0); |
3068 } | 3068 } |
3069 int attrCount = gpu->glCaps().maxVertexAttributes(); | 3069 int attrCount = gpu->glCaps().maxVertexAttributes(); |
3070 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 3070 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
3071 fDefaultVertexArrayAttribState.resize(attrCount); | 3071 fDefaultVertexArrayAttribState.resize(attrCount); |
3072 } | 3072 } |
3073 attribState = &fDefaultVertexArrayAttribState; | 3073 attribState = &fDefaultVertexArrayAttribState; |
3074 } | 3074 } |
3075 return attribState; | 3075 return attribState; |
3076 } | 3076 } |
OLD | NEW |