aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/GrSamplerState.h
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-01 12:48:07 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-01 12:48:07 +0000
commitb88bbd2a5388ec2a5574d0ef7e43160c0ac37a3b (patch)
tree93db361f3c08336c0142b704b75c7d25d1648c24 /include/gpu/GrSamplerState.h
parent7c2578d392adf76476cbae4aa3847504f8df1487 (diff)
Make GrSamplerState::operator==() use GrCustomStage::isEquivalent() rather
than just bit-compare all fields. git-svn-id: http://skia.googlecode.com/svn/trunk@3805 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/gpu/GrSamplerState.h')
-rw-r--r--include/gpu/GrSamplerState.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h
index 50fe240c8d..3fd39c560a 100644
--- a/include/gpu/GrSamplerState.h
+++ b/include/gpu/GrSamplerState.h
@@ -111,10 +111,10 @@ public:
* unfiltered, and use identity matrix.
*/
GrSamplerState()
- : fCustomStage (NULL)
- , fRadial2CenterX1()
+ : fRadial2CenterX1()
, fRadial2Radius0()
- , fRadial2PosRoot() {
+ , fRadial2PosRoot()
+ , fCustomStage (NULL) {
this->reset();
}
@@ -123,7 +123,19 @@ public:
}
bool operator ==(const GrSamplerState& s) const {
- return !memcmp(this, &s, sizeof(GrSamplerState));
+ /* We must be bit-identical as far as the CustomStage;
+ there may be multiple CustomStages that will produce
+ the same shader code and so are equivalent.
+ Can't take the address of fWrapX because it's :8 */
+ int bitwiseRegion = (intptr_t) &fCustomStage - (intptr_t) this;
+ GrAssert(sizeof(GrSamplerState) ==
+ bitwiseRegion + sizeof(fCustomStage));
+ return !memcmp(this, &s, bitwiseRegion) &&
+ ((fCustomStage == s.fCustomStage) ||
+ (fCustomStage && s.fCustomStage &&
+ (fCustomStage->getGLFactory() ==
+ s.fCustomStage->getGLFactory()) &&
+ fCustomStage->isEquivalent(s.fCustomStage)));
}
bool operator !=(const GrSamplerState& s) const { return !(*this == s); }