Index: src/gpu/GrDrawTargetCaps.h |
diff --git a/src/gpu/GrDrawTargetCaps.h b/src/gpu/GrDrawTargetCaps.h |
index e1fd1cf40340aa40904d6188f0c39d3d9de1e59f..310703cacad1d4a23e1fc8b73977e8739f992811 100644 |
--- a/src/gpu/GrDrawTargetCaps.h |
+++ b/src/gpu/GrDrawTargetCaps.h |
@@ -14,12 +14,9 @@ |
#include "SkRefCnt.h" |
#include "SkString.h" |
-/** |
- * Represents the draw target capabilities. |
- */ |
-class GrDrawTargetCaps : public SkRefCnt { |
+class GrShaderCaps : public SkRefCnt { |
public: |
- SK_DECLARE_INST_COUNT(GrDrawTargetCaps) |
+ SK_DECLARE_INST_COUNT(GrShaderCaps) |
/** Info about shader variable precision within a given shader stage. That is, this info |
is relevant to a float (or vecNf) variable declared with a GrSLPrecision |
@@ -44,19 +41,76 @@ public: |
int fLogRangeLow; |
/** floor(log2(|max_value|)) */ |
int fLogRangeHigh; |
- /** Number of bits of precision. As defined in OpenGL (with names modified to reflect this |
+ /** Number of bits of precision. As defined in OpenGL (with names modified to reflect this |
struct) : |
""" |
- If the smallest representable value greater than 1 is 1 + e, then fBits will |
- contain floor(log2(e)), and every value in the range [2^fLogRangeLow, |
- 2^fLogRangeHigh] can be represented to at least one part in 2^fBits. |
- """ |
+ If the smallest representable value greater than 1 is 1 + e, then fBits will |
+ contain floor(log2(e)), and every value in the range [2^fLogRangeLow, |
+ 2^fLogRangeHigh] can be represented to at least one part in 2^fBits. |
+ """ |
*/ |
int fBits; |
}; |
+ GrShaderCaps() { |
+ this->reset(); |
+ } |
+ virtual ~GrShaderCaps() {} |
+ GrShaderCaps(const GrShaderCaps& other) : INHERITED() { |
+ *this = other; |
+ } |
+ GrShaderCaps& operator= (const GrShaderCaps&); |
+ |
+ virtual void reset(); |
+ virtual SkString dump() const; |
+ |
+ bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
+ bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
+ bool pathRenderingSupport() const { return fPathRenderingSupport; } |
+ bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } |
+ bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } |
+ |
+ /** |
+ * Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a |
+ * given shader type. If the shader type is not supported or the precision level is not |
+ * supported in that shader type then the returned struct will report false when supported() is |
+ * called. |
+ */ |
+ const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, |
+ GrSLPrecision precision) const { |
+ return fFloatPrecisions[shaderType][precision]; |
+ }; |
+ |
+ /** |
+ * Is there any difference between the float shader variable precision types? If this is true |
+ * then unless the shader type is not supported, any call to getFloatShaderPrecisionInfo() would |
+ * report the same info for all precisions in all shader types. |
+ */ |
+ bool floatPrecisionVaries() const { return fShaderPrecisionVaries; } |
+ |
+protected: |
+ bool fShaderDerivativeSupport : 1; |
+ bool fGeometryShaderSupport : 1; |
+ bool fPathRenderingSupport : 1; |
+ bool fDstReadInShaderSupport : 1; |
+ bool fDualSourceBlendingSupport : 1; |
+ |
+ bool fShaderPrecisionVaries; |
+ PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount]; |
+ |
+private: |
+ typedef SkRefCnt INHERITED; |
+}; |
+ |
+/** |
+ * Represents the draw target capabilities. |
+ */ |
+class GrDrawTargetCaps : public SkRefCnt { |
+public: |
+ SK_DECLARE_INST_COUNT(GrDrawTargetCaps) |
GrDrawTargetCaps() { |
+ fShaderCaps.reset(NULL); |
this->reset(); |
} |
GrDrawTargetCaps(const GrDrawTargetCaps& other) : INHERITED() { |
@@ -67,17 +121,14 @@ public: |
virtual void reset(); |
virtual SkString dump() const; |
+ GrShaderCaps* shaderCaps() const { return fShaderCaps; } |
+ |
bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
/** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g. |
only for POT textures) */ |
bool mipMapSupport() const { return fMipMapSupport; } |
bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } |
bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } |
- bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
- bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
- bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } |
- bool pathRenderingSupport() const { return fPathRenderingSupport; } |
- bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; } |
bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; } |
#if GR_FORCE_GPU_TRACE_DEBUGGING |
bool gpuTracingSupport() const { return true; } |
@@ -125,34 +176,13 @@ public: |
return fConfigTextureSupport[config]; |
} |
- /** |
- * Get the precision info for a variable of type kFloat_GrSLType, kVec2f_GrSLType, etc in a |
- * given shader type. If the shader type is not supported or the precision level is not |
- * supported in that shader type then the returned struct will report false when supported() is |
- * called. |
- */ |
- const PrecisionInfo& getFloatShaderPrecisionInfo(GrShaderType shaderType, |
- GrSLPrecision precision) const { |
- return fFloatPrecisions[shaderType][precision]; |
- }; |
- |
- /** |
- * Is there any difference between the float shader variable precision types? If this is true |
- * then unless the shader type is not supported, any call to getFloatShaderPrecisionInfo() would |
- * report the same info for all precisions in all shader types. |
- */ |
- bool floatPrecisionVaries() const { return fShaderPrecisionVaries; } |
- |
protected: |
+ SkAutoTUnref<GrShaderCaps> fShaderCaps; |
+ |
bool fNPOTTextureTileSupport : 1; |
bool fMipMapSupport : 1; |
bool fTwoSidedStencilSupport : 1; |
bool fStencilWrapOpsSupport : 1; |
- bool fShaderDerivativeSupport : 1; |
- bool fGeometryShaderSupport : 1; |
- bool fDualSourceBlendingSupport : 1; |
- bool fPathRenderingSupport : 1; |
- bool fDstReadInShaderSupport : 1; |
bool fDiscardRenderTargetSupport : 1; |
bool fReuseScratchTextures : 1; |
bool fGpuTracingSupport : 1; |
@@ -172,9 +202,6 @@ protected: |
bool fConfigRenderSupport[kGrPixelConfigCnt][2]; |
bool fConfigTextureSupport[kGrPixelConfigCnt]; |
- bool fShaderPrecisionVaries; |
- PrecisionInfo fFloatPrecisions[kGrShaderTypeCount][kGrSLPrecisionCount]; |
- |
private: |
typedef SkRefCnt INHERITED; |
}; |