Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Unified Diff: include/gpu/GrTypesPriv.h

Issue 1583863002: Beginning of support for texture rectangles. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/gl/SkGLContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrTypesPriv.h
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 6a9c44ff9fb9d2c38bc63f069b312a9869cf5a91..c46e25bd0d4410bfb11dcf4a4743072a766e84d7 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -26,8 +26,9 @@ enum GrSLType {
kMat44f_GrSLType,
kSampler2D_GrSLType,
kSamplerExternal_GrSLType,
+ kSampler2DRect_GrSLType,
- kLast_GrSLType = kSamplerExternal_GrSLType
+ kLast_GrSLType = kSampler2DRect_GrSLType
};
static const int kGrSLTypeCount = kLast_GrSLType + 1;
@@ -64,7 +65,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 };
+ static const int kCounts[] = { -1, 1, 2, 3, 4, -1, -1, -1, -1, -1 };
return kCounts[type];
GR_STATIC_ASSERT(0 == kVoid_GrSLType);
@@ -76,6 +77,7 @@ static inline int GrSLTypeVectorCount(GrSLType type) {
GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
GR_STATIC_ASSERT(SK_ARRAY_COUNT(kCounts) == kGrSLTypeCount);
}
@@ -105,7 +107,8 @@ static inline bool GrSLTypeIsFloatType(GrSLType type) {
GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(10 == kGrSLTypeCount);
}
/** Returns the size in bytes for floating point GrSLTypes. For non floating point type returns 0 */
@@ -120,7 +123,8 @@ static inline size_t GrSLTypeSize(GrSLType type) {
9 * sizeof(float), // kMat33f_GrSLType
16 * sizeof(float), // kMat44f_GrSLType
0, // kSampler2D_GrSLType
- 0 // kSamplerExternal_GrSLType
+ 0, // kSamplerExternal_GrSLType
+ 0 // kSampler2DRect_GrSLType
};
return kSizes[type];
@@ -133,7 +137,17 @@ static inline size_t GrSLTypeSize(GrSLType type) {
GR_STATIC_ASSERT(6 == kMat44f_GrSLType);
GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
- GR_STATIC_ASSERT(9 == kGrSLTypeCount);
+ GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
+ GR_STATIC_ASSERT(10 == kGrSLTypeCount);
+}
+
+static inline bool GrSLTypeIsSamplerType(GrSLType type) {
+ SkASSERT(type >= 0 && type < static_cast<GrSLType>(kGrSLTypeCount));
+ return type >= 7 && type <= 9;
+
+ GR_STATIC_ASSERT(7 == kSampler2D_GrSLType);
+ GR_STATIC_ASSERT(8 == kSamplerExternal_GrSLType);
+ GR_STATIC_ASSERT(9 == kSampler2DRect_GrSLType);
}
//////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « gyp/gpu.gypi ('k') | include/gpu/gl/SkGLContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698