Add UniqueID to GrDrawTargetCaps.
This is needed for creating the Optimized Draw State and checking that we have the same caps
on subsequent calls to ODS
BUG=skia:
R=bsalomon@google.com
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/585043002
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h
index 1a3a84c..e468bc4 100644
--- a/src/gpu/GrDrawTargetCaps.h
+++ b/src/gpu/GrDrawTargetCaps.h
@@ -19,8 +19,12 @@
public:
SK_DECLARE_INST_COUNT(GrDrawTargetCaps)
- GrDrawTargetCaps() { this->reset(); }
- GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; }
+ GrDrawTargetCaps() : fUniqueID(CreateUniqueID()) {
+ this->reset();
+ }
+ GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED(), fUniqueID(CreateUniqueID()) {
+ *this = other;
+ }
GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
virtual void reset();
@@ -77,6 +81,13 @@
return fConfigTextureSupport[config];
}
+ /**
+ * Gets an id that is unique for this GrDrawTargetCaps object. It is static in that it does
+ * not change when the content of the GrDrawTargetCaps object changes. This will never return
+ * 0.
+ */
+ uint32_t getUniqueID() const { return fUniqueID; }
+
protected:
bool fNPOTTextureTileSupport : 1;
bool fMipMapSupport : 1;
@@ -103,6 +114,11 @@
bool fConfigRenderSupport[kGrPixelConfigCnt][2];
bool fConfigTextureSupport[kGrPixelConfigCnt];
+private:
+ static uint32_t CreateUniqueID();
+
+ const uint32_t fUniqueID;
+
typedef SkRefCnt INHERITED;
};