aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGpuGL.cpp
diff options
context:
space:
mode:
authorGravatar piotaixr <piotaixr@chromium.org>2014-07-15 19:41:08 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-15 19:41:08 -0700
commit8339371f1ec3c57a0741932fd96bff32c53d4e54 (patch)
tree0b55a2a35986e75941aa517b62892c40c6ac553b /src/gpu/gl/GrGpuGL.cpp
parente51b6bd1f9910b676e26c9db930d25c651c96c71 (diff)
Caching the result of readPixelsSupported
The call was calling GR_GL_GetIntegerv 2 times for each readPixels and thus was causing a loss of performance (resubmit of issue 344793008) Benchmark url: http://packages.gkny.fr/tst/index.html BUG=skia:2681 Committed: https://skia.googlesource.com/skia/+/753a2964afe5661ce9b2a8ca77ca9d0aabd3173c R=junov@chromium.org, reed@chromium.org, bsalomon@chromium.org, mtklein@google.com, bsalomon@google.com Author: piotaixr@chromium.org Review URL: https://codereview.chromium.org/364193004
Diffstat (limited to 'src/gpu/gl/GrGpuGL.cpp')
-rw-r--r--src/gpu/gl/GrGpuGL.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index eddccc39f6..3eca3d6247 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -170,8 +170,6 @@ GrGpuGL::~GrGpuGL() {
}
///////////////////////////////////////////////////////////////////////////////
-
-
GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig,
GrPixelConfig surfaceConfig) const {
if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig) {
@@ -182,9 +180,13 @@ GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig,
// 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)) {
+ } 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;
@@ -713,7 +715,7 @@ bool GrGpuGL::uploadTexData(const GrGLTexture::Desc& desc,
}
// TODO: This function is using a lot of wonky semantics like, if width == -1
-// then set width = desc.fWdith ... blah. A better way to do it might be to
+// then set width = desc.fWdith ... blah. A better way to do it might be to
// create a CompressedTexData struct that takes a desc/ptr and figures out
// the proper upload semantics. Then users can construct this function how they
// see fit if they want to go against the "standard" way to do it.