aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2014-07-16 09:10:41 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-16 09:10:41 -0700
commitc7af812b4213105264af514d13ddbe631a89d171 (patch)
tree464123c0c764c1dd245da489a670633f0abf3426 /src/gpu/gl
parent33ac9506fba85373135d78212bdfaab597ba7ed7 (diff)
Revert of Reopened: Caching the result of readPixelsSupported (https://codereview.chromium.org/364193004/)
Reason for revert: This appears to be causing failures on Android when running tests. Original issue's description: > 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 > > Committed: https://skia.googlesource.com/skia/+/8339371f1ec3c57a0741932fd96bff32c53d4e54 R=junov@chromium.org, reed@chromium.org, bsalomon@chromium.org, mtklein@google.com, bsalomon@google.com, piotaixr@chromium.org TBR=bsalomon@chromium.org, bsalomon@google.com, junov@chromium.org, mtklein@google.com, piotaixr@chromium.org, reed@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia:2681 Author: bungeman@google.com Review URL: https://codereview.chromium.org/395203002
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLCaps.cpp30
-rw-r--r--src/gpu/gl/GrGLCaps.h50
-rw-r--r--src/gpu/gl/GrGpuGL.cpp14
3 files changed, 12 insertions, 82 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 89d873bdd8..8f2d4c1297 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -48,8 +48,6 @@ void GrGLCaps::reset() {
fIsCoreProfile = false;
fFullClearIsFree = false;
fDropsTileOnZeroDivide = false;
-
- fReadPixelsSupportedCache.reset();
}
GrGLCaps::GrGLCaps(const GrGLCaps& caps) : GrDrawTargetCaps() {
@@ -506,7 +504,7 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
// First check version for support
if (kGL_GrGLStandard == standard) {
hasETC1 = hasCompressTex2D &&
- (version >= GR_GL_VER(4, 3) ||
+ (version >= GR_GL_VER(4, 3) ||
ctxInfo.hasExtension("GL_ARB_ES3_compatibility"));
} else {
hasETC1 = hasCompressTex2D &&
@@ -562,9 +560,9 @@ void GrGLCaps::initConfigTexturableTable(const GrGLContextInfo& ctxInfo, const G
}
}
-bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,
- GrGLenum format,
- GrGLenum type) const {
+bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
+ GrGLenum format,
+ GrGLenum type) const {
if (GR_GL_RGBA == format && GR_GL_UNSIGNED_BYTE == type) {
// ES 2 guarantees this format is supported
return true;
@@ -591,26 +589,6 @@ bool GrGLCaps::doReadPixelsSupported(const GrGLInterface* intf,
return (GrGLenum)otherFormat == format && (GrGLenum)otherType == type;
}
-bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf,
- GrGLenum format,
- GrGLenum type,
- GrGLenum currFboFormat) const {
-
- ReadPixelsSupportedFormats::Key key = {format, type, currFboFormat};
-
- ReadPixelsSupportedFormats* cachedValue = fReadPixelsSupportedCache.find(key);
-
- if (NULL == cachedValue) {
- bool value = doReadPixelsSupported(intf, format, type);
- ReadPixelsSupportedFormats newValue(key, value);
- fReadPixelsSupportedCache.add(newValue);
-
- return newValue.value();
- }
-
- return cachedValue->value();
-}
-
void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) {
fMSFBOType = kNone_MSFBOType;
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 2d391b122c..ccf04fd7ba 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -11,9 +11,8 @@
#include "GrDrawTargetCaps.h"
#include "GrGLStencilBuffer.h"
-#include "SkChecksum.h"
-#include "SkTHashCache.h"
#include "SkTArray.h"
+#include "SkTDArray.h"
class GrGLContextInfo;
@@ -254,8 +253,7 @@ public:
/// Does ReadPixels support the provided format/type combo?
bool readPixelsSupported(const GrGLInterface* intf,
GrGLenum format,
- GrGLenum type,
- GrGLenum currFboFormat) const;
+ GrGLenum type) const;
bool isCoreProfile() const { return fIsCoreProfile; }
@@ -326,10 +324,6 @@ private:
void initConfigRenderableTable(const GrGLContextInfo&);
void initConfigTexturableTable(const GrGLContextInfo&, const GrGLInterface*);
- bool doReadPixelsSupported(const GrGLInterface* intf,
- GrGLenum format,
- GrGLenum type) const;
-
// tracks configs that have been verified to pass the FBO completeness when
// used as a color attachment
VerifiedColorConfigs fVerifiedColorConfigs;
@@ -370,46 +364,6 @@ private:
bool fFullClearIsFree : 1;
bool fDropsTileOnZeroDivide : 1;
- class ReadPixelsSupportedFormats {
- public:
- struct Key {
- GrGLenum fFormat;
- GrGLenum fType;
- GrGLenum fFboFormat;
-
- bool operator==(const Key& rhs) const {
- return fFormat == rhs.fFormat
- && fType == rhs.fType
- && fFboFormat == rhs.fFboFormat;
- }
-
- uint32_t getHash() const {
- return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), sizeof(*this));
- }
- };
-
- ReadPixelsSupportedFormats(Key key, bool value) : fKey(key), fValue(value) {
- }
-
- static const Key& GetKey(const ReadPixelsSupportedFormats& element) {
- return element.fKey;
- }
-
- static uint32_t Hash(const Key& key) {
- return key.getHash();
- }
-
- bool value() const {
- return fValue;
- }
- private:
- Key fKey;
- bool fValue;
- };
-
- mutable SkTHashCache<ReadPixelsSupportedFormats,
- ReadPixelsSupportedFormats::Key> fReadPixelsSupportedCache;
-
typedef GrDrawTargetCaps INHERITED;
};
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 3eca3d6247..eddccc39f6 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -170,6 +170,8 @@ GrGpuGL::~GrGpuGL() {
}
///////////////////////////////////////////////////////////////////////////////
+
+
GrPixelConfig GrGpuGL::preferredReadPixelsConfig(GrPixelConfig readConfig,
GrPixelConfig surfaceConfig) const {
if (GR_GL_RGBA_8888_PIXEL_OPS_SLOW && kRGBA_8888_GrPixelConfig == readConfig) {
@@ -180,13 +182,9 @@ 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,
- surfaceConfig
- )) {
+ } else if (readConfig == kBGRA_8888_GrPixelConfig &&
+ !this->glCaps().readPixelsSupported(this->glInterface(),
+ GR_GL_BGRA, GR_GL_UNSIGNED_BYTE)) {
return kRGBA_8888_GrPixelConfig;
} else {
return readConfig;
@@ -715,7 +713,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.