Index: include/gpu/GrTypesPriv.h |
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h |
index 8c7d6bda65150b6cd055a235f136077f4897c008..5168ac91a175c9bb6935b4b73bfafeae8cc061ea 100644 |
--- a/include/gpu/GrTypesPriv.h |
+++ b/include/gpu/GrTypesPriv.h |
@@ -25,15 +25,17 @@ enum GrSLType { |
kMat22f_GrSLType, |
kMat33f_GrSLType, |
kMat44f_GrSLType, |
- kSampler2D_GrSLType, |
- kSamplerExternal_GrSLType, |
- kSampler2DRect_GrSLType, |
- kSamplerBuffer_GrSLType, |
+ kTexture2DSampler_GrSLType, |
+ kTextureExternalSampler_GrSLType, |
+ kTexture2DRectSampler_GrSLType, |
+ kTextureBufferSampler_GrSLType, |
kBool_GrSLType, |
kInt_GrSLType, |
kUint_GrSLType, |
+ kTexture2D_GrSLType, |
+ kSampler_GrSLType, |
- kLast_GrSLType = kUint_GrSLType |
+ kLast_GrSLType = kSampler_GrSLType |
}; |
static const int kGrSLTypeCount = kLast_GrSLType + 1; |
@@ -78,7 +80,7 @@ static const int kGrSLPrecisionCount = kLast_GrSLPrecision + 1; |
*/ |
static inline int GrSLTypeVectorCount(GrSLType type) { |
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
- static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1 }; |
+ static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, -1, -1 }; |
return kCounts[type]; |
GR_STATIC_ASSERT(0 == kVoid_GrSLType); |
@@ -89,13 +91,15 @@ static inline int GrSLTypeVectorCount(GrSLType type) { |
GR_STATIC_ASSERT(5 == kMat22f_GrSLType); |
GR_STATIC_ASSERT(6 == kMat33f_GrSLType); |
GR_STATIC_ASSERT(7 == kMat44f_GrSLType); |
- GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); |
- GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); |
- GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); |
- GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); |
+ GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType); |
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType); |
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType); |
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType); |
GR_STATIC_ASSERT(12 == kBool_GrSLType); |
GR_STATIC_ASSERT(13 == kInt_GrSLType); |
GR_STATIC_ASSERT(14 == kUint_GrSLType); |
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType); |
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType); |
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount); |
} |
@@ -124,20 +128,22 @@ static inline bool GrSLTypeIsFloatType(GrSLType type) { |
GR_STATIC_ASSERT(5 == kMat22f_GrSLType); |
GR_STATIC_ASSERT(6 == kMat33f_GrSLType); |
GR_STATIC_ASSERT(7 == kMat44f_GrSLType); |
- GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); |
- GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); |
- GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); |
- GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); |
+ GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType); |
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType); |
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType); |
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType); |
GR_STATIC_ASSERT(12 == kBool_GrSLType); |
GR_STATIC_ASSERT(13 == kInt_GrSLType); |
GR_STATIC_ASSERT(14 == kUint_GrSLType); |
- GR_STATIC_ASSERT(15 == kGrSLTypeCount); |
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType); |
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType); |
+ GR_STATIC_ASSERT(17 == kGrSLTypeCount); |
} |
/** Is the shading language type integral (including vectors/matrices)? */ |
static inline bool GrSLTypeIsIntType(GrSLType type) { |
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
- return type >= kInt_GrSLType; |
+ return type >= kInt_GrSLType && type <= kUint_GrSLType; |
GR_STATIC_ASSERT(0 == kVoid_GrSLType); |
GR_STATIC_ASSERT(1 == kFloat_GrSLType); |
@@ -147,14 +153,16 @@ static inline bool GrSLTypeIsIntType(GrSLType type) { |
GR_STATIC_ASSERT(5 == kMat22f_GrSLType); |
GR_STATIC_ASSERT(6 == kMat33f_GrSLType); |
GR_STATIC_ASSERT(7 == kMat44f_GrSLType); |
- GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); |
- GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); |
- GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); |
- GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); |
+ GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType); |
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType); |
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType); |
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType); |
GR_STATIC_ASSERT(12 == kBool_GrSLType); |
GR_STATIC_ASSERT(13 == kInt_GrSLType); |
GR_STATIC_ASSERT(14 == kUint_GrSLType); |
- GR_STATIC_ASSERT(15 == kGrSLTypeCount); |
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType); |
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType); |
+ GR_STATIC_ASSERT(17 == kGrSLTypeCount); |
} |
/** Is the shading language type numeric (including vectors/matrices)? */ |
@@ -174,13 +182,15 @@ static inline size_t GrSLTypeSize(GrSLType type) { |
2 * 2 * sizeof(float), // kMat22f_GrSLType |
3 * 3 * sizeof(float), // kMat33f_GrSLType |
4 * 4 * sizeof(float), // kMat44f_GrSLType |
- 0, // kSampler2D_GrSLType |
- 0, // kSamplerExternal_GrSLType |
- 0, // kSampler2DRect_GrSLType |
- 0, // kSamplerBuffer_GrSLType |
+ 0, // kTexture2DSampler_GrSLType |
+ 0, // kTextureExternalSampler_GrSLType |
+ 0, // kTexture2DRectSampler_GrSLType |
+ 0, // kTextureBufferSampler_GrSLType |
0, // kBool_GrSLType |
0, // kInt_GrSLType |
0, // kUint_GrSLType |
+ 0, // kTexture2D_GrSLType |
+ 0, // kSampler_GrSLType |
}; |
return kSizes[type]; |
@@ -192,37 +202,39 @@ static inline size_t GrSLTypeSize(GrSLType type) { |
GR_STATIC_ASSERT(5 == kMat22f_GrSLType); |
GR_STATIC_ASSERT(6 == kMat33f_GrSLType); |
GR_STATIC_ASSERT(7 == kMat44f_GrSLType); |
- GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); |
- GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); |
- GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); |
- GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); |
+ GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType); |
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType); |
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType); |
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType); |
GR_STATIC_ASSERT(12 == kBool_GrSLType); |
GR_STATIC_ASSERT(13 == kInt_GrSLType); |
GR_STATIC_ASSERT(14 == kUint_GrSLType); |
- GR_STATIC_ASSERT(15 == kGrSLTypeCount); |
+ GR_STATIC_ASSERT(15 == kTexture2D_GrSLType); |
+ GR_STATIC_ASSERT(16 == kSampler_GrSLType); |
+ GR_STATIC_ASSERT(17 == kGrSLTypeCount); |
} |
-static inline bool GrSLTypeIs2DTextureType(GrSLType type) { |
+static inline bool GrSLTypeIs2DCombinedSamplerType(GrSLType type) { |
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
- return type >= kSampler2D_GrSLType && type <= kSampler2DRect_GrSLType; |
+ return type >= kTexture2DSampler_GrSLType && type <= kTexture2DRectSampler_GrSLType; |
- GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); |
- GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); |
- GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); |
+ GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType); |
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType); |
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType); |
} |
-static inline bool GrSLTypeIsSamplerType(GrSLType type) { |
+static inline bool GrSLTypeIsCombinedSamplerType(GrSLType type) { |
SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount)); |
- return type >= kSampler2D_GrSLType && type <= kSamplerBuffer_GrSLType; |
+ return type >= kTexture2DSampler_GrSLType && type <= kTextureBufferSampler_GrSLType; |
- GR_STATIC_ASSERT(8 == kSampler2D_GrSLType); |
- GR_STATIC_ASSERT(9 == kSamplerExternal_GrSLType); |
- GR_STATIC_ASSERT(10 == kSampler2DRect_GrSLType); |
- GR_STATIC_ASSERT(11 == kSamplerBuffer_GrSLType); |
+ GR_STATIC_ASSERT(8 == kTexture2DSampler_GrSLType); |
+ GR_STATIC_ASSERT(9 == kTextureExternalSampler_GrSLType); |
+ GR_STATIC_ASSERT(10 == kTexture2DRectSampler_GrSLType); |
+ GR_STATIC_ASSERT(11 == kTextureBufferSampler_GrSLType); |
} |
static inline bool GrSLTypeAcceptsPrecision(GrSLType type) { |
- return GrSLTypeIsNumeric(type) || GrSLTypeIsSamplerType(type); |
+ return type != kVoid_GrSLType && type != kBool_GrSLType; |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -243,7 +255,7 @@ enum GrVertexAttribType { |
kInt_GrVertexAttribType, |
kUint_GrVertexAttribType, |
- |
+ |
kLast_GrVertexAttribType = kUint_GrVertexAttribType |
}; |
static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; |