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
This commit is contained in:
parent
45725db1d8
commit
bc127a3fda
@ -1147,3 +1147,13 @@ SkString GrDrawTargetCaps::dump() const {
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t GrDrawTargetCaps::CreateUniqueID() {
|
||||||
|
static int32_t gUniqueID = SK_InvalidUniqueID;
|
||||||
|
uint32_t id;
|
||||||
|
do {
|
||||||
|
id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
|
||||||
|
} while (id == SK_InvalidUniqueID);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,12 @@ class GrDrawTargetCaps : public SkRefCnt {
|
|||||||
public:
|
public:
|
||||||
SK_DECLARE_INST_COUNT(GrDrawTargetCaps)
|
SK_DECLARE_INST_COUNT(GrDrawTargetCaps)
|
||||||
|
|
||||||
GrDrawTargetCaps() { this->reset(); }
|
GrDrawTargetCaps() : fUniqueID(CreateUniqueID()) {
|
||||||
GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { *this = other; }
|
this->reset();
|
||||||
|
}
|
||||||
|
GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED(), fUniqueID(CreateUniqueID()) {
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
|
GrDrawTargetCaps& operator= (const GrDrawTargetCaps&);
|
||||||
|
|
||||||
virtual void reset();
|
virtual void reset();
|
||||||
@ -77,6 +81,13 @@ public:
|
|||||||
return fConfigTextureSupport[config];
|
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:
|
protected:
|
||||||
bool fNPOTTextureTileSupport : 1;
|
bool fNPOTTextureTileSupport : 1;
|
||||||
bool fMipMapSupport : 1;
|
bool fMipMapSupport : 1;
|
||||||
@ -103,6 +114,11 @@ protected:
|
|||||||
bool fConfigRenderSupport[kGrPixelConfigCnt][2];
|
bool fConfigRenderSupport[kGrPixelConfigCnt][2];
|
||||||
bool fConfigTextureSupport[kGrPixelConfigCnt];
|
bool fConfigTextureSupport[kGrPixelConfigCnt];
|
||||||
|
|
||||||
|
private:
|
||||||
|
static uint32_t CreateUniqueID();
|
||||||
|
|
||||||
|
const uint32_t fUniqueID;
|
||||||
|
|
||||||
typedef SkRefCnt INHERITED;
|
typedef SkRefCnt INHERITED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user