Remove GrGLProgram::CachedData, make GrGLProgram represent the program
Review URL: http://codereview.appspot.com/6409043/
git-svn-id: http://skia.googlecode.com/svn/trunk@4627 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrBinHashKey.h b/src/gpu/GrBinHashKey.h
index 028bb91..d2194e9 100644
--- a/src/gpu/GrBinHashKey.h
+++ b/src/gpu/GrBinHashKey.h
@@ -13,30 +13,40 @@
#include "GrTypes.h"
/**
- * Hash function class that can take a data chunk of any predetermined
- * length. The hash function used is the One-at-a-Time Hash
- * (http://burtleburtle.net/bob/hash/doobs.html).
+ * Hash function class that can take a data chunk of any predetermined length. The hash function
+ * used is the One-at-a-Time Hash (http://burtleburtle.net/bob/hash/doobs.html).
+ *
+ * Keys are computed from Entry objects. Entry must be fully ordered by a member:
+ * int compare(const GrTBinHashKey<Entry, ..>& k);
+ * which returns negative if the Entry < k, 0 if it equals k, and positive if k < the Entry.
+ * Additionally, Entry must be flattenable into the key using setKeyData.
+ *
+ * This class satisfies the requirements to be a key for a GrTHashTable.
*/
template<typename Entry, size_t KeySize>
-class GrBinHashKey {
+class GrTBinHashKey {
public:
- GrBinHashKey()
- : fHash(0)
-#if GR_DEBUG
- , fIsValid(false)
-#endif
- {}
+ GrTBinHashKey() {
+ this->reset();
+ }
- GrBinHashKey(const GrBinHashKey<Entry, KeySize>& other) {
+ GrTBinHashKey(const GrTBinHashKey<Entry, KeySize>& other) {
*this = other;
}
- GrBinHashKey<Entry, KeySize>& operator=(const GrBinHashKey<Entry,
- KeySize>& other) {
+
+ GrTBinHashKey<Entry, KeySize>& operator=(const GrTBinHashKey<Entry, KeySize>& other) {
memcpy(this, &other, sizeof(*this));
return *this;
}
- ~GrBinHashKey() {
+ ~GrTBinHashKey() {
+ }
+
+ void reset() {
+ fHash = 0;
+#if GR_DEBUG
+ fIsValid = false;
+#endif
}
void setKeyData(const uint32_t* SK_RESTRICT data) {
@@ -60,19 +70,17 @@
fHash = hash;
}
- int compare(const GrBinHashKey<Entry, KeySize>& key) const {
+ int compare(const GrTBinHashKey<Entry, KeySize>& key) const {
GrAssert(fIsValid && key.fIsValid);
return memcmp(fData, key.fData, KeySize);
}
- static bool
- EQ(const Entry& entry, const GrBinHashKey<Entry, KeySize>& key) {
+ static bool EQ(const Entry& entry, const GrTBinHashKey<Entry, KeySize>& key) {
GrAssert(key.fIsValid);
return 0 == entry.compare(key);
}
- static bool
- LT(const Entry& entry, const GrBinHashKey<Entry, KeySize>& key) {
+ static bool LT(const Entry& entry, const GrTBinHashKey<Entry, KeySize>& key) {
GrAssert(key.fIsValid);
return entry.compare(key) < 0;
}
@@ -84,7 +92,7 @@
private:
uint32_t fHash;
- uint8_t fData[KeySize]; //Buffer for key storage
+ uint8_t fData[KeySize]; // Buffer for key storage
#if GR_DEBUG
public: