Index: src/gpu/gl/GrGLCaps.h |
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h |
index ccf04fd7ba5a3d668ef5d2671d0defc5af6ea6b6..7b1144a1822121e8241258c765bb7cb92957d93b 100644 |
--- a/src/gpu/gl/GrGLCaps.h |
+++ b/src/gpu/gl/GrGLCaps.h |
@@ -11,8 +11,8 @@ |
#include "GrDrawTargetCaps.h" |
#include "GrGLStencilBuffer.h" |
+#include "SkTHashCache.h" |
#include "SkTArray.h" |
-#include "SkTDArray.h" |
class GrGLContextInfo; |
@@ -253,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; } |
@@ -324,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; |
@@ -364,6 +369,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 SkTHashCache<ReadPixelsSupportedFormats, ReadPixelsSupportedFormatsKey> fReadPixelsSupportedCache; |
+ |
typedef GrDrawTargetCaps INHERITED; |
}; |