Put caps in a struct, move up to GrDrawTarget
Review URL: http://codereview.appspot.com/5088049
git-svn-id: http://skia.googlecode.com/svn/trunk@2314 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrDrawTarget.h b/gpu/src/GrDrawTarget.h
index 1d61a18..a57ff81 100644
--- a/gpu/src/GrDrawTarget.h
+++ b/gpu/src/GrDrawTarget.h
@@ -30,6 +30,35 @@
class GrDrawTarget : public GrRefCnt {
public:
/**
+ * Represents the draw target capabilities.
+ */
+ struct Caps {
+ Caps() { memset(this, 0, sizeof(Caps)); }
+ Caps(const Caps& c) { *this = c; }
+ Caps& operator= (const Caps& c) {
+ memcpy(this, &c, sizeof(Caps));
+ return *this;
+ }
+ void print() const;
+ bool f8BitPaletteSupport : 1;
+ bool fNPOTTextureSupport : 1;
+ bool fNPOTTextureTileSupport : 1;
+ bool fNPOTRenderTargetSupport : 1;
+ bool fTwoSidedStencilSupport : 1;
+ bool fStencilWrapOpsSupport : 1;
+ bool fHWAALineSupport : 1;
+ bool fShaderSupport : 1;
+ bool fShaderDerivativeSupport : 1;
+ bool fFSAASupport : 1;
+ bool fDualSourceBlendingSupport : 1;
+ bool fBufferLockSupport : 1;
+ int fMinRenderTargetWidth;
+ int fMinRenderTargetHeight;
+ int fMaxRenderTargetSize;
+ int fMaxTextureSize;
+ };
+
+ /**
* Number of texture stages. Each stage takes as input a color and
* 2D texture coordinates. The color input to the first enabled stage is the
* per-vertex color or the constant color (setColor/setAlpha) if there are
@@ -48,7 +77,6 @@
kMaxTexCoords = kNumStages
};
-
/**
* The absolute maximum number of edges that may be specified for
* a single draw call when performing edge antialiasing. This is used for
@@ -197,6 +225,11 @@
virtual ~GrDrawTarget();
/**
+ * Gets the capabilities of the draw target.
+ */
+ const Caps& getCaps() const { return fCaps; }
+
+ /**
* Sets the current clip to the region specified by clip. All draws will be
* clipped against this clip if kClip_StateBit is enabled.
*
@@ -1307,6 +1340,8 @@
DrState fCurrDrawState;
+ Caps fCaps;
+
private:
// called when setting a new vert/idx source to unref prev vb/ib
void releasePreviousVertexSource();