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

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: Created 6 years, 6 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 | « no previous file | src/gpu/gl/GrGLCaps.cpp » ('j') | src/gpu/gl/GrGLCaps.cpp » ('J')
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 ccf04fd7ba5a3d668ef5d2671d0defc5af6ea6b6..24bf83afbb1aab9ca8c4ffbb3e3b9ffc9fcfb034 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -13,6 +13,7 @@
#include "GrGLStencilBuffer.h"
#include "SkTArray.h"
#include "SkTDArray.h"
+#include "SkTDynamicHash.h"
class GrGLContextInfo;
@@ -253,7 +254,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; }
@@ -324,6 +326,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;
@@ -364,6 +370,38 @@ private:
bool fFullClearIsFree : 1;
bool fDropsTileOnZeroDivide : 1;
+ struct ReadPixelsSupportedFormatsKey {
+ GrGLenum fFormat;
+ GrGLenum fType;
+ GrGLenum fFboFormat;
+
+ bool operator==(const ReadPixelsSupportedFormatsKey& rhs) const {
+ return fFormat == rhs.fFormat
+ && fType == rhs.fType
+ && fFboFormat == rhs.fFboFormat;
+ }
+ };
+
+ class ReadPixelsSupportedFormats {
+ public:
+ ReadPixelsSupportedFormats(ReadPixelsSupportedFormatsKey key,
+ bool value)
+ :fKey(key), fValue(value) {
+ }
+
+ static const ReadPixelsSupportedFormatsKey& GetKey(const ReadPixelsSupportedFormats& element) {
+ return element.fKey;
+ }
+ static uint32_t Hash(const ReadPixelsSupportedFormatsKey&);
+
+ bool value() const { return fValue; }
+ private:
+ ReadPixelsSupportedFormatsKey fKey;
+ bool fValue;
+ };
+
+ mutable SkTDynamicHash<ReadPixelsSupportedFormats, ReadPixelsSupportedFormatsKey> fReadPixelsSupportedCache;
+
typedef GrDrawTargetCaps INHERITED;
};
« no previous file with comments | « no previous file | src/gpu/gl/GrGLCaps.cpp » ('j') | src/gpu/gl/GrGLCaps.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698