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-04-20 18:35:38 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-04-20 18:35:38 +0000
commit07eecdca3e331eb4066c53a29305aeea6d692961 (patch)
treed511d99cc07f13525d8a87292c8d48d075b2d8ea /include/gpu/GrSamplerState.h
parent5a2e879ef8a3720ac3f06fbc13dcdaeb179f30c3 (diff)
Hooks up the GrCustomStage/GrGLProgramStageFactory/GrGLProgramStage
classes from r3726 so they can be used. Does not implement any actual effect stages. Has one large known bug: if custom stages are provided, GrSamplerState comparisons will break; this should preserve correct drawing, but decrease performance - among other things, we'll break draw batching. To fix this we'll need a RTTI system for GrCustomState objects, and we'll need to change the GrSamplerState comparison from a memcmp to something that also does a deep type-sensitive compare of any GrCustomState objects present. http://codereview.appspot.com/6074043/ git-svn-id: http://skia.googlecode.com/svn/trunk@3742 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/gpu/GrSamplerState.h')
-rw-r--r--include/gpu/GrSamplerState.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h
index 50a6cc9ec7..d9957bd578 100644
--- a/include/gpu/GrSamplerState.h
+++ b/include/gpu/GrSamplerState.h
@@ -11,8 +11,9 @@
#ifndef GrSamplerState_DEFINED
#define GrSamplerState_DEFINED
-#include "GrTypes.h"
+#include "GrCustomStage.h"
#include "GrMatrix.h"
+#include "GrTypes.h"
#define MAX_KERNEL_WIDTH 25
@@ -110,12 +111,17 @@ public:
* unfiltered, and use identity matrix.
*/
GrSamplerState()
- : fRadial2CenterX1()
+ : fCustomStage (NULL)
+ , fRadial2CenterX1()
, fRadial2Radius0()
, fRadial2PosRoot() {
this->reset();
}
+ ~GrSamplerState() {
+ GrSafeUnref(fCustomStage);
+ }
+
WrapMode getWrapX() const { return fWrapX; }
WrapMode getWrapY() const { return fWrapY; }
FilterDirection getFilterDirection() const { return fFilterDirection; }
@@ -188,6 +194,7 @@ public:
fMatrix = matrix;
fTextureDomain.setEmpty();
fSwapRAndB = false;
+ GrSafeSetNull(fCustomStage);
}
void reset(WrapMode wrapXAndY, Filter filter, const GrMatrix& matrix) {
this->reset(wrapXAndY, filter, kDefault_FilterDirection, matrix);
@@ -236,6 +243,11 @@ public:
fKernelWidth = radius;
}
+ void setCustomStage(GrCustomStage* stage) {
+ GrSafeAssign(fCustomStage, stage);
+ }
+ GrCustomStage* getCustomStage() const { return fCustomStage; }
+
private:
WrapMode fWrapX : 8;
WrapMode fWrapY : 8;
@@ -246,6 +258,12 @@ private:
bool fSwapRAndB;
GrRect fTextureDomain;
+ /// BUG! Ganesh only works correctly so long as fCustomStage is
+ /// NULL; we need to have a complex ID system here so that we can
+ /// have an equality-like comparison to determine whether two
+ /// fCustomStages are equal.
+ GrCustomStage* fCustomStage;
+
// these are undefined unless fSampleMode == kRadial2_SampleMode
GrScalar fRadial2CenterX1;
GrScalar fRadial2Radius0;