Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Unified Diff: src/gpu/gl/GrGLCaps.h

Issue 364193004: Reopened: Caching the result of readPixelsSupported (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTHashCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLCaps.h
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 887e2e9e2ad0067a43902ee868d3dfe6ecae5b0e..eb56798fda2405a9e09a3f7054080dbc527e9062 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -11,8 +11,9 @@
#include "GrDrawTargetCaps.h"
#include "GrGLStencilBuffer.h"
+#include "SkChecksum.h"
+#include "SkTHashCache.h"
#include "SkTArray.h"
-#include "SkTDArray.h"
class GrGLContextInfo;
@@ -252,7 +253,8 @@ public:
/// Does ReadPixels support the provided format/type combo?
bool readPixelsSupported(const GrGLInterface* intf,
GrGLenum format,
- GrGLenum type) const;
+ GrGLenum type,
+ GrGLenum currFboFormat) const;
bool isCoreProfile() const { return fIsCoreProfile; }
@@ -323,6 +325,10 @@ 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;
@@ -366,6 +372,46 @@ private:
const char* fFBFetchColorName;
const char* fFBFetchExtensionString;
+ 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;
};
« no previous file with comments | « src/core/SkTHashCache.h ('k') | src/gpu/gl/GrGLCaps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698