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 #include "GrGLGpu.h" | 8 #include "GrGLGpu.h" |
| 9 #include "GrGLGLSL.h" | 9 #include "GrGLGLSL.h" |
| 10 #include "GrGLStencilAttachment.h" | 10 #include "GrGLStencilAttachment.h" |
| (...skipping 2542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2553 // For now keep assuming the draw is not a format transformation, just a draw to get to a | 2553 // For now keep assuming the draw is not a format transformation, just a draw to get to a |
| 2554 // RT. We may add additional transformations below. | 2554 // RT. We may add additional transformations below. |
| 2555 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); | 2555 ElevateDrawPreference(drawPreference, kRequireDraw_DrawPreference); |
| 2556 } | 2556 } |
| 2557 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig == readConfig && | 2557 if (this->glCaps().rgba8888PixelsOpsAreSlow() && kRGBA_8888_GrPixelConfig == readConfig && |
| 2558 this->readPixelsSupported(kBGRA_8888_GrPixelConfig, kBGRA_8888_GrPixelCo nfig)) { | 2558 this->readPixelsSupported(kBGRA_8888_GrPixelConfig, kBGRA_8888_GrPixelCo nfig)) { |
| 2559 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; | 2559 tempDrawInfo->fTempSurfaceDesc.fConfig = kBGRA_8888_GrPixelConfig; |
| 2560 tempDrawInfo->fSwizzle = GrSwizzle::BGRA(); | 2560 tempDrawInfo->fSwizzle = GrSwizzle::BGRA(); |
| 2561 tempDrawInfo->fReadConfig = kBGRA_8888_GrPixelConfig; | 2561 tempDrawInfo->fReadConfig = kBGRA_8888_GrPixelConfig; |
| 2562 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 2562 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
| 2563 } else if (kMesa_GrGLDriver == this->glContext().driver() && | 2563 } else if (this->glCaps().rgbaToBgraReadbackConversionsAreSlow() && |
| 2564 GrBytesPerPixel(readConfig) == 4 && | 2564 GrBytesPerPixel(readConfig) == 4 && |
| 2565 GrPixelConfigSwapRAndB(readConfig) == srcConfig && | 2565 GrPixelConfigSwapRAndB(readConfig) == srcConfig && |
| 2566 this->readPixelsSupported(srcSurface, srcConfig)) { | 2566 this->readPixelsSupported(srcSurface, srcConfig)) { |
| 2567 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA surf ace and vice-versa. | 2567 // Mesa 3D takes a slow path on when reading back BGRA from an RGBA surf ace and vice-versa. |
|
reed1
2016/03/12 11:06:36
Possibly we should update the comment to refer to
| |
| 2568 // Better to do a draw with a R/B swap and then read as the original con fig. | 2568 // Better to do a draw with a R/B swap and then read as the original con fig. |
| 2569 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; | 2569 tempDrawInfo->fTempSurfaceDesc.fConfig = srcConfig; |
| 2570 tempDrawInfo->fSwizzle = GrSwizzle::BGRA(); | 2570 tempDrawInfo->fSwizzle = GrSwizzle::BGRA(); |
| 2571 tempDrawInfo->fReadConfig = srcConfig; | 2571 tempDrawInfo->fReadConfig = srcConfig; |
| 2572 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); | 2572 ElevateDrawPreference(drawPreference, kGpuPrefersDraw_DrawPreference); |
| 2573 } else if (!this->readPixelsSupported(srcSurface, readConfig)) { | 2573 } else if (!this->readPixelsSupported(srcSurface, readConfig)) { |
| 2574 if (readConfig == kBGRA_8888_GrPixelConfig && | 2574 if (readConfig == kBGRA_8888_GrPixelConfig && |
| 2575 this->glCaps().isConfigRenderable(kRGBA_8888_GrPixelConfig, false) & & | 2575 this->glCaps().isConfigRenderable(kRGBA_8888_GrPixelConfig, false) & & |
| 2576 this->readPixelsSupported(kRGBA_8888_GrPixelConfig, kRGBA_8888_GrPix elConfig)) { | 2576 this->readPixelsSupported(kRGBA_8888_GrPixelConfig, kRGBA_8888_GrPix elConfig)) { |
| 2577 // We're trying to read BGRA but it's not supported. If RGBA is rend erable and | 2577 // We're trying to read BGRA but it's not supported. If RGBA is rend erable and |
| (...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4352 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || | 4352 if (GR_GL_TEXTURE_EXTERNAL == glTexture->target() || |
| 4353 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { | 4353 GR_GL_TEXTURE_RECTANGLE == glTexture->target()) { |
| 4354 copyParams->fFilter = GrTextureParams::kNone_FilterMode; | 4354 copyParams->fFilter = GrTextureParams::kNone_FilterMode; |
| 4355 copyParams->fWidth = texture->width(); | 4355 copyParams->fWidth = texture->width(); |
| 4356 copyParams->fHeight = texture->height(); | 4356 copyParams->fHeight = texture->height(); |
| 4357 return true; | 4357 return true; |
| 4358 } | 4358 } |
| 4359 } | 4359 } |
| 4360 return false; | 4360 return false; |
| 4361 } | 4361 } |
| OLD | NEW |