Index: src/gpu/gl/GrGLCaps.h |
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h |
index ccf04fd7ba5a3d668ef5d2671d0defc5af6ea6b6..a316af668a12b923c2e71a561ecc553223a61324 100644 |
--- a/src/gpu/gl/GrGLCaps.h |
+++ b/src/gpu/gl/GrGLCaps.h |
@@ -11,8 +11,9 @@ |
#include "GrDrawTargetCaps.h" |
#include "GrGLStencilBuffer.h" |
+#include "SkTHashCache.h" |
+#include "GrTHashTable.h" |
mtklein
2014/07/11 17:08:08
Do you still need this?
Rémi Piotaix
2014/07/11 17:45:01
This one is not needed: "GrTHashTable.h"
Deleted.
|
#include "SkTArray.h" |
-#include "SkTDArray.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,55 @@ 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 { |
+ // fFormat has different values like 0x190X or 0x8XXX: 16 bits are required |
+ uint32_t hash = ((static_cast<uint32_t> (fFormat) & 0xFFFF) << 16); |
+ // fType is 0x14XX: 8 lower bits are enough |
+ hash |= ((static_cast<uint32_t> (fType) & 0xFF) << 8); |
+ // fFboFormat is enum GrPixelConfig which has less than 15 values: 8 bits OK |
+ hash |= (static_cast<uint32_t> (fFboFormat) & 0xFF); |
+ |
+ return hash; |
+ } |
+ }; |
+ |
+ 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; |
}; |