aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-06-24 15:04:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-24 15:04:13 -0700
commit47c1ccbcd8e17efdc89a325e314c414a7c75846c (patch)
tree055fac27d0c76067ec1f2271dd9a5879450c0b18 /src
parenta981e740978aa032eaa0bb24839cd28ceaed3bdb (diff)
Revert of remove workaround for dx9 angle slow rgba pixel ops (patchset #1 id:1 of https://codereview.chromium.org/1207003002/)
Reason for revert: users are still on dx9 angle :( Original issue's description: > remove workaround for dx9 angle slow rgba pixel ops > > TBR=robertphillips@google.com > > Committed: https://skia.googlesource.com/skia/+/1e1adc33ba1acb9a2ad41c0a5a9b6166ee9d7a2a TBR=robertphillips@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1205183002
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrGpu.h3
-rw-r--r--src/gpu/gl/GrGLGpu.cpp27
2 files changed, 21 insertions, 9 deletions
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index d9c2e18bdb..3bb84a4485 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -148,7 +148,8 @@ public:
}
/**
- * Called before uploading writing pixels to a GrTexture.
+ * Called before uploading writing pixels to a GrTexture when the src pixel config doesn't
+ * match the texture's config.
*/
virtual bool canWriteTexturePixels(const GrTexture*, GrPixelConfig srcConfig) const = 0;
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 6366b44e24..20669b8e78 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -270,14 +270,21 @@ void GrGLGpu::contextAbandoned() {
///////////////////////////////////////////////////////////////////////////////
GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig,
GrPixelConfig surfaceConfig) const {
- if (kMesa_GrGLDriver == this->glContext().driver() &&
- GrBytesPerPixel(readConfig) == 4 && GrPixelConfigSwapRAndB(readConfig) == surfaceConfig) {
- // Mesa 3D takes a slow path on when reading back BGRA from an RGBA surface and vice-versa.
- // Perhaps this should be guarded by some compile-time or runtime check.
+ if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig) {
+ return kBGRA_8888_GrPixelConfig;
+ } else if (kMesa_GrGLDriver == this->glContext().driver() &&
+ GrBytesPerPixel(readConfig) == 4 &&
+ GrPixelConfigSwapRAndB(readConfig) == surfaceConfig) {
+ // Mesa 3D takes a slow path on when reading back BGRA from an RGBA surface and vice-versa.
+ // Perhaps this should be guarded by some compiletime or runtime check.
return surfaceConfig;
- } else if (readConfig == kBGRA_8888_GrPixelConfig &&
- !this->glCaps().readPixelsSupported(this->glInterface(), GR_GL_BGRA,
- GR_GL_UNSIGNED_BYTE, surfaceConfig)) {
+ } else if (readConfig == kBGRA_8888_GrPixelConfig
+ && !this->glCaps().readPixelsSupported(
+ this->glInterface(),
+ GR_GL_BGRA,
+ GR_GL_UNSIGNED_BYTE,
+ surfaceConfig
+ )) {
return kRGBA_8888_GrPixelConfig;
} else {
return readConfig;
@@ -286,7 +293,11 @@ GrPixelConfig GrGLGpu::preferredReadPixelsConfig(GrPixelConfig readConfig,
GrPixelConfig GrGLGpu::preferredWritePixelsConfig(GrPixelConfig writeConfig,
GrPixelConfig surfaceConfig) const {
- return writeConfig;
+ if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == writeConfig) {
+ return kBGRA_8888_GrPixelConfig;
+ } else {
+ return writeConfig;
+ }
}
bool GrGLGpu::canWriteTexturePixels(const GrTexture* texture, GrPixelConfig srcConfig) const {